mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-27 01:33:01 +00:00
[Canvas] Add subtitles
This commit is contained in:
parent
8e0548e180
commit
8d3eeb36d7
1 changed files with 10 additions and 0 deletions
|
@ -54,6 +54,15 @@ def _real_extract(self, url):
|
|||
})
|
||||
self._sort_formats(formats)
|
||||
|
||||
subtitles = {}
|
||||
for target in data['subtitleUrls']:
|
||||
format_url, format_type = target.get('url'), target.get('type')
|
||||
if format_type == 'CLOSED':
|
||||
subtitles['nl'] = [{
|
||||
'ext': 'vtt',
|
||||
'url': format_url,
|
||||
}]
|
||||
|
||||
return {
|
||||
'id': video_id,
|
||||
'display_id': display_id,
|
||||
|
@ -62,4 +71,5 @@ def _real_extract(self, url):
|
|||
'formats': formats,
|
||||
'duration': float_or_none(data.get('duration'), 1000),
|
||||
'thumbnail': data.get('posterImageUrl'),
|
||||
'subtitles': subtitles,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue