diff options
author | bashonly <88596187+bashonly@users.noreply.github.com> | 2025-04-24 14:18:22 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-24 19:18:22 +0000 |
commit | 36da6360e130197df927ee93409519ce3f4075f5 (patch) | |
tree | 697e362402291460cd7cad7e6e23b7e423c4c080 | |
parent | e7e3b7a55c456da4a5a812b4fefce4dce8e6a616 (diff) |
[ie/mlbtv] Fix device ID caching (#12980)
Authored by: bashonly
-rw-r--r-- | yt_dlp/extractor/mlb.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/yt_dlp/extractor/mlb.py b/yt_dlp/extractor/mlb.py index f7726e5b1..562b93fc7 100644 --- a/yt_dlp/extractor/mlb.py +++ b/yt_dlp/extractor/mlb.py @@ -365,13 +365,15 @@ mutation initPlaybackSession( 'All videos are only available to registered users', method='password') def _set_device_id(self, username): - if not self._device_id: - self._device_id = self.cache.load( - self._NETRC_MACHINE, 'device_ids', default={}).get(username) + if self._device_id: + return + device_id_cache = self.cache.load(self._NETRC_MACHINE, 'device_ids', default={}) + self._device_id = device_id_cache.get(username) if self._device_id: return self._device_id = str(uuid.uuid4()) - self.cache.store(self._NETRC_MACHINE, 'device_ids', {username: self._device_id}) + device_id_cache[username] = self._device_id + self.cache.store(self._NETRC_MACHINE, 'device_ids', device_id_cache) def _perform_login(self, username, password): try: |