mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
[SVTPlay] Add subtitle support
This commit is contained in:
parent
4c0d13df9b
commit
1f16b958b1
1 changed files with 7 additions and 0 deletions
|
@ -37,6 +37,12 @@ def _extract_video(self, url, video_id):
|
||||||
})
|
})
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
# SVT does not tell us the language, so we assume swedish.
|
||||||
|
subtitles = {}
|
||||||
|
for sr in video_info['subtitleReferences']:
|
||||||
|
if 'url' in sr:
|
||||||
|
subtitles.setdefault('sv', []).append({'url': sr['url']})
|
||||||
|
|
||||||
duration = video_info.get('materialLength')
|
duration = video_info.get('materialLength')
|
||||||
age_limit = 18 if video_info.get('inappropriateForChildren') else 0
|
age_limit = 18 if video_info.get('inappropriateForChildren') else 0
|
||||||
|
|
||||||
|
@ -44,6 +50,7 @@ def _extract_video(self, url, video_id):
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': title,
|
'title': title,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
|
'subtitles': subtitles,
|
||||||
'thumbnail': thumbnail,
|
'thumbnail': thumbnail,
|
||||||
'duration': duration,
|
'duration': duration,
|
||||||
'age_limit': age_limit,
|
'age_limit': age_limit,
|
||||||
|
|
Loading…
Reference in a new issue