From e7382323bc5fe3ff78c4b2c6c2a351c377a85979 Mon Sep 17 00:00:00 2001 From: coletdjnz Date: Sat, 17 May 2025 13:25:05 +1200 Subject: [PATCH] better cache key name for internal versioning --- test/test_pot/test_pot_director.py | 4 ++-- yt_dlp/extractor/youtube/pot/_director.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test_pot/test_pot_director.py b/test/test_pot/test_pot_director.py index 51bdeccf43..d4236db466 100644 --- a/test/test_pot/test_pot_director.py +++ b/test/test_pot/test_pot_director.py @@ -578,7 +578,7 @@ class TestPoTokenCache: assert cache.get(pot_request) is None cache.store(pot_request, response) assert len(memorypcp.cache) == 1 - assert hashlib.sha256(f'_pExampleProvider_ytv1v{pot_request.video_id}'.encode()).hexdigest() in memorypcp.cache + assert hashlib.sha256(f'_dlp_cachev1_pExampleProviderv{pot_request.video_id}'.encode()).hexdigest() in memorypcp.cache # The second spec provider returns the exact same key bindings as the first one, # however the PoTokenCache should use the provider key to differentiate between them @@ -591,7 +591,7 @@ class TestPoTokenCache: assert cache.get(pot_request) is None cache.store(pot_request, response) assert len(memorypcp.cache) == 2 - assert hashlib.sha256(f'_pExampleProviderTwo_ytv1v{pot_request.video_id}'.encode()).hexdigest() in memorypcp.cache + assert hashlib.sha256(f'_dlp_cachev1_pExampleProviderTwov{pot_request.video_id}'.encode()).hexdigest() in memorypcp.cache def test_cache_provider_preferences(self, pot_request, ie, logger): pcp_one = create_memory_pcp(ie, logger, provider_key='memory_pcp_one') diff --git a/yt_dlp/extractor/youtube/pot/_director.py b/yt_dlp/extractor/youtube/pot/_director.py index 75964ecbb8..ed8c500307 100644 --- a/yt_dlp/extractor/youtube/pot/_director.py +++ b/yt_dlp/extractor/youtube/pot/_director.py @@ -135,7 +135,7 @@ class PoTokenCache: bindings_cleaned = { **{k: v for k, v in spec.key_bindings.items() if v is not None}, # Allow us to invalidate caches if such need arises - '_yt': 'v1', + '_dlp_cache': 'v1', } if spec._provider: bindings_cleaned['_p'] = spec._provider.PROVIDER_KEY