mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-04-22 08:39:56 +00:00
Apply suggestions from code review
Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com>
This commit is contained in:
parent
f7b8fb8a1c
commit
64487d6b6d
@ -15,8 +15,6 @@ class IPrimaIE(InfoExtractor):
|
|||||||
_VALID_URL = r'https?://(?!cnn)(?:[^/]+)\.iprima\.cz/(?:[^/]+/)*(?P<id>[^/?#&]+)'
|
_VALID_URL = r'https?://(?!cnn)(?:[^/]+)\.iprima\.cz/(?:[^/]+/)*(?P<id>[^/?#&]+)'
|
||||||
_GEO_BYPASS = False
|
_GEO_BYPASS = False
|
||||||
_NETRC_MACHINE = 'iprima'
|
_NETRC_MACHINE = 'iprima'
|
||||||
_AUTH_ROOT = 'https://ucet.iprima.cz'
|
|
||||||
_DEVICE_ID = 'Windows Chrome'
|
|
||||||
access_token = None
|
access_token = None
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
@ -86,22 +84,18 @@ class IPrimaIE(InfoExtractor):
|
|||||||
if self.access_token:
|
if self.access_token:
|
||||||
return
|
return
|
||||||
|
|
||||||
token_request_data = json.dumps({
|
|
||||||
'email': username,
|
|
||||||
'password': password,
|
|
||||||
'deviceName': self._DEVICE_ID,
|
|
||||||
}).encode()
|
|
||||||
|
|
||||||
token_request_headers = {'content-type': 'application/json'}
|
|
||||||
|
|
||||||
token_data = self._download_json(
|
token_data = self._download_json(
|
||||||
f'{self._AUTH_ROOT}/api/session/create', None,
|
'https://ucet.iprima.cz/api/session/create', None,
|
||||||
note='Downloading token', errnote='Downloading token failed',
|
note='Downloading token', errnote='Downloading token failed',
|
||||||
data=token_request_data, headers=token_request_headers)
|
data=json.dumps({
|
||||||
|
'email': username,
|
||||||
|
'password': password,
|
||||||
|
'deviceName': 'Windows Chrome',
|
||||||
|
}).encode(), headers={'content-type': 'application/json'})
|
||||||
|
|
||||||
self.access_token = traverse_obj(token_data, ('accessToken', 'value'))
|
self.access_token = token_data['accessToken']['value']
|
||||||
if self.access_token is None:
|
if not self.access_token:
|
||||||
raise ExtractorError('Getting token failed', expected=True)
|
raise ExtractorError('Failed to fetch access token')
|
||||||
|
|
||||||
def _real_initialize(self):
|
def _real_initialize(self):
|
||||||
if not self.access_token:
|
if not self.access_token:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user