diff options
author | Felix S <felix.von.s@posteo.de> | 2021-10-02 18:43:42 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-03 00:13:42 +0530 |
commit | 9359f3d4f02856128f5626e754c7f64e2232b02f (patch) | |
tree | 601dd118dfa2c5b8226086bf5f303656986dc735 /yt_dlp/extractor/common.py | |
parent | 0eaec13ba6abe18d6ddf35f2ebffdcaf3937e485 (diff) | |
download | hypervideo-pre-9359f3d4f02856128f5626e754c7f64e2232b02f.tar.lz hypervideo-pre-9359f3d4f02856128f5626e754c7f64e2232b02f.tar.xz hypervideo-pre-9359f3d4f02856128f5626e754c7f64e2232b02f.zip |
[extractor] Extract storyboards from SMIL manifests (#1128)
Authored by: fstirlitz
Diffstat (limited to 'yt_dlp/extractor/common.py')
-rw-r--r-- | yt_dlp/extractor/common.py | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py index 5da29dc63..f65a098d7 100644 --- a/yt_dlp/extractor/common.py +++ b/yt_dlp/extractor/common.py @@ -2346,14 +2346,15 @@ class InfoExtractor(object): rtmp_count = 0 http_count = 0 m3u8_count = 0 + imgs_count = 0 - srcs = [] + srcs = set() media = smil.findall(self._xpath_ns('.//video', namespace)) + smil.findall(self._xpath_ns('.//audio', namespace)) for medium in media: src = medium.get('src') if not src or src in srcs: continue - srcs.append(src) + srcs.add(src) bitrate = float_or_none(medium.get('system-bitrate') or medium.get('systemBitrate'), 1000) filesize = int_or_none(medium.get('size') or medium.get('fileSize')) @@ -2427,6 +2428,24 @@ class InfoExtractor(object): 'height': height, }) + for medium in smil.findall(self._xpath_ns('.//imagestream', namespace)): + src = medium.get('src') + if not src or src in srcs: + continue + srcs.add(src) + + imgs_count += 1 + formats.append({ + 'format_id': 'imagestream-%d' % (imgs_count), + 'url': src, + 'ext': mimetype2ext(medium.get('type')), + 'acodec': 'none', + 'vcodec': 'none', + 'width': int_or_none(medium.get('width')), + 'height': int_or_none(medium.get('height')), + 'format_note': 'SMIL storyboards', + }) + return formats def _parse_smil_subtitles(self, smil, namespace=None, subtitles_lang='en'): |