mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 01:31:25 +01:00
Compare commits
No commits in common. "263303c5e3f73e18195ecc7ab6e2c1c133fbc88b" and "ca727e78ade8d21c87da9c780da901bdae8e8ca6" have entirely different histories.
263303c5e3
...
ca727e78ad
|
@ -1,7 +1,10 @@
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from .brightcove import BrightcoveNewIE
|
from ._extractors import BrightcoveNewIE
|
||||||
|
|
||||||
from ..utils import ExtractorError, traverse_obj
|
from ..utils import (
|
||||||
|
ExtractorError,
|
||||||
|
traverse_obj,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class News9IE(InfoExtractor):
|
class News9IE(InfoExtractor):
|
||||||
|
@ -56,11 +59,17 @@ class News9IE(InfoExtractor):
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
article_id = self._match_id(url)
|
article_id = self._match_id(url)
|
||||||
webpage = self._download_webpage(url, article_id)
|
webpage = self._download_webpage(url, article_id)
|
||||||
initial_state = self._search_json(r'var\s+__INITIAL_STATE__\s*=', webpage, 'initial state', article_id)
|
initial_state = self._search_json(r'var\s__INITIAL_STATE__\s*=', webpage, 'initial state', article_id)
|
||||||
video_id = traverse_obj(
|
|
||||||
initial_state, ('videoIndex', 'currentVideo', 'brightcoveId'),
|
info = traverse_obj(initial_state, {
|
||||||
('article', ..., 'media', lambda _, v: v['type'] == 'video', 'urn'), get_all=False)
|
'video_id': ('videoIndex', 'currentVideo', 'brightcoveId'),
|
||||||
account = traverse_obj(initial_state, ('videoIndex', 'config', (None, 'video'), 'account'), get_all=False)
|
'account': ('videoIndex', 'config', 'account'),
|
||||||
|
}) or traverse_obj(initial_state, {
|
||||||
|
'video_id': ('article', ..., 'media', lambda _, v: v['type'] == 'video', 'urn'),
|
||||||
|
'account': ('videoIndex', 'config', 'video', 'account')}, get_all=False)
|
||||||
|
|
||||||
|
video_id = info.get('video_id')
|
||||||
|
account = info.get('account')
|
||||||
|
|
||||||
if not video_id or not account:
|
if not video_id or not account:
|
||||||
raise ExtractorError('Unable to get the required video data')
|
raise ExtractorError('Unable to get the required video data')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user