[funimation] Fix promotional videos extraction
authorSergey M․ <dstftw@gmail.com>
Fri, 11 Dec 2015 18:48:09 +0000 (00:48 +0600)
committerSergey M․ <dstftw@gmail.com>
Fri, 11 Dec 2015 18:48:09 +0000 (00:48 +0600)
youtube_dl/extractor/funimation.py

index 0b427961251320f199c9e73cc7433dfd847d654b..5322e4e93df00cdcff0e87f07562e166b512d383 100644 (file)
@@ -96,12 +96,13 @@ class FunimationIE(InfoExtractor):
             webpage = self._download_webpage(
                 request, display_id, 'Downloading %s webpage' % kind)
 
-            items = self._parse_json(
+            playlist = self._parse_json(
                 self._search_regex(
                     r'var\s+playersData\s*=\s*(\[.+?\]);\n',
                     webpage, 'players data'),
-                display_id)[0]['playlist'][0]['items']
+                display_id)[0]['playlist']
 
+            items = next(item['items'] for item in playlist if item.get('items'))
             item = next(item for item in items if item.get('itemAK') == display_id)
 
             error_messages = {}