Browse Source

Initial commit of files

Gogs 4 years ago
parent
commit
6703296f38
1 changed files with 21 additions and 0 deletions
  1. 21
    0
      fastcloudtube.py

+ 21
- 0
fastcloudtube.py View File

@@ -0,0 +1,21 @@
1
+#!/usr/bin/env python3
2
+from bottle import route, run, template
3
+from subprocess import call
4
+
5
+@route("/")
6
+@route("/<link:path>")
7
+def index(link=""):
8
+	if(link == ""):
9
+		return "Please add a youtube-dl compatible link"
10
+	else:
11
+		return download(link)
12
+
13
+def download(link):
14
+	try:
15
+		call(["youtube-dl", """--no-playlist --output "%(playlist_title)s%(ext)s" --write-thumbnail --extract-audio --audio-quality 9 --embed-thumbnail """])
16
+	except OSError:
17
+		return "youtube-dl is not installed on the host"
18
+	except:
19
+		return "some strange error happened"
20
+
21
+run(host="0.0.0.0", port=1995, reloader=True)

Loading…
Cancel
Save