Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import urllib, urllib2
- print '''Youtube Subtitle Downloader
- Usage : script.py, then enter youtube id video,
- ex : https://www.youtube.com/watch?v=H_8UBv5bZo0
- id video = H_8UBv5bZo0 '''
- print "================================="
- print ""
- idyt = raw_input("Masukan ID Video : ")
- sub ='id' # ini adalah subtitle nya, id = indonesia
- url = 'http://mo.dbxdb.com/Yang/mo.php?lang=en&url=https://www.youtube.com/watch?v='+idyt
- url2 = 'http://mo.dbxdb.com/Yang/subtitle.php?vid='+idyt
- try:
- req = urllib2.Request(url)
- req.add_header('User-agent','Mozilla 5.11')
- req.add_header('Cookie','dbtlang='+sub+'dbtlangend')
- buka = urllib2.urlopen(req)
- req = urllib2.Request(url2)
- req.add_header('User-agent','Mozilla 5.11')
- req.add_header('Cookie','dbtlang='+sub+'dbtlangend')
- step2 = urllib2.urlopen(req)
- html2 = step2.read()
- urlsub = step2.geturl()
- urlsub = urllib.urlretrieve(urlsub,urlsub[39:])
- print urlsub
- print "Subtitle Downloaded"
- except urllib2.HTTPError:
- print "Subtitle tidak ditemukan"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement