1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-12-23 00:18:55 +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

@@ -1,5 +1,4 @@
import json
import time
import uuid
from .common import InfoExtractor
@@ -124,10 +123,9 @@ class Zee5IE(InfoExtractor):
else:
raise ExtractorError(self._LOGIN_HINT, expected=True)
token = jwt_decode_hs256(self._USER_TOKEN)
if token.get('exp', 0) <= int(time.time()):
if self._is_jwt_token_expired(self._USER_TOKEN):
raise ExtractorError('User token has expired', expected=True)
self._USER_COUNTRY = token.get('current_country')
self._USER_COUNTRY = jwt_decode_hs256(self._USER_TOKEN).get('current_country')
def _real_extract(self, url):
video_id, display_id = self._match_valid_url(url).group('id', 'display_id')