diff options
author | Heiner Lohaus <hlohaus@users.noreply.github.com> | 2024-04-21 07:22:59 +0200 |
---|---|---|
committer | Heiner Lohaus <hlohaus@users.noreply.github.com> | 2024-04-21 07:22:59 +0200 |
commit | db2d6cffd9268e8842f0c2aa8e062c0e19d88d28 (patch) | |
tree | 2b44e3ec6e21a8c1270f3d84a4a1f0efb360d37b /g4f/Provider/You.py | |
parent | Disable Bing integration test (diff) | |
download | gpt4free-db2d6cffd9268e8842f0c2aa8e062c0e19d88d28.tar gpt4free-db2d6cffd9268e8842f0c2aa8e062c0e19d88d28.tar.gz gpt4free-db2d6cffd9268e8842f0c2aa8e062c0e19d88d28.tar.bz2 gpt4free-db2d6cffd9268e8842f0c2aa8e062c0e19d88d28.tar.lz gpt4free-db2d6cffd9268e8842f0c2aa8e062c0e19d88d28.tar.xz gpt4free-db2d6cffd9268e8842f0c2aa8e062c0e19d88d28.tar.zst gpt4free-db2d6cffd9268e8842f0c2aa8e062c0e19d88d28.zip |
Diffstat (limited to 'g4f/Provider/You.py')
-rw-r--r-- | g4f/Provider/You.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/g4f/Provider/You.py b/g4f/Provider/You.py index 3d3a3513..36e2d161 100644 --- a/g4f/Provider/You.py +++ b/g4f/Provider/You.py @@ -10,7 +10,7 @@ from .base_provider import AsyncGeneratorProvider, ProviderModelMixin from .helper import format_prompt from ..image import ImageResponse, to_bytes, is_accepted_format from ..requests import StreamSession, FormData, raise_for_status -from .you.har_file import get_dfp_telemetry_id +from .you.har_file import get_telemetry_ids class You(AsyncGeneratorProvider, ProviderModelMixin): url = "https://you.com" @@ -35,6 +35,7 @@ class You(AsyncGeneratorProvider, ProviderModelMixin): } _cookies = None _cookies_used = 0 + _telemetry_ids = [] @classmethod async def create_async_generator( @@ -159,6 +160,8 @@ class You(AsyncGeneratorProvider, ProviderModelMixin): @classmethod async def create_cookies(cls, client: StreamSession) -> Cookies: + if not cls._telemetry_ids: + cls._telemetry_ids = await get_telemetry_ids() user_uuid = str(uuid.uuid4()) async with client.post( "https://web.stytch.com/sdk/v1/passwords", @@ -170,7 +173,7 @@ class You(AsyncGeneratorProvider, ProviderModelMixin): "Referer": "https://you.com/" }, json={ - "dfp_telemetry_id": await get_dfp_telemetry_id(), + "dfp_telemetry_id": cls._telemetry_ids.pop(), "email": f"{user_uuid}@gmail.com", "password": f"{user_uuid}#{user_uuid}", "session_duration_minutes": 129600 |