votes and ratings
This commit is contained in:
parent
ca2a42e773
commit
a9c8d43f6b
1 changed files with 7 additions and 3 deletions
|
@ -163,13 +163,17 @@ class IMDb:
|
||||||
if IMDbDict['title'][0] == '"' and IMDbDict['title'][-1] == '"':
|
if IMDbDict['title'][0] == '"' and IMDbDict['title'][-1] == '"':
|
||||||
IMDbDict['title'] = IMDbDict['title'][1:-1]
|
IMDbDict['title'] = IMDbDict['title'][1:-1]
|
||||||
|
|
||||||
#Votes
|
#Rating
|
||||||
m = re.compile('<b>(.*?)/10</b> \(<a href="ratings">(.*?) votes</a>\)', re.IGNORECASE).search(data)
|
m = re.compile('<b>(.*?)/10</b>', re.IGNORECASE).search(data)
|
||||||
if m:
|
if m:
|
||||||
IMDbDict['rating'] = int(float(m.group(1)) * 1000)
|
IMDbDict['rating'] = int(float(m.group(1)) * 1000)
|
||||||
IMDbDict['votes'] = int(m.group(2).replace(',', ''))
|
|
||||||
else:
|
else:
|
||||||
IMDbDict['rating'] = -1
|
IMDbDict['rating'] = -1
|
||||||
|
#Votes
|
||||||
|
m = re.compile('<small>\(<a href="ratings">(.*?) votes</a>\)</small>', re.IGNORECASE).search(data)
|
||||||
|
if m:
|
||||||
|
IMDbDict['votes'] = int(m.group(1).replace(',', ''))
|
||||||
|
else:
|
||||||
IMDbDict['votes'] = -1
|
IMDbDict['votes'] = -1
|
||||||
|
|
||||||
data = data.replace('\n',' ')
|
data = data.replace('\n',' ')
|
||||||
|
|
Loading…
Reference in a new issue