From 0600d391985c2d92802df43b0c5d259049af2d25 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Wed, 19 Aug 2009 18:02:05 +0200 Subject: [PATCH] udpate youtube drm --- oxweb/youtube.py | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/oxweb/youtube.py b/oxweb/youtube.py index e35dc52..d4b36db 100644 --- a/oxweb/youtube.py +++ b/oxweb/youtube.py @@ -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'):