[francetv] Add subtitles support
authorFrans de Jonge <fransdejonge@gmail.com>
Mon, 26 Oct 2015 14:11:09 +0000 (15:11 +0100)
committerSergey M․ <dstftw@gmail.com>
Mon, 26 Oct 2015 14:20:15 +0000 (20:20 +0600)
youtube_dl/extractor/francetv.py

index 129984a5fb1ea793d49937dd251d460b509c60c7..eaaa43958bf484d580be2662fe92562b8e152541 100644 (file)
@@ -83,6 +83,16 @@ class FranceTVBaseInfoExtractor(InfoExtractor):
         if subtitle:
             title += ' - %s' % subtitle
 
+        subtitles = {}
+        for subtitle_accessibilite in info['subtitles']:
+            if subtitle_accessibilite['url'] is not '':
+                if not subtitles:
+                    subtitles['fr'] = []
+                subtitles['fr'].append({
+                    'ext': subtitle_accessibilite['format'],
+                    'url': subtitle_accessibilite['url'],
+                })
+
         return {
             'id': video_id,
             'title': title,
@@ -91,6 +101,7 @@ class FranceTVBaseInfoExtractor(InfoExtractor):
             'duration': int_or_none(info.get('real_duration')) or parse_duration(info['duree']),
             'timestamp': int_or_none(info['diffusion']['timestamp']),
             'formats': formats,
+            'subtitles': subtitles,
         }