_HEADERS = {
'origin': 'https://www.tennistv.com',
'referer': 'https://www.tennistv.com/',
- 'content-Type': 'application/x-www-form-urlencoded'
+ 'content-Type': 'application/x-www-form-urlencoded',
}
def _perform_login(self, username, password):
'redirect_uri': 'https://tennistv.com',
'response_mode': 'fragment',
'response_type': 'code',
- 'scope': 'openid'
+ 'scope': 'openid',
})
post_url = self._html_search_regex(r'action=["\']([^"\']+?)["\']\s+method=["\']post["\']', login_page, 'login POST url')
headers=self._HEADERS, data=urlencode_postdata({
'username': username,
'password': password,
- 'submitAction': 'Log In'
+ 'submitAction': 'Log In',
}))
if 'Your username or password was incorrect' in temp_page:
raise ExtractorError('Your username or password was incorrect', expected=True)
'response_type': 'code',
'scope': 'openid',
'nonce': random_uuidv4(),
- 'prompt': 'none'
+ 'prompt': 'none',
})
self.get_token(None, {
- 'code': urllib.parse.parse_qs(handle.geturl())['code'][-1],
+ 'code': urllib.parse.parse_qs(handle.url)['code'][-1],
'grant_type': 'authorization_code',
'client_id': 'tennis-tv-web',
- 'redirect_uri': 'https://www.tennistv.com/resources/v1.1.10/html/silent-check-sso.html'
+ 'redirect_uri': 'https://www.tennistv.com/resources/v1.1.10/html/silent-check-sso.html',
})
def get_token(self, video_id, payload):
self.raise_login_required()
self.access_token, self.refresh_token = cookies['access_token'].value, cookies['refresh_token'].value
- def _download_session_json(self, video_id, entryid,):
+ def _download_session_json(self, video_id, entryid):
return self._download_json(
f'https://atppayments.streamamg.com/api/v1/session/ksession/?lang=en&apijwttoken={self.access_token}&entryId={entryid}',
video_id, 'Downloading ksession token', 'Failed to download ksession token', headers=self._HEADERS)
self.get_token(video_id, {
'grant_type': 'refresh_token',
'refresh_token': self.refresh_token,
- 'client_id': 'tennis-tv-web'
+ 'client_id': 'tennis-tv-web',
})
k_session = self._download_session_json(video_id, entryid).get('KSession')
if k_session is None: