Skip to content

A feature-rich command-line audio/video downloader

YoutubeIE: don't crash when trying to get automatic captions if the videos has standard subtitles.

Jaime Marquínez Ferrándiz2f799533ae68
diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py
index 30036524f9..2b03226f60 100644
--- a/youtube_dl/extractor/youtube.py
+++ b/youtube_dl/extractor/youtube.py
@@ -270,7 +270,9 @@ class YoutubeIE(InfoExtractor):
subtitles_url = caption_url + '&' + params
sub = self._download_webpage(subtitles_url, video_id, u'Downloading automatic captions')
return {sub_lang: sub}
- except KeyError:
+ # An extractor error can be raise by the download process if there are
+ # no automatic captions but there are subtitles
+ except (KeyError, ExtractorError):
self._downloader.report_warning(err_msg)
return {}