summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohn Assael <iassael@gmail.com>2016-01-21 19:51:48 +0000
committerSergey M․ <dstftw@gmail.com>2016-01-22 22:15:51 +0600
commit4118cc02c1694a7fd355b75c806a69d75b3850bb (patch)
tree828bce50eda65c4d2f16b957d465d959a716ccdd
parent32d77eeb04657529b118159db4d23fd671fe04c7 (diff)
downloadyoutube-dl-4118cc02c1694a7fd355b75c806a69d75b3850bb.tar.gz
youtube-dl-4118cc02c1694a7fd355b75c806a69d75b3850bb.tar.xz
youtube-dl-4118cc02c1694a7fd355b75c806a69d75b3850bb.zip
[cbsnews] Extract subtitles
added test function for CBS News subtitles
-rw-r--r--youtube_dl/extractor/cbsnews.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/youtube_dl/extractor/cbsnews.py b/youtube_dl/extractor/cbsnews.py
index d211ec23b..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,10 +100,21 @@ class CBSNewsIE(InfoExtractor):
                 fmt['ext'] = 'mp4'
             formats.append(fmt)
 
+        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,
             'title': title,
             'thumbnail': thumbnail,
             'duration': duration,
             'formats': formats,
+            'subtitles': subtitles,
         }