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:
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):
try:
@ -275,14 +285,6 @@ class Imdb(SiteParser):
're': '<h3 itemprop="name">(.*?)<',
'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>']),
'gross': zebra_table('Cumulative Worldwide Gross', more=[
lambda data: find_re(decode_html(data).replace(',', ''), '\d+')
@ -554,6 +556,11 @@ class Imdb(SiteParser):
if 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:
self['summary'] = self.pop('storyline')
if 'summary' in self: