mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-15 13:47:48 +01:00
[canvas] Improve subtitles (Closes #8537)
This commit is contained in:
parent
8d3eeb36d7
commit
fd7a3ea4a4
@ -55,13 +55,12 @@ class CanvasIE(InfoExtractor):
|
||||
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,
|
||||
}]
|
||||
subtitle_urls = data.get('subtitleUrls')
|
||||
if isinstance(subtitle_urls, list):
|
||||
for subtitle in subtitle_urls:
|
||||
subtitle_url = subtitle.get('url')
|
||||
if subtitle_url and subtitle.get('type') == 'CLOSED':
|
||||
subtitles.setdefault('nl', []).append({'url': subtitle_url})
|
||||
|
||||
return {
|
||||
'id': video_id,
|
||||
|
Loading…
Reference in New Issue
Block a user