use only one year parser, more relaxed about user rating
This commit is contained in:
parent
80641b5461
commit
d3069d43c6
1 changed files with 3 additions and 16 deletions
|
@ -184,6 +184,8 @@ def getMovieInfo(imdbId, timeout=-1):
|
||||||
#Votes
|
#Votes
|
||||||
info['votes'] = -1
|
info['votes'] = -1
|
||||||
if "user rating" in info:
|
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')
|
votes = findRe(info['user rating'], '([\d,]*?) votes')
|
||||||
if votes:
|
if votes:
|
||||||
info['votes'] = int(votes.replace(',', ''))
|
info['votes'] = int(votes.replace(',', ''))
|
||||||
|
@ -578,22 +580,7 @@ class IMDb:
|
||||||
return parsed_value
|
return parsed_value
|
||||||
|
|
||||||
def parseYear(self):
|
def parseYear(self):
|
||||||
year = ''
|
return getMovieYear(self.imdb)
|
||||||
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
|
|
||||||
|
|
||||||
def parse(self):
|
def parse(self):
|
||||||
data = self.getPage()
|
data = self.getPage()
|
||||||
|
|
Loading…
Reference in a new issue