From f71959fcf5f900b742c336bae402261fbbd8e897 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergey=20M=E2=80=A4?= Date: Thu, 8 May 2014 22:07:14 +0700 Subject: [PATCH] [nfb] Add support for videos with captions (#2866) --- youtube_dl/extractor/nfb.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/youtube_dl/extractor/nfb.py b/youtube_dl/extractor/nfb.py index e88566c693..ba7b77a467 100644 --- a/youtube_dl/extractor/nfb.py +++ b/youtube_dl/extractor/nfb.py @@ -73,14 +73,16 @@ def extract_thumbnail(media): 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,