1
0
Fork 0

[extractor,cleanup] Use _search_nextjs_data

This commit is contained in:
pukkandan 2022-01-20 03:25:15 +05:30
commit 135dfa2c7e
No known key found for this signature in database
GPG key ID: 0F00D95A001F4698
8 changed files with 12 additions and 26 deletions

View file

@ -408,9 +408,7 @@ class NBCNewsIE(ThePlatformIE):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
data = self._parse_json(self._search_regex(
r'<script[^>]+id="__NEXT_DATA__"[^>]*>({.+?})</script>',
webpage, 'bootstrap json'), video_id)['props']['initialState']
data = self._search_nextjs_data(webpage, video_id)['props']['initialState']
video_data = try_get(data, lambda x: x['video']['current'], dict)
if not video_data:
video_data = data['article']['content'][0]['primaryMedia']['video']