mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-08-28 23:02:18 +03:00
refactor: extract common _is_jwt_token_expired to InfoExtractor
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import time
|
||||
|
||||
from .common import InfoExtractor
|
||||
from ..networking.exceptions import HTTPError
|
||||
from ..utils import (
|
||||
@@ -84,16 +82,14 @@ class DigitalConcertHallIE(InfoExtractor):
|
||||
'User-Agent': _USER_AGENT,
|
||||
}
|
||||
_access_token = None
|
||||
_access_token_expiry = 0
|
||||
_refresh_token = None
|
||||
|
||||
@property
|
||||
def _access_token_is_expired(self):
|
||||
return self._access_token_expiry - 30 <= int(time.time())
|
||||
return self._is_jwt_token_expired(self._access_token)
|
||||
|
||||
def _set_access_token(self, value):
|
||||
self._access_token = value
|
||||
self._access_token_expiry = traverse_obj(value, ({jwt_decode_hs256}, 'exp', {int})) or 0
|
||||
|
||||
def _cache_tokens(self, /):
|
||||
self.cache.store(self._NETRC_MACHINE, 'tokens', {
|
||||
|
||||
Reference in New Issue
Block a user