- video_info = json.loads(self._html_search_regex(
- r'(?:<ul class="media-list items" id="media-related-items"><li data-video-info|<div id="cbsNewsVideoPlayer" data-video-player-options)=\'({.+?})\'',
- webpage, 'video JSON info'))
-
- item = video_info['item'] if 'item' in video_info else video_info
- title = item.get('articleTitle') or item.get('hed')
- duration = item.get('duration')
- thumbnail = item.get('mediaImage') or item.get('thumbnail')
-
- formats = []
- for format_id in ['RtmpMobileLow', 'RtmpMobileHigh', 'Hls', 'RtmpDesktop']:
- uri = item.get('media' + format_id + 'URI')
- if not uri:
- continue
- uri = remove_start(uri, '{manifest:none}')
- fmt = {
- 'url': uri,
- 'format_id': format_id,
- }
- if uri.startswith('rtmp'):
- play_path = re.sub(
- r'{slistFilePath}', '',
- uri.split('<break>')[-1].split('{break}')[-1])
- play_path = re.sub(
- r'{manifest:.+}.*$', '', play_path)
- fmt.update({
- 'app': 'ondemand?auth=cbs',
- 'play_path': 'mp4:' + play_path,
- 'player_url': 'http://www.cbsnews.com/[[IMPORT]]/vidtech.cbsinteractive.com/player/3_3_0/CBSI_PLAYER_HD.swf',
- 'page_url': 'http://www.cbsnews.com',
- 'ext': 'flv',
- })
- elif uri.endswith('.m3u8'):
- 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'
- }], }
+ video_info = self._parse_json(self._html_search_regex(
+ r'(?:<ul class="media-list items" id="media-related-items"[^>]*><li data-video-info|<div id="cbsNewsVideoPlayer" data-video-player-options)=\'({.+?})\'',
+ webpage, 'video JSON info', default='{}'), video_id, fatal=False)
+
+ if video_info:
+ item = video_info['item'] if 'item' in video_info else video_info