From 3aa915400d895a4a9c3123f1ab9508501f91ba0c Mon Sep 17 00:00:00 2001 From: pukkandan Date: Fri, 18 Feb 2022 17:37:39 +0530 Subject: [PATCH] Fix `-all` for `--sub-langs` Closes #2703 --- yt_dlp/YoutubeDL.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py index 8041b8d15..d85748fc9 100644 --- a/yt_dlp/YoutubeDL.py +++ b/yt_dlp/YoutubeDL.py @@ -2663,12 +2663,15 @@ class YoutubeDL(object): # given in subtitleslangs. See https://github.com/yt-dlp/yt-dlp/issues/1041 requested_langs = [] for lang_re in self.params.get('subtitleslangs'): - if lang_re == 'all': - requested_langs.extend(all_sub_langs) - continue discard = lang_re[0] == '-' if discard: lang_re = lang_re[1:] + if lang_re == 'all': + if discard: + requested_langs = [] + else: + requested_langs.extend(all_sub_langs) + continue current_langs = filter(re.compile(lang_re + '$').match, all_sub_langs) if discard: for lang in current_langs: