fix plot, fix dont fail in youtube

This commit is contained in:
j 2008-12-07 15:39:39 +01:00
parent 9cc7b2529d
commit f26f5de666
2 changed files with 6 additions and 5 deletions

View file

@ -257,8 +257,8 @@ def getMovieQuotes(imdbId):
def getMoviePlot(imdbId): def getMoviePlot(imdbId):
url = "%s/plotsummary" % getUrlBase(imdbId) url = "%s/plotsummary" % getUrlBase(imdbId)
data = getUrlUnicode(url) data = getUrlUnicode(url)
plot = findRe(data, '<p class="plotpar">(.*?)<i>') plot = findRe(data, '<p class="plotpar">(.*?)<i>').split('</p>')[0]
return plot return plot.strip()
def getMovieTechnical(imdbId): def getMovieTechnical(imdbId):
url = "%s/technical" % getUrlBase(imdbId) url = "%s/technical" % getUrlBase(imdbId)

View file

@ -21,9 +21,10 @@ def getVideoKey(youtubeId):
if response.status >= 300 and response.status < 400: if response.status >= 300 and response.status < 400:
location = response.getheader("location") location = response.getheader("location")
return re.match(".*[?&]t=([^&]+)", location).groups()[0] match = re.match(".*[?&]t=([^&]+)", location)
else: if match:
return False return match.groups()[0]
return False
def getVideoUrl(youtubeId, format='mp4'): def getVideoUrl(youtubeId, format='mp4'):
youtubeKey = getVideoKey(youtubeId) youtubeKey = getVideoKey(youtubeId)