aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2017-05-26 22:42:27 +0700
committerSergey M․ <dstftw@gmail.com>2017-05-26 22:42:27 +0700
commit7f4c3a7439a66e522a4cd5d7ef3f0fb19bf155af (patch)
treef6080332da3c1b488ad93adbd68b416b4fa14564 /youtube_dl
parent28dbde9cc3e9921737b7677409fef073ea207363 (diff)
[cbsnews] Fix extraction (closes #13205)
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/extractor/cbsnews.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/youtube_dl/extractor/cbsnews.py b/youtube_dl/extractor/cbsnews.py
index 651ae2665..5b61c3f52 100644
--- a/youtube_dl/extractor/cbsnews.py
+++ b/youtube_dl/extractor/cbsnews.py
@@ -61,11 +61,17 @@ class CBSNewsIE(CBSIE):
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'), video_id)
+ webpage, 'video JSON info', default='{}'), video_id, fatal=False)
- item = video_info['item'] if 'item' in video_info else video_info
- guid = item['mpxRefId']
- return self._extract_video_info(guid, 'cbsnews')
+ if video_info:
+ item = video_info['item'] if 'item' in video_info else video_info
+ else:
+ state = self._parse_json(self._search_regex(
+ r'data-cbsvideoui-options=(["\'])(?P<json>{.+?})\1', webpage,
+ 'playlist JSON info', group='json'), video_id)['state']
+ item = state['playlist'][state['pid']]
+
+ return self._extract_video_info(item['mpxRefId'], 'cbsnews')
class CBSNewsLiveVideoIE(InfoExtractor):