From f26f5de6666872892869188d6e549a6c20a14f6d Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sun, 7 Dec 2008 15:39:39 +0100 Subject: [PATCH] fix plot, fix dont fail in youtube --- oxweb/imdb.py | 4 ++-- oxweb/youtube.py | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/oxweb/imdb.py b/oxweb/imdb.py index dab184b..63dbe04 100644 --- a/oxweb/imdb.py +++ b/oxweb/imdb.py @@ -257,8 +257,8 @@ def getMovieQuotes(imdbId): def getMoviePlot(imdbId): url = "%s/plotsummary" % getUrlBase(imdbId) data = getUrlUnicode(url) - plot = findRe(data, '

(.*?)') - return plot + plot = findRe(data, '

(.*?)').split('

')[0] + return plot.strip() def getMovieTechnical(imdbId): url = "%s/technical" % getUrlBase(imdbId) diff --git a/oxweb/youtube.py b/oxweb/youtube.py index 31e388e..fccfdb4 100644 --- a/oxweb/youtube.py +++ b/oxweb/youtube.py @@ -21,9 +21,10 @@ def getVideoKey(youtubeId): if response.status >= 300 and response.status < 400: location = response.getheader("location") - return re.match(".*[?&]t=([^&]+)", location).groups()[0] - else: - return False + match = re.match(".*[?&]t=([^&]+)", location) + if match: + return match.groups()[0] + return False def getVideoUrl(youtubeId, format='mp4'): youtubeKey = getVideoKey(youtubeId)