1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-03-15 01:57:16 +08:00

added test function for CBS News subtitles

This commit is contained in:
John Assael 2016-01-21 22:44:32 +00:00
parent 0cc7e7157d
commit 10967bc7a3

View File

@ -41,6 +41,21 @@ class CBSNewsIE(InfoExtractor):
'skip_download': True, '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): def _real_extract(self, url):
@ -85,15 +100,15 @@ class CBSNewsIE(InfoExtractor):
fmt['ext'] = 'mp4' fmt['ext'] = 'mp4'
formats.append(fmt) formats.append(fmt)
cap_url = 'http://www.cbsnews.com/videos/captions/%s.adb_xml' % video_info['mpxRefId'] if 'mpxRefId' in video_info:
cap_url = 'http://www.cbsnews.com/videos/captions/%s.adb_xml' % video_info['mpxRefId']
subtitles = { subtitles = {
'en': [{ 'en': [{
'url': cap_url, 'url': cap_url,
'ext': 'xml' 'ext': 'xml'
}], }
}], else:
} subtitles = {}
return { return {
'id': video_id, 'id': video_id,