mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-16 22:28:18 +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)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
subtitles = {}
|
subtitles = {}
|
||||||
for target in data['subtitleUrls']:
|
subtitle_urls = data.get('subtitleUrls')
|
||||||
format_url, format_type = target.get('url'), target.get('type')
|
if isinstance(subtitle_urls, list):
|
||||||
if format_type == 'CLOSED':
|
for subtitle in subtitle_urls:
|
||||||
subtitles['nl'] = [{
|
subtitle_url = subtitle.get('url')
|
||||||
'ext': 'vtt',
|
if subtitle_url and subtitle.get('type') == 'CLOSED':
|
||||||
'url': format_url,
|
subtitles.setdefault('nl', []).append({'url': subtitle_url})
|
||||||
}]
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
Loading…
Reference in New Issue
Block a user