mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-03-09 12:50:23 -05:00
Move _is_jwt_token_expired
back to VrtNUIE
This commit is contained in:
parent
6465be6c2f
commit
d6eaff7b74
2 changed files with 5 additions and 5 deletions
|
@ -69,7 +69,6 @@
|
||||||
int_or_none,
|
int_or_none,
|
||||||
join_nonempty,
|
join_nonempty,
|
||||||
js_to_json,
|
js_to_json,
|
||||||
jwt_decode_hs256,
|
|
||||||
mimetype2ext,
|
mimetype2ext,
|
||||||
netrc_from_content,
|
netrc_from_content,
|
||||||
orderedSet,
|
orderedSet,
|
||||||
|
@ -995,10 +994,6 @@ def _guess_encoding_from_content(content_type, webpage_bytes):
|
||||||
|
|
||||||
return encoding
|
return encoding
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def _is_jwt_token_expired(token):
|
|
||||||
return jwt_decode_hs256(token)['exp'] - time.time() < 300
|
|
||||||
|
|
||||||
def __check_blocked(self, content):
|
def __check_blocked(self, content):
|
||||||
first_block = content[:512]
|
first_block = content[:512]
|
||||||
if ('<title>Access to this site is blocked</title>' in content
|
if ('<title>Access to this site is blocked</title>' in content
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
get_element_by_class,
|
get_element_by_class,
|
||||||
get_element_html_by_class,
|
get_element_html_by_class,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
|
jwt_decode_hs256,
|
||||||
jwt_encode_hs256,
|
jwt_encode_hs256,
|
||||||
make_archive_id,
|
make_archive_id,
|
||||||
merge_dicts,
|
merge_dicts,
|
||||||
|
@ -308,6 +309,10 @@ def _get_video_token_from_cookie(self):
|
||||||
def _get_refresh_token_from_cookie(self):
|
def _get_refresh_token_from_cookie(self):
|
||||||
return try_call(lambda: self._get_cookies('https://www.vrt.be/vrtmax/sso')['vrtnu-site_profile_rt'].value)
|
return try_call(lambda: self._get_cookies('https://www.vrt.be/vrtmax/sso')['vrtnu-site_profile_rt'].value)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _is_jwt_token_expired(token):
|
||||||
|
return jwt_decode_hs256(token)['exp'] - time.time() < 300
|
||||||
|
|
||||||
def _perform_login(self, username, password):
|
def _perform_login(self, username, password):
|
||||||
if self._fetch_refresh_token():
|
if self._fetch_refresh_token():
|
||||||
self.write_debug('Refresh token already present, skipping login')
|
self.write_debug('Refresh token already present, skipping login')
|
||||||
|
|
Loading…
Reference in a new issue