[canvas] Improve subtitles (Closes #8537)
This commit is contained in:
parent
8d3eeb36d7
commit
fd7a3ea4a4
|
@ -53,15 +53,14 @@ class CanvasIE(InfoExtractor):
|
||||||
'url': format_url,
|
'url': format_url,
|
||||||
})
|
})
|
||||||
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