mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-12-24 00:49:06 +00:00
refactor: extract common _is_jwt_token_expired to InfoExtractor
This commit is contained in:
@@ -69,6 +69,7 @@ from ..utils import (
|
||||
int_or_none,
|
||||
join_nonempty,
|
||||
js_to_json,
|
||||
jwt_decode_hs256,
|
||||
mimetype2ext,
|
||||
netrc_from_content,
|
||||
orderedSet,
|
||||
@@ -994,6 +995,10 @@ class InfoExtractor:
|
||||
|
||||
return encoding
|
||||
|
||||
@staticmethod
|
||||
def _is_jwt_token_expired(token):
|
||||
return jwt_decode_hs256(token)['exp'] - time.time() < 300
|
||||
|
||||
def __check_blocked(self, content):
|
||||
first_block = content[:512]
|
||||
if ('<title>Access to this site is blocked</title>' in content
|
||||
|
||||
Reference in New Issue
Block a user