mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-05-13 16:35:43 -05:00
[extractor/echo360] read in mediaPlayerBootstrapApp json instead of
searching for single elements
This commit is contained in:
parent
a2e9c5ba97
commit
577df3dbf1
1 changed files with 7 additions and 14 deletions
|
@ -108,29 +108,22 @@ def _real_extract(self, url):
|
||||||
host, video_id = self._match_valid_url(url).group('host', 'id')
|
host, video_id = self._match_valid_url(url).group('host', 'id')
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
media_id = self._search_regex(rf'\\"mediaId\\":\\"({Echo360BaseIE._UUID_RE})\\"', webpage, 'media id')
|
player_config = self._parse_json(self._search_regex(
|
||||||
session_id = self._search_regex(rf'\\"sessionId\\":\\"({Echo360BaseIE._UUID_RE})\\"', webpage, 'session id')
|
r'Echo\["mediaPlayerBootstrapApp"\]\("({[^}]*})"\);', webpage, 'player config').replace('\\"', "\""),
|
||||||
|
video_id)
|
||||||
|
|
||||||
share_link_id = self._search_regex(
|
real_video_id = player_config.get('shareLinkId') or player_config.get('publicLinkId')
|
||||||
rf'\\"shareLinkId\\":\\"({Echo360BaseIE._UUID_RE})\\"', webpage,
|
|
||||||
'share link id', default=None, fatal=False)
|
|
||||||
|
|
||||||
public_link_id = self._search_regex(
|
|
||||||
rf'\\"publicLinkId\\":\\"({Echo360BaseIE._UUID_RE})\\"', webpage,
|
|
||||||
'public link id', default=None, fatal=False)
|
|
||||||
|
|
||||||
real_video_id = share_link_id or public_link_id
|
|
||||||
if real_video_id is None:
|
if real_video_id is None:
|
||||||
raise ExtractorError('Video id was not found')
|
raise ExtractorError('Video id was not found')
|
||||||
|
|
||||||
urlh = self._request_webpage(
|
urlh = self._request_webpage(
|
||||||
f'https://{host}/api/ui/sessions/{session_id}',
|
f'https://{host}/api/ui/sessions/{player_config["sessionId"]}',
|
||||||
video_id,
|
video_id,
|
||||||
note='Open video session',
|
note='Open video session',
|
||||||
errnote='Unable to open video session',
|
errnote='Unable to open video session',
|
||||||
)
|
)
|
||||||
session_token = urlh.headers.get('Token')
|
session_token = urlh.headers.get('Token')
|
||||||
if session_token is None:
|
if session_token is None:
|
||||||
raise ExtractorError('Video session could not be opened')
|
raise ExtractorError('No session token received')
|
||||||
|
|
||||||
return self._parse_mediapackage(self._call_api(host, real_video_id, media_id, session_token)['data'])
|
return self._parse_mediapackage(self._call_api(host, real_video_id, player_config['mediaId'], session_token)['data'])
|
||||||
|
|
Loading…
Reference in a new issue