From fca99e1433cdd0f225e9bec92883c216dd7afd99 Mon Sep 17 00:00:00 2001 From: bashonly Date: Sun, 17 Nov 2024 12:39:54 -0600 Subject: [PATCH] Fix token caching Authored by: bashonly --- yt_dlp/extractor/shouttv.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yt_dlp/extractor/shouttv.py b/yt_dlp/extractor/shouttv.py index 498074c7a..fc5924e28 100644 --- a/yt_dlp/extractor/shouttv.py +++ b/yt_dlp/extractor/shouttv.py @@ -45,9 +45,9 @@ class ShoutTVBaseIE(InfoExtractor): ShoutTVBaseIE._REFRESH_TOKEN = refresh_token # 2 month TTL username, _ = self._get_login_info() if username and ShoutTVBaseIE._is_logged_in: - self.cache.store(self._NETRC_MACHINE, 'tokens', { - username: [ShoutTVBaseIE._ACCESS_TOKEN, ShoutTVBaseIE._REFRESH_TOKEN], - }) + tokens = self.cache.load(self._NETRC_MACHINE, 'tokens', default={}) + tokens[username] = [ShoutTVBaseIE._ACCESS_TOKEN, ShoutTVBaseIE._REFRESH_TOKEN] + self.cache.store(self._NETRC_MACHINE, 'tokens', tokens) def _fetch_access_token(self, content_id=None): if ShoutTVBaseIE._ACCESS_TOKEN and ShoutTVBaseIE._ACCESS_EXPIRY - 10 > time.time():