aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRemita Amine <remitamine@gmail.com>2018-11-28 20:13:36 +0100
committerRemita Amine <remitamine@gmail.com>2018-11-28 20:13:36 +0100
commitd9df8f120b325766181fb474a8c534e51df78f17 (patch)
tree91ac96faad77a617feb5e23aef527bbd167b6774
parentca01d178844129bd4b6ed74740fbd30e7f84c1c2 (diff)
[vimeo] extract VHX subtitles
-rw-r--r--youtube_dl/extractor/vimeo.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/youtube_dl/extractor/vimeo.py b/youtube_dl/extractor/vimeo.py
index 6353c6831..5e15f060b 100644
--- a/youtube_dl/extractor/vimeo.py
+++ b/youtube_dl/extractor/vimeo.py
@@ -1127,6 +1127,17 @@ class VHXEmbedIE(InfoExtractor):
video_data = self._call_api(video_id, access_token)
title = video_data.get('title') or video_data['name']
+ subtitles = {}
+ for subtitle in try_get(video_data, lambda x: x['tracks']['subtitles'], list) or []:
+ lang = subtitle.get('srclang') or subtitle.get('label')
+ for _link in subtitle.get('_links', {}).values():
+ href = _link.get('href')
+ if not href:
+ continue
+ subtitles.setdefault(lang, []).append({
+ 'url': href,
+ })
+
q = qualities(['small', 'medium', 'large', 'source'])
thumbnails = []
for thumbnail_id, thumbnail_url in video_data.get('thumbnail', {}).items():
@@ -1142,6 +1153,7 @@ class VHXEmbedIE(InfoExtractor):
'description': video_data.get('description'),
'duration': int_or_none(try_get(video_data, lambda x: x['duration']['seconds'])),
'formats': formats,
+ 'subtitles': subtitles,
'thumbnails': thumbnails,
'timestamp': unified_timestamp(video_data.get('created_at')),
'view_count': int_or_none(video_data.get('plays_count')),