From e11f98b6764af4f66ad2f5fab3e33248f0abe405 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Fri, 24 Jul 2009 12:46:59 +0200 Subject: [PATCH] unquote youtube key --- oxweb/youtube.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/oxweb/youtube.py b/oxweb/youtube.py index a788b30..e35dc52 100644 --- a/oxweb/youtube.py +++ b/oxweb/youtube.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # vi:si:et:sw=4:sts=4:ts=4 -from urllib import quote +from urllib import quote, unquote import httplib import xml.etree.ElementTree as ET import re @@ -14,7 +14,7 @@ def getVideoKey(youtubeId): data = getUrl("http://www.youtube.com/watch?v=%s" % youtubeId) match = re.compile(".*[?&]t=([^&]+).*").findall(data) if match: - return match[0] + return unquote(match[0]) try: conn = httplib.HTTPConnection ("www.youtube.com") conn.request ("HEAD", '/v/' + youtubeId) @@ -27,7 +27,7 @@ def getVideoKey(youtubeId): location = response.getheader("location") match = re.match(".*[?&]t=([^&]+)", location) if match: - return match.groups()[0] + return unquote(match.groups()[0]) return False def getVideoUrl(youtubeId, format='mp4'):