mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-09-22 02:11:26 +02:00
Compare commits
2 Commits
f3f5d080bd
...
bf4fce8cbd
Author | SHA1 | Date | |
---|---|---|---|
|
bf4fce8cbd | ||
|
5b544d8b2a |
|
@ -31,6 +31,7 @@ class LaXarxaMesIE(InfoExtractor):
|
||||||
def _perform_login(self, username, password):
|
def _perform_login(self, username, password):
|
||||||
if self._TOKEN:
|
if self._TOKEN:
|
||||||
return
|
return
|
||||||
|
|
||||||
login = self._download_json(
|
login = self._download_json(
|
||||||
'https://api.laxarxames.cat/Authorization/SignIn', None, note='Logging in', headers={
|
'https://api.laxarxames.cat/Authorization/SignIn', None, note='Logging in', headers={
|
||||||
'X-Tenantorigin': 'https://laxarxames.cat',
|
'X-Tenantorigin': 'https://laxarxames.cat',
|
||||||
|
@ -42,23 +43,23 @@ class LaXarxaMesIE(InfoExtractor):
|
||||||
'PlatformCode': 'WEB',
|
'PlatformCode': 'WEB',
|
||||||
'Name': 'Mac OS ()',
|
'Name': 'Mac OS ()',
|
||||||
},
|
},
|
||||||
}).encode('utf-8'), expected_status=401)
|
}).encode(), expected_status=401)
|
||||||
|
|
||||||
if not traverse_obj(login, ('AuthorizationToken', 'Token', {str})):
|
self._TOKEN = traverse_obj(login, ('AuthorizationToken', 'Token', {str}))
|
||||||
|
if not self._TOKEN:
|
||||||
raise ExtractorError('Login failed', expected=True)
|
raise ExtractorError('Login failed', expected=True)
|
||||||
self._TOKEN = login['AuthorizationToken']['Token']
|
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
|
|
||||||
if not self._TOKEN:
|
if not self._TOKEN:
|
||||||
self.raise_login_required()
|
self.raise_login_required()
|
||||||
|
|
||||||
media_play_info = self._download_json(
|
media_play_info = self._download_json(
|
||||||
'https://api.laxarxames.cat/Media/GetMediaPlayInfo', video_id,
|
'https://api.laxarxames.cat/Media/GetMediaPlayInfo', video_id,
|
||||||
data=json.dumps({
|
data=json.dumps({
|
||||||
'MediaId': int(video_id),
|
'MediaId': int(video_id),
|
||||||
'StreamType': 'MAIN'
|
'StreamType': 'MAIN'
|
||||||
}).encode('utf-8'), headers={
|
}).encode(), headers={
|
||||||
'Authorization': f'Bearer {self._TOKEN}',
|
'Authorization': f'Bearer {self._TOKEN}',
|
||||||
'X-Tenantorigin': 'https://laxarxames.cat',
|
'X-Tenantorigin': 'https://laxarxames.cat',
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
|
@ -66,6 +67,7 @@ class LaXarxaMesIE(InfoExtractor):
|
||||||
|
|
||||||
if not traverse_obj(media_play_info, ('ContentUrl', {str})):
|
if not traverse_obj(media_play_info, ('ContentUrl', {str})):
|
||||||
self.raise_no_formats('No video found', expected=True)
|
self.raise_no_formats('No video found', expected=True)
|
||||||
|
|
||||||
return self.url_result(
|
return self.url_result(
|
||||||
f'https://players.brightcove.net/5779379807001/default_default/index.html?videoId={media_play_info["ContentUrl"]}',
|
f'https://players.brightcove.net/5779379807001/default_default/index.html?videoId={media_play_info["ContentUrl"]}',
|
||||||
BrightcoveNewIE, video_id, media_play_info.get('Title'))
|
BrightcoveNewIE, video_id, media_play_info.get('Title'))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user