Compare commits

..

No commits in common. "59036c65670f636d8a84126a09d50ed2cb1766c6" and "f7b8fb8a1c5667a75880141403996a498c917c1c" have entirely different histories.

View File

@ -15,6 +15,8 @@ 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 = [{
@ -84,18 +86,22 @@ class IPrimaIE(InfoExtractor):
if self.access_token: if self.access_token:
return return
token_data = self._download_json( token_request_data = json.dumps({
'https://ucet.iprima.cz/api/session/create', None,
note='Logging in', errnote='Failed to log in',
data=json.dumps({
'email': username, 'email': username,
'password': password, 'password': password,
'deviceName': 'Windows Chrome', 'deviceName': self._DEVICE_ID,
}).encode(), headers={'content-type': 'application/json'}) }).encode()
self.access_token = token_data['accessToken']['value'] token_request_headers = {'content-type': 'application/json'}
if not self.access_token:
raise ExtractorError('Failed to fetch access token') token_data = self._download_json(
f'{self._AUTH_ROOT}/api/session/create', None,
note='Downloading token', errnote='Downloading token failed',
data=token_request_data, headers=token_request_headers)
self.access_token = traverse_obj(token_data, ('accessToken', 'value'))
if self.access_token is None:
raise ExtractorError('Getting token failed', expected=True)
def _real_initialize(self): def _real_initialize(self):
if not self.access_token: if not self.access_token: