Skip to content

Instantly share code, notes, and snippets.

@jegfish
Created August 18, 2020 19:57
Show Gist options
  • Save jegfish/90f605bd55b239215036996e478acfdf to your computer and use it in GitHub Desktop.
Save jegfish/90f605bd55b239215036996e478acfdf to your computer and use it in GitHub Desktop.
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py
index 19370f62b..8dc4547c4 100755
--- a/youtube_dl/YoutubeDL.py
+++ b/youtube_dl/YoutubeDL.py
@@ -1813,6 +1813,7 @@ class YoutubeDL(object):
# that way it will silently go on when used with unsupporting IE
subtitles = info_dict['requested_subtitles']
ie = self.get_info_extractor(info_dict['extractor_key'])
+ failed_sub_langs = []
for sub_lang, sub_info in subtitles.items():
sub_format = sub_info['ext']
sub_filename = subtitles_filename(filename, sub_lang, sub_format, info_dict.get('ext'))
@@ -1838,7 +1839,10 @@ class YoutubeDL(object):
except (ExtractorError, IOError, OSError, ValueError) as err:
self.report_warning('Unable to download subtitle for "%s": %s' %
(sub_lang, error_to_compat_str(err)))
+ failed_sub_langs.append(sub_lang)
continue
+ for sub_lang in failed_sub_langs:
+ del info_dict['requested_subtitles'][sub_lang]
if self.params.get('writeinfojson', False):
infofn = replace_extension(filename, 'info.json', info_dict.get('ext'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment