aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2021-12-06 11:54:30 -0500
committerJesús <heckyel@hyperbola.info>2021-12-06 11:54:30 -0500
commit25831c5572c6e1d45bc05a122312516e0d264f8d (patch)
tree0291e32148406ec56cd59518af41d02aa35a9316
parentd76824a4066caf548feab6b8fffed87bfc636f6a (diff)
parent818faa3a86a67a3ec49a0becb1b6022bb618abd0 (diff)
downloadhypervideo-pre-25831c5572c6e1d45bc05a122312516e0d264f8d.tar.lz
hypervideo-pre-25831c5572c6e1d45bc05a122312516e0d264f8d.tar.xz
hypervideo-pre-25831c5572c6e1d45bc05a122312516e0d264f8d.zip
updated from upstream | 06/12/2021 at 11:54
-rw-r--r--yt_dlp/extractor/vimeo.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/yt_dlp/extractor/vimeo.py b/yt_dlp/extractor/vimeo.py
index 27d5c969d..8c3b6af65 100644
--- a/yt_dlp/extractor/vimeo.py
+++ b/yt_dlp/extractor/vimeo.py
@@ -212,6 +212,16 @@ class VimeoBaseInfoExtractor(InfoExtractor):
owner = video_data.get('owner') or {}
video_uploader_url = owner.get('url')
+ duration = int_or_none(video_data.get('duration'))
+ chapter_data = try_get(config, lambda x: x['embed']['chapters']) or []
+ chapters = [{
+ 'title': current_chapter.get('title'),
+ 'start_time': current_chapter.get('timecode'),
+ 'end_time': next_chapter.get('timecode'),
+ } for current_chapter, next_chapter in zip(chapter_data, chapter_data[1:] + [{'timecode': duration}])]
+ if chapters and chapters[0]['start_time']: # Chapters may not start from 0
+ chapters[:0] = [{'title': '<Untitled>', 'start_time': 0, 'end_time': chapters[0]['start_time']}]
+
return {
'id': str_or_none(video_data.get('id')) or video_id,
'title': self._live_title(video_title) if is_live else video_title,
@@ -219,7 +229,8 @@ class VimeoBaseInfoExtractor(InfoExtractor):
'uploader_id': video_uploader_url.split('/')[-1] if video_uploader_url else None,
'uploader_url': video_uploader_url,
'thumbnails': thumbnails,
- 'duration': int_or_none(video_data.get('duration')),
+ 'duration': duration,
+ 'chapters': chapters or None,
'formats': formats,
'subtitles': subtitles,
'is_live': is_live,