From 8d3eeb36d781183d52c093153e7fab6c17427dc7 Mon Sep 17 00:00:00 2001 From: Robin Houtevelts Date: Sat, 13 Feb 2016 01:12:44 +0100 Subject: [PATCH] [Canvas] Add subtitles --- youtube_dl/extractor/canvas.py | 10 ++++++++++ 1 file changed, 10 insertions(+) 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, } -- 2.39.5