]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[dramafever] Improve subtitles extraction (Closes #8136)
authorSergey M․ <dstftw@gmail.com>
Mon, 4 Jan 2016 19:11:07 +0000 (01:11 +0600)
committerSergey M․ <dstftw@gmail.com>
Mon, 4 Jan 2016 19:11:07 +0000 (01:11 +0600)
youtube_dl/extractor/dramafever.py

index b3b21d65f4c164b5a0e679e6bf6b1dfa33bcb80b..0e9e6f7bac7ca60211af3488c5206e85b852013c 100644 (file)
@@ -105,13 +105,16 @@ class DramaFeverIE(DramaFeverBaseIE):
             video_id, 'Downloading episode info JSON', fatal=False)
         if episode_info:
             value = episode_info.get('value')
-            if value:
-                subfile = value[0].get('subfile') or value[0].get('new_subfile')
-                if subfile and subfile != 'http://www.dramafever.com/st/':
-                    info.setdefault('subtitles', {}).setdefault('English', []).append({
-                        'ext': 'srt',
-                        'url': subfile,
-                    })
+            if isinstance(value, list):
+                for v in value:
+                    if v.get('type') == 'Episode':
+                        subfile = v.get('subfile') or v.get('new_subfile')
+                        if subfile and subfile != 'http://www.dramafever.com/st/':
+                            info.setdefault('subtitles', {}).setdefault('English', []).append({
+                                'ext': 'srt',
+                                'url': subfile,
+                            })
+                        break
 
         return info