mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 02:42:30 +00:00
[ceskatelevize] Fetch iframe from nextJS data (#1904)
Closes #1899 Authored by: mkubecek
This commit is contained in:
parent
66f4c04e50
commit
443b21dc4e
@ -12,8 +12,7 @@
|
|||||||
ExtractorError,
|
ExtractorError,
|
||||||
float_or_none,
|
float_or_none,
|
||||||
sanitized_Request,
|
sanitized_Request,
|
||||||
unescapeHTML,
|
traverse_obj,
|
||||||
update_url_query,
|
|
||||||
urlencode_postdata,
|
urlencode_postdata,
|
||||||
USER_AGENTS,
|
USER_AGENTS,
|
||||||
)
|
)
|
||||||
@ -99,11 +98,13 @@ def _real_extract(self, url):
|
|||||||
playlist_description = playlist_description.replace('\xa0', ' ')
|
playlist_description = playlist_description.replace('\xa0', ' ')
|
||||||
|
|
||||||
if parsed_url.path.startswith('/porady/'):
|
if parsed_url.path.startswith('/porady/'):
|
||||||
refer_url = update_url_query(unescapeHTML(self._search_regex(
|
next_data = self._search_nextjs_data(webpage, playlist_id)
|
||||||
(r'<span[^>]*\bdata-url=(["\'])(?P<url>(?:(?!\1).)+)\1',
|
idec = traverse_obj(next_data, ('props', 'pageProps', 'data', ('show', 'mediaMeta'), 'idec'), get_all=False)
|
||||||
r'<iframe[^>]+\bsrc=(["\'])(?P<url>(?:https?:)?//(?:www\.)?ceskatelevize\.cz/ivysilani/embed/iFramePlayer\.php.*?)\1'),
|
if not idec:
|
||||||
webpage, 'iframe player url', group='url')), query={'autoStart': 'true'})
|
raise ExtractorError('Failed to find IDEC id')
|
||||||
webpage = self._download_webpage(refer_url, playlist_id)
|
iframe_hash = self._download_webpage('https://www.ceskatelevize.cz/v-api/iframe-hash/', playlist_id)
|
||||||
|
webpage = self._download_webpage('https://www.ceskatelevize.cz/ivysilani/embed/iFramePlayer.php', playlist_id,
|
||||||
|
query={'hash': iframe_hash, 'origin': 'iVysilani', 'autoStart': 'true', 'IDEC': idec})
|
||||||
|
|
||||||
NOT_AVAILABLE_STRING = 'This content is not available at your territory due to limited copyright.'
|
NOT_AVAILABLE_STRING = 'This content is not available at your territory due to limited copyright.'
|
||||||
if '%s</p>' % NOT_AVAILABLE_STRING in webpage:
|
if '%s</p>' % NOT_AVAILABLE_STRING in webpage:
|
||||||
|
Loading…
Reference in New Issue
Block a user