From 7bcd4813215ac98daa4949af2ffc677c78307a38 Mon Sep 17 00:00:00 2001 From: hoaluvn Date: Wed, 14 Jun 2023 17:52:17 +0200 Subject: [PATCH] [extractor/urplay] Extract all subtitles (#7309) Authored by: hoaluvn --- yt_dlp/extractor/urplay.py | 25 +++++++++++++------------ yt_dlp/utils/_utils.py | 1 + 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/yt_dlp/extractor/urplay.py b/yt_dlp/extractor/urplay.py index 5d69dadd6..7f97fc95f 100644 --- a/yt_dlp/extractor/urplay.py +++ b/yt_dlp/extractor/urplay.py @@ -112,18 +112,19 @@ class URPlayIE(InfoExtractor): lang = ISO639Utils.short2long(lang) return lang or None - for k, v in (urplayer_data['streamingInfo'].get('sweComplete') or {}).items(): - if (k in ('sd', 'hd') or not isinstance(v, dict)): - continue - lang, sttl_url = (v.get(kk) for kk in ('language', 'location', )) - if not sttl_url: - continue - lang = parse_lang_code(lang) - if not lang: - continue - sttl = subtitles.get(lang) or [] - sttl.append({'ext': k, 'url': sttl_url, }) - subtitles[lang] = sttl + for stream in urplayer_data['streamingInfo'].values(): + for k, v in stream.items(): + if (k in ('sd', 'hd') or not isinstance(v, dict)): + continue + lang, sttl_url = (v.get(kk) for kk in ('language', 'location', )) + if not sttl_url: + continue + lang = parse_lang_code(lang) + if not lang: + continue + sttl = subtitles.get(lang) or [] + sttl.append({'ext': k, 'url': sttl_url, }) + subtitles[lang] = sttl image = urplayer_data.get('image') or {} thumbnails = [] diff --git a/yt_dlp/utils/_utils.py b/yt_dlp/utils/_utils.py index 4179d58c1..646210116 100644 --- a/yt_dlp/utils/_utils.py +++ b/yt_dlp/utils/_utils.py @@ -4147,6 +4147,7 @@ class ISO639Utils: 'or': 'ori', 'os': 'oss', 'pa': 'pan', + 'pe': 'per', 'pi': 'pli', 'pl': 'pol', 'ps': 'pus',