mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-01 02:37:29 +01:00
[ie/ZenYandex] Fix extractor (#9813)
Closes #9803 Authored by: src-tinkerer
This commit is contained in:
parent
2338827072
commit
c4b87dd885
@ -259,15 +259,15 @@ def _real_extract(self, url):
|
|||||||
webpage = self._download_webpage(redirect, video_id, note='Redirecting')
|
webpage = self._download_webpage(redirect, video_id, note='Redirecting')
|
||||||
data_json = self._search_json(
|
data_json = self._search_json(
|
||||||
r'("data"\s*:|data\s*=)', webpage, 'metadata', video_id, contains_pattern=r'{["\']_*serverState_*video.+}')
|
r'("data"\s*:|data\s*=)', webpage, 'metadata', video_id, contains_pattern=r'{["\']_*serverState_*video.+}')
|
||||||
serverstate = self._search_regex(r'(_+serverState_+video-site_[^_]+_+)',
|
serverstate = self._search_regex(r'(_+serverState_+video-site_[^_]+_+)', webpage, 'server state')
|
||||||
webpage, 'server state').replace('State', 'Settings')
|
|
||||||
uploader = self._search_regex(r'(<a\s*class=["\']card-channel-link[^"\']+["\'][^>]+>)',
|
uploader = self._search_regex(r'(<a\s*class=["\']card-channel-link[^"\']+["\'][^>]+>)',
|
||||||
webpage, 'uploader', default='<a>')
|
webpage, 'uploader', default='<a>')
|
||||||
uploader_name = extract_attributes(uploader).get('aria-label')
|
uploader_name = extract_attributes(uploader).get('aria-label')
|
||||||
video_json = try_get(data_json, lambda x: x[serverstate]['exportData']['video'], dict)
|
item_id = traverse_obj(data_json, (serverstate, 'videoViewer', 'openedItemId', {str}))
|
||||||
stream_urls = try_get(video_json, lambda x: x['video']['streams'])
|
video_json = traverse_obj(data_json, (serverstate, 'videoViewer', 'items', item_id, {dict})) or {}
|
||||||
|
|
||||||
formats, subtitles = [], {}
|
formats, subtitles = [], {}
|
||||||
for s_url in stream_urls:
|
for s_url in traverse_obj(video_json, ('video', 'streams', ..., {url_or_none})):
|
||||||
ext = determine_ext(s_url)
|
ext = determine_ext(s_url)
|
||||||
if ext == 'mpd':
|
if ext == 'mpd':
|
||||||
fmts, subs = self._extract_mpd_formats_and_subtitles(s_url, video_id, mpd_id='dash')
|
fmts, subs = self._extract_mpd_formats_and_subtitles(s_url, video_id, mpd_id='dash')
|
||||||
|
Loading…
Reference in New Issue
Block a user