1
0
Fork 0
fastcloudtube/fastcloudtube.py

22 Zeilen
588 B
Python

#!/usr/bin/env python3
from bottle import route, run, template
from subprocess import call
@route("/")
@route("/<link:path>")
def index(link=""):
if(link == ""):
return "Please add a youtube-dl compatible link"
else:
return download(link)
def download(link):
try:
call(["youtube-dl", """--no-playlist --output "%(playlist_title)s%(ext)s" --write-thumbnail --extract-audio --audio-quality 9 --embed-thumbnail """])
except OSError:
return "youtube-dl is not installed on the host"
except:
return "some strange error happened"
run(host="0.0.0.0", port=1995, reloader=True)