carlosmc Posted January 30, 2018 Posted January 30, 2018 (edited) I am new to heliohost.I am running a python script which needs module youtube-dl: https://youtube-dl.org can you please install python module youtube-dl I am trying to run a script which demand this. i am on Johnny server. Thanks and you guys are doing great job. Edited January 30, 2018 by carlosmc
Krydos Posted January 30, 2018 Posted January 30, 2018 What does the script that needs this do?youtube-dl - download videos from youtube.com or other video platformsSource: https://github.com/rg3/youtube-dl/blob/master/README.md#readme Which version of python are you using?
carlosmc Posted January 30, 2018 Author Posted January 30, 2018 What does the script that needs this do?the script allows that from the wii console, videos from youtube.com can be viewed through youtube-dl (the official support of youtube in this console already finished) is only for personal use
carlosmc Posted January 30, 2018 Author Posted January 30, 2018 What does the script that needs this do?youtube-dl - download videos from youtube.com or other video platformsSource: https://github.com/rg3/youtube-dl/blob/master/README.md#readme Which version of python are you using? I'm using python 2.7
carlosmc Posted January 30, 2018 Author Posted January 30, 2018 this is the script #!/usr/bin/pythonimport cgiform = cgi.FieldStorage()import reimport httplibimport urllibimport subprocessimport sysimport os# IMPORTANT: This directory must exist, and the web user must have full access to itmedia_dir = "/public_html/media/"if ("query" not in form and "watch" not in form): print("Content-type: text/plain\n") print("No search query entered.") sys.exit(0)if ("watch" in form): watch = re.sub(r'[./]', '', str(form["watch"].value)) outfile = media_dir + watch + ".mp4" subprocess.call(["youtube-dl", "-f", "18", "-o", outfile, "https://www.youtube.com/watch?v=" + watch], stdout = open("/dev/null", "w")) print("Content-type: video/mp4") print("Content-Length: " + str(os.path.getsize(outfile)) + "\n") f = open(outfile) while (True): chunk = f.read(1048576) if (len(chunk) == 0): f.close() break sys.stdout.write(chunk) sys.exit(0)query = str(form["hola"].value)conn = httplib.HTTPSConnection("www.youtube.com")conn.request("GET", "/results?search_query=" + urllib.quote(query))res = conn.getresponse()ytlines = res.read().split("\n")conn.close()names = []urls = []for i in ytlines: m = re.search('/watch\?v=[^"]*"[^>]*title="[^"]*"', i) if (m): if (re.search('ypc-badge', i)): continue m = i[m.start():m.end()] names.append(re.sub('/watch\?v=([^"]*)".*title="([^"]*)".*', r'\2', m)) urls.append(re.sub('/watch\?v=([^"]*)".*title="([^"]*)".*', r'\1', m))print("Content-type: text/plain\n")for i,j in zip(names, urls): print("youtube.py?watch=" + j + "&videoname=/" + i)
Krydos Posted January 30, 2018 Posted January 30, 2018 There you go https://krydos2.heliohost.org/cgi-bin/modules27.py
carlosmc Posted January 30, 2018 Author Posted January 30, 2018 There you go https://krydos2.heliohost.org/cgi-bin/modules27.pyThank you very much for your help
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now