Advertisement
wandrake

Untitled

Jul 1st, 2013
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. import urllib2, re, json
  2.  
  3. class Youtube:
  4.  
  5.     def __init__(self, video_id):
  6.         self.video_id = video_id
  7.         larobba = urllib2.urlopen(urllib2.Request('http://youtube.com/watch?v=%s' % video_id)).read()
  8.  
  9.         pattern = 'ytplayer.config = (.*);</script>'
  10.         maggie = re.findall(pattern, larobba)[0]
  11.         tuttoquanto = json.loads(maggie)
  12.  
  13.         print tuttoquanto
  14.  
  15. Youtube('6PGpn6Iw50g')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement