Server IP : 80.241.246.6 / Your IP : 216.73.216.188 Web Server : Apache/2.4.25 (Debian) System : Linux kharagauli 4.9.0-19-amd64 #1 SMP Debian 4.9.320-2 (2022-06-30) x86_64 User : www-data ( 33) PHP Version : 7.0.33-0+deb9u12 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/kharagauli1/moduls/video_gallery_big_2/admin/youtube/ |
Upload File : |
#!/usr/bin/python # To change this license header, choose License Headers in Project Properties. # To change this template file, choose Tools | Templates # and open the template in the editor. __author__="suxoza" __date__ ="$Mar 3, 2014 9:23:15 AM$" from urlparse import parse_qs from urllib2 import urlopen import re,sys,json,pprint,sys from urllib2 import build_opener, HTTPError, URLError def get_js(videoid): opener = build_opener() watchurl = "https://www.youtube.com/watch?v=" + videoid #watchinfo = opener.open(watchurl).read().decode("UTF-8") watchinfo = urlopen(watchurl).read().decode("UTF-8") #print(watchinfo) m = re.search(r';ytplayer.config = ({.*?});', watchinfo) print(m.group(1)) try: myjson = json.loads(m.group(1)) except: raise RuntimeError('Problem handling this video') args = myjson['args'] html5player = myjson['assets']['js'] if html5player.startswith("//"): html5player = "https:" + html5player #js = opener.open(html5player).read().decode("UTF-8") js = urlopen(html5player).read().decode("UTF-8") return(js,args) if __name__ == "__main__": aa = get_js(sys.argv[1]) #print(aa)