use only one year parser, more relaxed about user rating

This commit is contained in:
j 2010-01-07 01:08:08 +01:00
parent 80641b5461
commit d3069d43c6

View file

@ -184,6 +184,8 @@ def getMovieInfo(imdbId, timeout=-1):
#Votes
info['votes'] = -1
if "user rating" in info:
if isinstance(info['user rating'], list):
info['user rating'] = ' '.join(info['user rating'])
votes = findRe(info['user rating'], '([\d,]*?) votes')
if votes:
info['votes'] = int(votes.replace(',', ''))
@ -578,22 +580,7 @@ class IMDb:
return parsed_value
def parseYear(self):
year = ''
data = self.getPage()
soup = BeautifulSoup(data)
html_title = soup('div', {'id': 'tn15title'})
if not html_title:
html_title = soup('title')
if html_title:
html_title = unicode(html_title[0])
html_title = stripTags(html_title)
year = re.compile('\((\d{4})\)').findall(html_title)
if not year:
year = re.compile('\((\d{4})/').findall(html_title)
if year:
year = year[0]
else: year = ''
return year
return getMovieYear(self.imdb)
def parse(self):
data = self.getPage()