diff options
author | Sergey M․ <dstftw@gmail.com> | 2016-02-15 20:54:01 +0600 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2016-02-15 20:54:01 +0600 |
commit | fd7a3ea4a41ccad37c932662d39e159854311357 (patch) | |
tree | 1a015617e3bfa4c3f88eeaa0992c3cba27d32690 /youtube_dl/extractor | |
parent | 8d3eeb36d781183d52c093153e7fab6c17427dc7 (diff) |
[canvas] Improve subtitles (Closes #8537)
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r-- | youtube_dl/extractor/canvas.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/youtube_dl/extractor/canvas.py b/youtube_dl/extractor/canvas.py index 16f458d6c..54b535ae9 100644 --- a/youtube_dl/extractor/canvas.py +++ b/youtube_dl/extractor/canvas.py @@ -53,15 +53,14 @@ class CanvasIE(InfoExtractor): 'url': format_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, - }] + 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, |