(.*?)<(br|/div)',
lambda data: data[0]
],
'type': 'list',
@@ -382,7 +382,7 @@ class Imdb(SiteParser):
'votes': {
'page': 'reference',
're': [
- 'class="ipl-rating-star__total-votes">\((.*?)\)',
+ r'class="ipl-rating-star__total-votes">\((.*?)\)',
lambda r: r.replace(',', '')
],
'type': 'string'
@@ -391,8 +391,8 @@ class Imdb(SiteParser):
'year': {
'page': 'reference',
're': [
- '
(.*?)',
- '
(\d+)',
+ r'(.*?)',
+ r'(\d+)',
],
'type': 'int'
},
@@ -400,7 +400,7 @@ class Imdb(SiteParser):
'page': 'fullcredits',
're': [
lambda data: data.split('(.*?)
.*?()',
+ r'>(.*?).*?()',
lambda data: [d for d in data if d]
],
'type': 'list'
@@ -468,7 +468,7 @@ class Imdb(SiteParser):
title = title[1:-1]
if title.startswith("'") and title.endswith("'"):
title = title[1:-1]
- title = re.sub('\(\#[.\d]+\)', '', title)
+ title = re.sub(r'\(\#[.\d]+\)', '', title)
return title.strip()
for t in ('title', 'originalTitle'):
@@ -518,7 +518,7 @@ class Imdb(SiteParser):
self['actor'] = [c[0] for c in self['cast']]
def cleanup_character(c):
c = c.replace('(uncredited)', '').strip()
- c = re.sub('\s+', ' ', c)
+ c = re.sub(r'\s+', ' ', c)
return c
self['cast'] = [{'actor': x[0], 'character': cleanup_character(x[1])}
for x in self['cast']]
@@ -528,7 +528,7 @@ class Imdb(SiteParser):
del self['isSeries']
self['isSeries'] = True
if 'episodeTitle' in self:
- self['episodeTitle'] = re.sub('Episode \#\d+\.\d+', '', self['episodeTitle'])
+ self['episodeTitle'] = re.sub(r'Episode \#\d+\.\d+', '', self['episodeTitle'])
#make lists unique but keep order
@@ -790,7 +790,7 @@ def get_movie_by_title(title, timeout=-1):
url = "http://www.imdb.com/find?" + params
data = read_url(url, timeout=timeout, unicode=True)
#if search results in redirect, get id of current page
- r = ''
+ r = r''
results = re.compile(r).findall(data)
if results:
return results[0]
@@ -869,12 +869,12 @@ def get_movie_id(title, director='', year='', timeout=-1):
data = read_url(url, timeout=timeout, unicode=True)
#if search results in redirect, get id of current page
- r = ''
+ r = r''
results = re.compile(r).findall(data)
if results:
return results[0]
#otherwise get first result
- r = '.*?.*?.*?S(\d+), Ep(\d+)<\/div>\n<\/div>', re.DOTALL).findall(data):
+ for e in re.compile(r' .*? S(\d+), Ep(\d+)<\/div>\n<\/div>', re.DOTALL).findall(data):
episodes['S%02dE%02d' % (int(e[1]), int(e[2]))] = e[0]
else:
data = cache.read_url(url)
- match = re.compile('Season (\d+)').findall(data)
+ match = re.compile(r'Season (\d+)').findall(data)
if match:
for season in range(1, int(match[0]) + 1):
episodes.update(get_episodes(imdbId, season))
@@ -927,7 +927,7 @@ def max_votes():
data = cache.read_url(url).decode('utf-8', 'ignore')
votes = max([
int(v.replace(',', ''))
- for v in re.compile('Votes.*?([\d,]+)', re.DOTALL).findall(data)
+ for v in re.compile(r'Votes.*?([\d,]+)', re.DOTALL).findall(data)
])
return votes
|