Advertisement
rhama

Youtube Subtitle Donwloader

Jan 4th, 2016
444
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.04 KB | None | 0 0
  1. import urllib, urllib2
  2.  
  3. print '''Youtube Subtitle Downloader
  4. Usage : script.py, then enter youtube id video,
  5. ex : https://www.youtube.com/watch?v=H_8UBv5bZo0
  6. id video = H_8UBv5bZo0 '''
  7. print "================================="
  8. print ""
  9. idyt = raw_input("Masukan ID Video : ")
  10. sub ='id' # ini adalah subtitle nya, id = indonesia
  11. url = 'http://mo.dbxdb.com/Yang/mo.php?lang=en&url=https://www.youtube.com/watch?v='+idyt
  12. url2 = 'http://mo.dbxdb.com/Yang/subtitle.php?vid='+idyt
  13. try:
  14.     req = urllib2.Request(url)
  15.     req.add_header('User-agent','Mozilla 5.11')
  16.     req.add_header('Cookie','dbtlang='+sub+'dbtlangend')
  17.     buka = urllib2.urlopen(req)
  18.     req = urllib2.Request(url2)
  19.     req.add_header('User-agent','Mozilla 5.11')
  20.     req.add_header('Cookie','dbtlang='+sub+'dbtlangend')
  21.     step2 = urllib2.urlopen(req)
  22.     html2 = step2.read()
  23.     urlsub = step2.geturl()
  24.     urlsub = urllib.urlretrieve(urlsub,urlsub[39:])
  25.     print urlsub
  26.     print "Subtitle Downloaded"
  27. except urllib2.HTTPError:
  28.     print "Subtitle tidak ditemukan"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement