fix trivia and external reviews

This commit is contained in:
j 2009-10-23 20:53:48 +02:00
parent 4ae7f6b382
commit 4e38581c51

View file

@ -359,7 +359,8 @@ def getMoviePosters(imdbId):
def getMovieTrivia(imdbId): def getMovieTrivia(imdbId):
url = "%strivia" % getUrlBase(imdbId) url = "%strivia" % getUrlBase(imdbId)
data = readUrlUnicode(url) data = readUrlUnicode(url)
trivia = re.compile('<li>(.*?)</li>').findall(data) data = findRe(data, '<ul class="trivia">(.*?)</ul>')
trivia = re.compile('<li>(.*?)</li>', re.DOTALL).findall(data)
def clean(t): def clean(t):
t = decodeHtml(t) t = decodeHtml(t)
t = t.replace(u'”', '"') t = t.replace(u'”', '"')
@ -390,7 +391,8 @@ def getMovieKeywords(imdbId):
def getMovieExternalReviews(imdbId): def getMovieExternalReviews(imdbId):
url = "%sexternalreviews" % getUrlBase(imdbId) url = "%sexternalreviews" % getUrlBase(imdbId)
data = readUrlUnicode(url) data = readUrlUnicode(url)
_reviews = re.compile('<li><a href="(.*?)".*?>(.*?)</a></li>').findall(data) data = findRe(data, '<ol>(.*?)</ol>')
_reviews = re.compile('<li><a href="(http.*?)".*?>(.*?)</a></li>').findall(data)
reviews = {} reviews = {}
for r in _reviews: for r in _reviews:
reviews[r[0]] = r[1] reviews[r[0]] = r[1]