]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[francetv] Make subtitles more robust (Closes #7298)
authorSergey M․ <dstftw@gmail.com>
Mon, 26 Oct 2015 14:35:28 +0000 (20:35 +0600)
committerSergey M․ <dstftw@gmail.com>
Mon, 26 Oct 2015 14:35:28 +0000 (20:35 +0600)
youtube_dl/extractor/francetv.py

index eaaa43958bf484d580be2662fe92562b8e152541..07115b9d456121c95b982f70f77922fcaa4e048a 100644 (file)
@@ -84,14 +84,12 @@ class FranceTVBaseInfoExtractor(InfoExtractor):
             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'],
-                })
+        subtitles_list = [{
+            'url': subtitle['url'],
+            'ext': subtitle.get('format'),
+        } for subtitle in info.get('subtitles', []) if subtitle.get('url')]
+        if subtitles_list:
+            subtitles['fr'] = subtitles_list
 
         return {
             'id': video_id,