From 1326a5aa38b5331cb899a47e8c18f05b82d31bc7 Mon Sep 17 00:00:00 2001 From: TinyToweringTree <54483833+TinyToweringTree@users.noreply.github.com> Date: Thu, 20 Feb 2020 00:02:32 +0100 Subject: [PATCH] [archiveorg] Make metadata extraction more robust --- youtube_dl/extractor/archiveorg.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/archiveorg.py b/youtube_dl/extractor/archiveorg.py index 80ad653b1..21dfe850d 100644 --- a/youtube_dl/extractor/archiveorg.py +++ b/youtube_dl/extractor/archiveorg.py @@ -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')),