From 825d71efbccf3cbfcf19ae4c3d16bb45c33f6863 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20De=20Boey?= Date: Sun, 6 Apr 2025 09:10:34 +0200 Subject: [PATCH] use `jwt_is_expired` in `CanalSurmas` extractor --- yt_dlp/extractor/canalsurmas.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/yt_dlp/extractor/canalsurmas.py b/yt_dlp/extractor/canalsurmas.py index 210973a0b..8af3be43c 100644 --- a/yt_dlp/extractor/canalsurmas.py +++ b/yt_dlp/extractor/canalsurmas.py @@ -8,7 +8,7 @@ jwt_decode_hs256, parse_iso8601, url_or_none, - variadic, + variadic,jwt_is_expired, ) from ..utils.traversal import traverse_obj @@ -31,12 +31,8 @@ class CanalsurmasIE(InfoExtractor): _API_BASE = 'https://api-rtva.interactvty.com' _access_token = None - @staticmethod - def _is_jwt_expired(token): - return jwt_decode_hs256(token)['exp'] - time.time() < 300 - def _call_api(self, endpoint, video_id, fields=None): - if not self._access_token or self._is_jwt_expired(self._access_token): + if not self._access_token or jwt_is_expired(self._access_token): self._access_token = self._download_json( f'{self._API_BASE}/jwt/token/', None, 'Downloading access token', 'Failed to download access token',