[nfb] Add support for videos with captions (#2866)
authorSergey M․ <dstftw@gmail.com>
Thu, 8 May 2014 15:07:14 +0000 (22:07 +0700)
committerSergey M․ <dstftw@gmail.com>
Thu, 8 May 2014 15:07:14 +0000 (22:07 +0700)
youtube_dl/extractor/nfb.py

index e88566c693c9139ae725604427fb8cd3894e7e3b..ba7b77a467e8e7ba969fb9d4555e47fad6ed7196 100644 (file)
@@ -73,14 +73,16 @@ class NFBIE(InfoExtractor):
                 title = media.find('title').text
                 description = media.find('description').text
                 # It seems assets always go from lower to better quality, so no need to sort
-                formats = [{
-                    'url': x.find('default/streamerURI').text,
-                    'app': x.find('default/streamerURI').text.split('/', 3)[3],
-                    'play_path': x.find('default/url').text,
-                    'rtmp_live': False,
-                    'ext': 'mp4',
-                    'format_id': x.get('quality'),
-                } for x in media.findall('assets/asset')]
+                for asset in media.findall('assets/asset'):
+                    for x in asset:
+                        formats.append({
+                            'url': x.find('streamerURI').text,
+                            'app': x.find('streamerURI').text.split('/', 3)[3],
+                            'play_path': x.find('url').text,
+                            'rtmp_live': False,
+                            'ext': 'mp4',
+                            'format_id': '%s-%s' % (x.tag, asset.get('quality')),
+                        })
 
         return {
             'id': video_id,