summaryrefslogtreecommitdiffstats
path: root/yt_dlp/extractor/zaiko.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-05 09:06:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-05 09:06:31 +0000
commitf9eea6bfd334face61277923d7b73655bbb79433 (patch)
treef1411ed71fdf7e8b7973697b402935d1cf378064 /yt_dlp/extractor/zaiko.py
parentAdding upstream version 2024.07.01. (diff)
downloadyt-dlp-upstream/2024.07.02.tar.xz
yt-dlp-upstream/2024.07.02.zip
Adding upstream version 2024.07.02.upstream/2024.07.02
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'yt_dlp/extractor/zaiko.py')
-rw-r--r--yt_dlp/extractor/zaiko.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/yt_dlp/extractor/zaiko.py b/yt_dlp/extractor/zaiko.py
index c8c4ec0..4563b7b 100644
--- a/yt_dlp/extractor/zaiko.py
+++ b/yt_dlp/extractor/zaiko.py
@@ -66,7 +66,9 @@ class ZaikoIE(ZaikoBaseIE):
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 @@ class ZaikoIE(ZaikoBaseIE):
'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 @@ class ZaikoIE(ZaikoBaseIE):
'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)],
}