fix count parser
This commit is contained in:
parent
322213ad57
commit
893abbe9d5
1 changed files with 3 additions and 3 deletions
|
@ -30,7 +30,7 @@ def read_url(url, timeout):
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def get_range(from_, to):
|
def get_range(from_, to):
|
||||||
base_url = 'http://www.imdb.com'
|
base_url = 'https://www.imdb.com'
|
||||||
url = '%s/search/title?adult=include&release_date=%s,%s&sort=release_date,asc&count=50' % (base_url, from_, to)
|
url = '%s/search/title?adult=include&release_date=%s,%s&sort=release_date,asc&count=50' % (base_url, from_, to)
|
||||||
return url
|
return url
|
||||||
|
|
||||||
|
@ -54,9 +54,9 @@ def get_film_count(year, month=None, day=None):
|
||||||
else:
|
else:
|
||||||
url = get_year(year)
|
url = get_year(year)
|
||||||
data = read_url(url, timeout=TIMEOUT)
|
data = read_url(url, timeout=TIMEOUT)
|
||||||
total = re.compile('<span class="lister-current-last-item">50</span>.*?of (.*?) titles', re.DOTALL).findall(data)
|
total = re.compile('<span>1-50 of ([\d,]+?) titles.</span>').findall(data)
|
||||||
if not total:
|
if not total:
|
||||||
total = re.compile(' ([\d+,]+) titles\n', re.DOTALL).findall(data)
|
total = re.compile(' ([\d,]+) titles\n', re.DOTALL).findall(data)
|
||||||
if total:
|
if total:
|
||||||
return int(total[0].replace(',', ''))
|
return int(total[0].replace(',', ''))
|
||||||
print('no movies', url)
|
print('no movies', url)
|
||||||
|
|
Loading…
Reference in a new issue