aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/canvas.py
diff options
context:
space:
mode:
authorRobin Houtevelts <robin@houtevelts.com>2016-02-13 01:12:44 +0100
committerSergey M․ <dstftw@gmail.com>2016-02-15 20:50:03 +0600
commit8d3eeb36d781183d52c093153e7fab6c17427dc7 (patch)
tree94339ef9109fac1c3b4b42556d0101d40900ac0b /youtube_dl/extractor/canvas.py
parent8e0548e180ee960eff6325b65e6cb2b91ee4d336 (diff)
[Canvas] Add subtitles
Diffstat (limited to 'youtube_dl/extractor/canvas.py')
-rw-r--r--youtube_dl/extractor/canvas.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/youtube_dl/extractor/canvas.py b/youtube_dl/extractor/canvas.py
index ee19ff836..16f458d6c 100644
--- a/youtube_dl/extractor/canvas.py
+++ b/youtube_dl/extractor/canvas.py
@@ -53,6 +53,15 @@ 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,
+ }]
return {
'id': video_id,
@@ -62,4 +71,5 @@ class CanvasIE(InfoExtractor):
'formats': formats,
'duration': float_or_none(data.get('duration'), 1000),
'thumbnail': data.get('posterImageUrl'),
+ 'subtitles': subtitles,
}