From 893abbe9d5c94de32e75e5468cc3e2832be399ed Mon Sep 17 00:00:00 2001 From: j Date: Thu, 2 May 2019 12:48:29 +0200 Subject: [PATCH] fix count parser --- oxdata/movie/imdbids.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/oxdata/movie/imdbids.py b/oxdata/movie/imdbids.py index abf4671..04a27db 100644 --- a/oxdata/movie/imdbids.py +++ b/oxdata/movie/imdbids.py @@ -30,7 +30,7 @@ def read_url(url, timeout): return data 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) return url @@ -54,9 +54,9 @@ def get_film_count(year, month=None, day=None): else: url = get_year(year) data = read_url(url, timeout=TIMEOUT) - total = re.compile('50.*?of (.*?) titles', re.DOTALL).findall(data) + total = re.compile('1-50 of ([\d,]+?) titles.').findall(data) 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: return int(total[0].replace(',', '')) print('no movies', url)