From 054eef11cbb31dafd3a259d9fc92057aa22e93d4 Mon Sep 17 00:00:00 2001 From: kqlio67 Date: Wed, 13 Nov 2024 22:48:01 +0200 Subject: ### refactor(g4f/Provider/Blackbox.py): Optimize fetch_validated method --- g4f/Provider/Blackbox.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/g4f/Provider/Blackbox.py b/g4f/Provider/Blackbox.py index 8eb310b6..8d820344 100644 --- a/g4f/Provider/Blackbox.py +++ b/g4f/Provider/Blackbox.py @@ -86,11 +86,11 @@ class Blackbox(AsyncGeneratorProvider, ProviderModelMixin): @classmethod async def fetch_validated(cls): - # Якщо ключ вже збережений в пам'яті, повертаємо його + # If the key is already stored in memory, return it if cls._last_validated_value: return cls._last_validated_value - # Якщо ключ не знайдено, виконуємо пошук + # If the key is not found, perform a search async with aiohttp.ClientSession() as session: try: async with session.get(cls.url) as response: @@ -111,7 +111,7 @@ class Blackbox(AsyncGeneratorProvider, ProviderModelMixin): match = key_pattern.search(js_content) if match: validated_value = match.group(1) - cls._last_validated_value = validated_value # Зберігаємо в пам'яті + cls._last_validated_value = validated_value # Keep in mind return validated_value except Exception as e: print(f"Error fetching validated value: {e}") -- cgit v1.2.3