udpate youtube drm

This commit is contained in:
j 2009-08-19 18:02:05 +02:00
parent 49aba849c0
commit 0600d39198

View file

@ -11,23 +11,10 @@ from oxlib import findString, findRe
def getVideoKey(youtubeId):
data = getUrl("http://www.youtube.com/watch?v=%s" % youtubeId)
match = re.compile(".*[?&]t=([^&]+).*").findall(data)
data = getUrl("http://www.youtube.com/get_video_info?&video_id=%s" % youtubeId)
match = re.compile("token=(.+)&thumbnail").findall(data)
if match:
return unquote(match[0])
try:
conn = httplib.HTTPConnection ("www.youtube.com")
conn.request ("HEAD", '/v/' + youtubeId)
response = conn.getresponse ()
conn.close ()
except:
return False
if response.status >= 300 and response.status < 400:
location = response.getheader("location")
match = re.match(".*[?&]t=([^&]+)", location)
if match:
return unquote(match.groups()[0])
return False
def getVideoUrl(youtubeId, format='mp4'):