mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
[ie/zaiko] Support JWT video URLs (#10130)
Closes #9798 Authored by: pzhlkj6612
This commit is contained in:
parent
7509791385
commit
7799e51895
1 changed files with 12 additions and 6 deletions
|
@ -66,7 +66,9 @@ def _real_extract(self, url):
|
|||
stream_meta['stream-access']['video_source'], video_id,
|
||||
'Downloading player page', headers={'referer': 'https://zaiko.io/'})
|
||||
player_meta = self._parse_vue_element_attr('player', player_page, video_id)
|
||||
status = traverse_obj(player_meta, ('initial_event_info', 'status', {str}))
|
||||
initial_event_info = traverse_obj(player_meta, ('initial_event_info', {dict})) or {}
|
||||
|
||||
status = traverse_obj(initial_event_info, ('status', {str}))
|
||||
live_status, msg, expected = {
|
||||
'vod': ('was_live', 'No VOD stream URL was found', False),
|
||||
'archiving': ('post_live', 'Event VOD is still being processed', True),
|
||||
|
@ -80,14 +82,20 @@ def _real_extract(self, url):
|
|||
'cancelled': ('not_live', 'Event has been cancelled', True),
|
||||
}.get(status) or ('not_live', f'Unknown event status "{status}"', False)
|
||||
|
||||
stream_url = traverse_obj(player_meta, ('initial_event_info', 'endpoint', {url_or_none}))
|
||||
if traverse_obj(initial_event_info, ('is_jwt_protected', {bool})):
|
||||
stream_url = self._download_json(
|
||||
initial_event_info['jwt_token_url'], video_id, 'Downloading JWT-protected stream URL',
|
||||
'Failed to download JWT-protected stream URL')['playback_url']
|
||||
else:
|
||||
stream_url = traverse_obj(initial_event_info, ('endpoint', {url_or_none}))
|
||||
|
||||
formats = self._extract_m3u8_formats(
|
||||
stream_url, video_id, live=True, fatal=False) if stream_url else []
|
||||
if not formats:
|
||||
self.raise_no_formats(msg, expected=expected)
|
||||
|
||||
thumbnail_urls = [
|
||||
traverse_obj(player_meta, ('initial_event_info', 'poster_url')),
|
||||
traverse_obj(initial_event_info, ('poster_url', {url_or_none})),
|
||||
self._og_search_thumbnail(self._download_webpage(
|
||||
f'https://zaiko.io/event/{video_id}', video_id, 'Downloading event page', fatal=False) or ''),
|
||||
]
|
||||
|
@ -103,9 +111,7 @@ def _real_extract(self, url):
|
|||
'release_timestamp': ('stream', 'start', 'timestamp', {int_or_none}),
|
||||
'categories': ('event', 'genres', ..., {lambda x: x or None}),
|
||||
}),
|
||||
**traverse_obj(player_meta, ('initial_event_info', {
|
||||
'alt_title': ('title', {str}),
|
||||
})),
|
||||
'alt_title': traverse_obj(initial_event_info, ('title', {str})),
|
||||
'thumbnails': [{'url': url, 'id': url_basename(url)} for url in thumbnail_urls if url_or_none(url)],
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue