fix filmingLocations

This commit is contained in:
j 2023-07-06 18:44:32 +05:30
parent 16f1c35875
commit 2d5171bb3f

View file

@ -177,6 +177,16 @@ def get_release_date(metadata):
if dates: if dates:
return min(dates) return min(dates)
def get_locations(metadata):
try:
keywords = [
row['cardText']
for row in metadata['props']['pageProps']['contentData']['categories'][0]['section']['items']
]
except:
keywords = []
return keywords
def get_keywords(metadata): def get_keywords(metadata):
try: try:
@ -275,14 +285,6 @@ class Imdb(SiteParser):
're': '<h3 itemprop="name">(.*?)<', 're': '<h3 itemprop="name">(.*?)<',
'type': 'string' 'type': 'string'
}, },
'filmingLocations': {
'page': 'locations',
're': [
'<a href="/search/title\?locations=.*?".*?>(.*?)</a>',
lambda data: data.strip(),
],
'type': 'list'
},
'genre': zebra_list('Genres', more=['<a.*?>(.*?)</a>']), 'genre': zebra_list('Genres', more=['<a.*?>(.*?)</a>']),
'gross': zebra_table('Cumulative Worldwide Gross', more=[ 'gross': zebra_table('Cumulative Worldwide Gross', more=[
lambda data: find_re(decode_html(data).replace(',', ''), '\d+') lambda data: find_re(decode_html(data).replace(',', ''), '\d+')
@ -554,6 +556,11 @@ class Imdb(SiteParser):
if keywords: if keywords:
self['keyword'] = keywords self['keyword'] = keywords
metadata = self.get_page_data('locations')
locations = get_locations(metadata)
if locations:
self['filmingLocations'] = locations
if 'summary' not in self and 'storyline' in self: if 'summary' not in self and 'storyline' in self:
self['summary'] = self.pop('storyline') self['summary'] = self.pop('storyline')
if 'summary' in self: if 'summary' in self: