diff options
author | Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com> | 2015-02-23 21:52:07 +0100 |
---|---|---|
committer | Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com> | 2015-02-23 23:04:07 +0100 |
commit | 25ac63ed71bdc2a82842a593db9a150a0b8b7a6e (patch) | |
tree | bf9e7f0a88419c1fc6764df665e985d8c8e83374 /youtube_dl/extractor/rtve.py | |
parent | 99209c2916753799e9c68e8d466c5253113f25bc (diff) |
[rtve] Extract subtitles
Diffstat (limited to 'youtube_dl/extractor/rtve.py')
-rw-r--r-- | youtube_dl/extractor/rtve.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/youtube_dl/extractor/rtve.py b/youtube_dl/extractor/rtve.py index e60f85b5b..27cd34b7d 100644 --- a/youtube_dl/extractor/rtve.py +++ b/youtube_dl/extractor/rtve.py @@ -102,14 +102,26 @@ class RTVEALaCartaIE(InfoExtractor): video_url = compat_urlparse.urljoin( 'http://mvod1.akcdn.rtve.es/', video_path) + subtitles = None + if info.get('sbtFile') is not None: + subtitles = self.extract_subtitles(video_id, info['sbtFile']) + return { 'id': video_id, 'title': info['title'], 'url': video_url, 'thumbnail': info.get('image'), 'page_url': url, + 'subtitles': subtitles, } + def _get_subtitles(self, video_id, sub_file): + subs = self._download_json( + sub_file + '.json', video_id, + 'Downloading subtitles info')['page']['items'] + return dict((s['lang'], [{'ext': 'vtt', 'url': s['src']}]) + for s in subs) + class RTVELiveIE(InfoExtractor): IE_NAME = 'rtve.es:live' |