1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-22 16:44:32 +01:00

[archiveorg] Make metadata extraction more robust

This commit is contained in:
TinyToweringTree 2020-02-20 00:02:32 +01:00
parent b98d1c0d5a
commit 1326a5aa38

View File

@ -52,10 +52,13 @@ class ArchiveOrgIE(InfoExtractor):
def get_optional(metadata, field):
return metadata.get(field, [None])[0]
metadata = self._download_json(
json_metadata = self._download_json(
'http://archive.org/details/' + video_id, video_id, query={
'output': 'json',
}).get('metadata', {})
}, fatal=False)
metadata = (json_metadata.get('metadata', {})
if isinstance(json_metadata, dict)
else {})
info.update({
'title': get_optional(metadata, 'title') or info.get('title'),
'description': clean_html(get_optional(metadata, 'description')),