From a03cd32b71d5925d06e2ac3b36f266ccc812c810 Mon Sep 17 00:00:00 2001 From: Michal Kubecek Date: Mon, 3 Apr 2023 00:01:50 +0200 Subject: [PATCH] [ceskatelevize] update to March 2023 changes (#6539) Note: we could even skip downloading the player.ceskatelevize.cz page completely as we do not actually need it to get the information we used to need before the recent website changes. However, we would not catch the errors that are handled here and the resulting output could be quite confusing if one of them does happen. --- yt_dlp/extractor/ceskatelevize.py | 34 ++++++------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/yt_dlp/extractor/ceskatelevize.py b/yt_dlp/extractor/ceskatelevize.py index 156b6a324..9a0260f6d 100644 --- a/yt_dlp/extractor/ceskatelevize.py +++ b/yt_dlp/extractor/ceskatelevize.py @@ -119,12 +119,10 @@ def _real_extract(self, url): type_ = 'bonus' if not idec: raise ExtractorError('Failed to find IDEC id') - iframe_hash = self._download_webpage( - 'https://www.ceskatelevize.cz/v-api/iframe-hash/', - playlist_id, note='Getting IFRAME hash') - query = {'hash': iframe_hash, 'origin': 'iVysilani', 'autoStart': 'true', type_: idec, } + sidp = playlist_id.rsplit('-')[0] + query = {'origin': 'iVysilani', 'autoStart': 'true', 'sidp': sidp, type_: idec, } webpage = self._download_webpage( - 'https://www.ceskatelevize.cz/ivysilani/embed/iFramePlayer.php', + 'https://player.ceskatelevize.cz/', playlist_id, note='Downloading player', query=query) NOT_AVAILABLE_STRING = 'This content is not available at your territory due to limited copyright.' @@ -133,29 +131,9 @@ def _real_extract(self, url): if any(not_found in webpage for not_found in ('Neplatný parametr pro videopřehrávač', 'IDEC nebyl nalezen', )): raise ExtractorError('no video with IDEC available', video_id=idec, expected=True) - type_ = None - episode_id = None - - playlist = self._parse_json( - self._search_regex( - r'getPlaylistUrl\(\[({.+?})\]', webpage, 'playlist', - default='{}'), playlist_id) - if playlist: - type_ = playlist.get('type') - episode_id = playlist.get('id') - - if not type_: - type_ = self._html_search_regex( - r'getPlaylistUrl\(\[\{"type":"(.+?)","id":".+?"\}\],', - webpage, 'type') - if not episode_id: - episode_id = self._html_search_regex( - r'getPlaylistUrl\(\[\{"type":".+?","id":"(.+?)"\}\],', - webpage, 'episode_id') - data = { - 'playlist[0][type]': type_, - 'playlist[0][id]': episode_id, + 'playlist[0][type]': 'episode', + 'playlist[0][id]': idec, 'requestUrl': parsed_url.path, 'requestSource': 'iVysilani', } @@ -231,7 +209,7 @@ def _real_extract(self, url): if item.get('type') == 'VOD': subs = item.get('subtitles') if subs: - subtitles = self.extract_subtitles(episode_id, subs) + subtitles = self.extract_subtitles(idec, subs) if playlist_len == 1: final_title = playlist_title or title