From 4f31126f07cb4b2770945afdda168838354c0d4c Mon Sep 17 00:00:00 2001 From: Michal Kubecek Date: Mon, 10 Apr 2023 16:18:16 +0200 Subject: [PATCH] [ceskatelevize] more robust sidp detection For older style livestreams (all except CT4 Sport and CT24), sidp value cannot be determined from URL; the value used by browsers can be found as showID inside the next_data JSON. --- yt_dlp/extractor/ceskatelevize.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/yt_dlp/extractor/ceskatelevize.py b/yt_dlp/extractor/ceskatelevize.py index 731d01f52..9cd7eecf4 100644 --- a/yt_dlp/extractor/ceskatelevize.py +++ b/yt_dlp/extractor/ceskatelevize.py @@ -113,15 +113,16 @@ def _real_extract(self, url): next_data = self._search_nextjs_data(webpage, playlist_id) if '/zive/' in parsed_url.path: idec = traverse_obj(next_data, ('props', 'pageProps', 'data', 'liveBroadcast', 'current', 'idec'), get_all=False) + sidp = traverse_obj(next_data, ('props', 'pageProps', 'data', 'liveBroadcast', 'current', 'showId'), get_all=False) else: idec = traverse_obj(next_data, ('props', 'pageProps', 'data', ('show', 'mediaMeta'), 'idec'), get_all=False) if not idec: idec = traverse_obj(next_data, ('props', 'pageProps', 'data', 'videobonusDetail', 'bonusId'), get_all=False) if idec: type_ = 'bonus' + sidp = self._search_regex(r'https?://(?:www\.)?ceskatelevize\.cz/(?:ivysilani|porady|zive)/([0-9]+)-', url, playlist_id, default=playlist_id) if not idec: raise ExtractorError('Failed to find IDEC id') - sidp = self._search_regex(r'https?://(?:www\.)?ceskatelevize\.cz/(?:ivysilani|porady|zive)/([0-9]+)-', url, playlist_id, default=playlist_id) sidp = sidp.rsplit('-')[0] query = {'origin': 'iVysilani', 'autoStart': 'true', 'sidp': sidp, type_: idec} webpage = self._download_webpage(