fix wikipedia movie parser
This commit is contained in:
parent
5c1ab13749
commit
2abe99c89f
1 changed files with 14 additions and 14 deletions
|
@ -58,21 +58,21 @@ def get_movie_data(wikipedia_url):
|
||||||
key = _key
|
key = _key
|
||||||
if key[0] == '|':
|
if key[0] == '|':
|
||||||
key = key[1:]
|
key = key[1:]
|
||||||
value = d[1].strip()
|
key = key.strip()
|
||||||
value = value.replace('<!-- see WP:ALT -->', '')
|
value = d[1].strip()
|
||||||
if '<br>' in value:
|
value = value.replace('<!-- see WP:ALT -->', '')
|
||||||
value = value.split('<br>')
|
if '<br>' in value:
|
||||||
key = key.strip()
|
value = value.split('<br>')
|
||||||
if value:
|
if value:
|
||||||
if key in filmbox:
|
if key in filmbox:
|
||||||
if isinstance(value, list) and isinstance(filmbox[key], basestring):
|
if isinstance(value, list) and isinstance(filmbox[key], basestring):
|
||||||
filmbox[key] = [filmbox[key]] + value
|
filmbox[key] = [filmbox[key]] + value
|
||||||
|
else:
|
||||||
|
filmbox[key] += value
|
||||||
|
if isinstance(filmbox[key], list):
|
||||||
|
filmbox[key] = [k for k in filmbox[key] if k]
|
||||||
else:
|
else:
|
||||||
filmbox[key] += value
|
filmbox[key] = value
|
||||||
if isinstance(filmbox[key], list):
|
|
||||||
filmbox[key] = [k for k in filmbox[key] if k]
|
|
||||||
else:
|
|
||||||
filmbox[key] = value
|
|
||||||
if not filmbox_data:
|
if not filmbox_data:
|
||||||
return filmbox
|
return filmbox
|
||||||
if 'amg_id' in filmbox and not filmbox['amg_id'].isdigit():
|
if 'amg_id' in filmbox and not filmbox['amg_id'].isdigit():
|
||||||
|
|
Loading…
Reference in a new issue