aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/extractor/common.py
diff options
context:
space:
mode:
authorbashonly <88596187+bashonly@users.noreply.github.com>2023-01-14 13:52:03 -0600
committerGitHub <noreply@github.com>2023-01-14 19:52:03 +0000
commit5ab3534d44231f7711398bc3cfc520e2efd09f50 (patch)
tree2bbc04536a753b6a434504914f92e77f7c1c4abe /yt_dlp/extractor/common.py
parentcb73b8460c3ce6d37ab651a4e44bb23b10056154 (diff)
downloadhypervideo-pre-5ab3534d44231f7711398bc3cfc520e2efd09f50.tar.lz
hypervideo-pre-5ab3534d44231f7711398bc3cfc520e2efd09f50.tar.xz
hypervideo-pre-5ab3534d44231f7711398bc3cfc520e2efd09f50.zip
[extractor/slideslive] Fix slides and chapters/duration (#6024)
* Fix slides/thumbnails extraction * Extract duration to fix issues w/ `--embed-chapters`, `--split-chapters` * Add `InfoExtractor._extract_mpd_vod_duration` method * Expand applicability of `InfoExtractor._parse_m3u8_vod_duration` method Authored by: bashonly
Diffstat (limited to 'yt_dlp/extractor/common.py')
-rw-r--r--yt_dlp/extractor/common.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py
index e37595ffd..f80536470 100644
--- a/yt_dlp/extractor/common.py
+++ b/yt_dlp/extractor/common.py
@@ -2180,13 +2180,23 @@ class InfoExtractor:
return self._parse_m3u8_vod_duration(m3u8_vod or '', video_id)
def _parse_m3u8_vod_duration(self, m3u8_vod, video_id):
- if '#EXT-X-PLAYLIST-TYPE:VOD' not in m3u8_vod:
+ if '#EXT-X-ENDLIST' not in m3u8_vod:
return None
return int(sum(
float(line[len('#EXTINF:'):].split(',')[0])
for line in m3u8_vod.splitlines() if line.startswith('#EXTINF:'))) or None
+ def _extract_mpd_vod_duration(
+ self, mpd_url, video_id, note=None, errnote=None, data=None, headers={}, query={}):
+
+ mpd_doc = self._download_xml(
+ mpd_url, video_id,
+ note='Downloading MPD VOD manifest' if note is None else note,
+ errnote='Failed to download VOD manifest' if errnote is None else errnote,
+ fatal=False, data=data, headers=headers, query=query) or {}
+ return int_or_none(parse_duration(mpd_doc.get('mediaPresentationDuration')))
+
@staticmethod
def _xpath_ns(path, namespace=None):
if not namespace: