diff options
author | sepro <sepro@sepr0.com> | 2025-04-18 21:09:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-18 21:09:41 +0200 |
commit | 9d26daa04ad5108257bc5e30f7f040c7f1fe7a5a (patch) | |
tree | f1f5e46cd3e252e3ce1121eaa6709e53a111f4cb | |
parent | 73a26f9ee68610e33c0b4407b77355f2ab7afd0e (diff) |
[ie/panopto] Fix formats extraction (#12925)
Closes #11042
Authored by: seproDev
-rw-r--r-- | yt_dlp/extractor/panopto.py | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/yt_dlp/extractor/panopto.py b/yt_dlp/extractor/panopto.py index 91f105519..9f307a53e 100644 --- a/yt_dlp/extractor/panopto.py +++ b/yt_dlp/extractor/panopto.py @@ -14,8 +14,9 @@ from ..utils import ( int_or_none, parse_qs, srt_subtitles_timecode, - traverse_obj, + url_or_none, ) +from ..utils.traversal import traverse_obj class PanoptoBaseIE(InfoExtractor): @@ -345,21 +346,16 @@ class PanoptoIE(PanoptoBaseIE): subtitles = {} for stream in streams or []: stream_formats = [] - http_stream_url = stream.get('StreamHttpUrl') - stream_url = stream.get('StreamUrl') - - if http_stream_url: - stream_formats.append({'url': http_stream_url}) - - if stream_url: + for stream_url in set(traverse_obj(stream, (('StreamHttpUrl', 'StreamUrl'), {url_or_none}))): media_type = stream.get('ViewerMediaFileTypeName') if media_type in ('hls', ): - m3u8_formats, stream_subtitles = self._extract_m3u8_formats_and_subtitles(stream_url, video_id) - stream_formats.extend(m3u8_formats) - subtitles = self._merge_subtitles(subtitles, stream_subtitles) + fmts, subs = self._extract_m3u8_formats_and_subtitles(stream_url, video_id, m3u8_id='hls', fatal=False) + stream_formats.extend(fmts) + self._merge_subtitles(subs, target=subtitles) else: stream_formats.append({ 'url': stream_url, + 'ext': media_type, }) for fmt in stream_formats: fmt.update({ |