From 0cc7e7157d6046f6aa453acd9dda330b69df0d66 Mon Sep 17 00:00:00 2001 From: John Assael Date: Thu, 21 Jan 2016 19:51:48 +0000 Subject: [PATCH 1/2] added CBS News xml subtitles --- youtube_dl/extractor/cbsnews.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/youtube_dl/extractor/cbsnews.py b/youtube_dl/extractor/cbsnews.py index d211ec23b..dc65656ce 100644 --- a/youtube_dl/extractor/cbsnews.py +++ b/youtube_dl/extractor/cbsnews.py @@ -85,10 +85,21 @@ class CBSNewsIE(InfoExtractor): fmt['ext'] = 'mp4' formats.append(fmt) + cap_url = 'http://www.cbsnews.com/videos/captions/%s.adb_xml' % video_info['mpxRefId'] + + subtitles = { + 'en': [{ + 'url': cap_url, + 'ext': 'xml' + + }], + } + return { 'id': video_id, 'title': title, 'thumbnail': thumbnail, 'duration': duration, 'formats': formats, + 'subtitles': subtitles, } From 10967bc7a3bc2eff2e13d888bac8ef43f6375e35 Mon Sep 17 00:00:00 2001 From: John Assael Date: Thu, 21 Jan 2016 22:44:32 +0000 Subject: [PATCH 2/2] added test function for CBS News subtitles --- youtube_dl/extractor/cbsnews.py | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/youtube_dl/extractor/cbsnews.py b/youtube_dl/extractor/cbsnews.py index dc65656ce..7b9dd67fd 100644 --- a/youtube_dl/extractor/cbsnews.py +++ b/youtube_dl/extractor/cbsnews.py @@ -41,6 +41,21 @@ class CBSNewsIE(InfoExtractor): 'skip_download': True, }, }, + { + 'url': 'http://www.cbsnews.com/videos/mountain-lions-of-l-a/', + 'info_dict': { + 'id': 'Mountain Lions of L.A.', + 'ext': 'flv', + 'title': 'Fort Hood shooting: Army downplays mental illness as cause of attack', + 'thumbnail': 're:^http?://.*\.jpg$', + 'subtitles': 're:^http?://.*\.xml$', + 'duration': 787, + }, + 'params': { + # rtmp download + 'skip_download': True, + }, + }, ] def _real_extract(self, url): @@ -85,15 +100,15 @@ class CBSNewsIE(InfoExtractor): fmt['ext'] = 'mp4' formats.append(fmt) - cap_url = 'http://www.cbsnews.com/videos/captions/%s.adb_xml' % video_info['mpxRefId'] - - subtitles = { - 'en': [{ - 'url': cap_url, - 'ext': 'xml' - - }], - } + if 'mpxRefId' in video_info: + cap_url = 'http://www.cbsnews.com/videos/captions/%s.adb_xml' % video_info['mpxRefId'] + subtitles = { + 'en': [{ + 'url': cap_url, + 'ext': 'xml' + }], } + else: + subtitles = {} return { 'id': video_id,