mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-12-22 16:08:58 +00:00
refactor: extract common _is_jwt_token_expired to InfoExtractor
This commit is contained in:
@@ -13,7 +13,6 @@ from ..utils import (
|
||||
get_element_by_class,
|
||||
get_element_html_by_class,
|
||||
int_or_none,
|
||||
jwt_decode_hs256,
|
||||
jwt_encode_hs256,
|
||||
make_archive_id,
|
||||
merge_dicts,
|
||||
@@ -316,10 +315,6 @@ class VrtNUIE(VRTBaseIE):
|
||||
# Refresh token cookie is scoped to /vrtmax/sso, others are scoped to /
|
||||
return try_call(lambda: self._get_cookies('https://www.vrt.be/vrtmax/sso')[cookie_name].value)
|
||||
|
||||
@staticmethod
|
||||
def _is_jwt_token_expired(token):
|
||||
return jwt_decode_hs256(token)['exp'] - time.time() < 300
|
||||
|
||||
def _perform_login(self, username, password):
|
||||
refresh_token = self._get_vrt_cookie(self._REFRESH_TOKEN_COOKIE_NAME)
|
||||
if refresh_token and not self._is_jwt_token_expired(refresh_token):
|
||||
|
||||
Reference in New Issue
Block a user