max votes

This commit is contained in:
j 2016-09-07 14:44:42 +02:00
parent f191e766ae
commit a7fe2e2f96
2 changed files with 5 additions and 3 deletions

View file

@ -8,7 +8,7 @@ from ox.cache import read_url
from ox.html import strip_tags, decode_html
from ox.text import find_re
import imdb
from . import imdb
def get_id(url):
return url.split("/")[-1]

View file

@ -803,8 +803,10 @@ def get_episodes(imdbId, season=None):
def max_votes():
url = 'http://www.imdb.com/search/title?num_votes=500000,&sort=num_votes,desc'
data = cache.read_url(url)
votes = max([int(v.replace(',', ''))
for v in re.compile('<td class="sort_col">([\d,]+)</td>').findall(data)])
votes = max([
int(v.replace(',', ''))
for v in re.compile('<span name="nv" data-value="(\d+)"').findall(data)
])
return votes
def guess(title, director='', timeout=-1):