1
0
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:
Michaël De Boey
2025-03-06 15:38:53 +01:00
parent e67d786c7c
commit 0242090a86
11 changed files with 20 additions and 53 deletions

View File

@@ -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