diff options
author | Heiner Lohaus <hlohaus@users.noreply.github.com> | 2024-04-28 22:19:51 +0200 |
---|---|---|
committer | Heiner Lohaus <hlohaus@users.noreply.github.com> | 2024-04-28 22:19:51 +0200 |
commit | 10896102fa0e3016758d3d199d10890c13170af2 (patch) | |
tree | 0bfc8aeccc7e6ab722bc433469ecbc14da321210 /g4f/Provider/you/har_file.py | |
parent | Update reka vision (diff) | |
download | gpt4free-10896102fa0e3016758d3d199d10890c13170af2.tar gpt4free-10896102fa0e3016758d3d199d10890c13170af2.tar.gz gpt4free-10896102fa0e3016758d3d199d10890c13170af2.tar.bz2 gpt4free-10896102fa0e3016758d3d199d10890c13170af2.tar.lz gpt4free-10896102fa0e3016758d3d199d10890c13170af2.tar.xz gpt4free-10896102fa0e3016758d3d199d10890c13170af2.tar.zst gpt4free-10896102fa0e3016758d3d199d10890c13170af2.zip |
Diffstat (limited to 'g4f/Provider/you/har_file.py')
-rw-r--r-- | g4f/Provider/you/har_file.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/g4f/Provider/you/har_file.py b/g4f/Provider/you/har_file.py index 791db7f1..8089d686 100644 --- a/g4f/Provider/you/har_file.py +++ b/g4f/Provider/you/har_file.py @@ -85,20 +85,21 @@ async def get_telemetry_ids(proxy: str = None) -> list: from nodriver import start except ImportError: raise MissingRequirementsError('Add .har file from you.com or install "nodriver" package | pip install -U nodriver') + page = None try: browser = await start() - tab = browser.main_tab - await browser.get("https://you.com") + page = await browser.get("https://you.com") - while not await tab.evaluate('"GetTelemetryID" in this'): - await tab.sleep(1) + while not await page.evaluate('"GetTelemetryID" in this'): + await page.sleep(1) async def get_telemetry_id(): - return await tab.evaluate( + return await page.evaluate( f'this.GetTelemetryID("{public_token}", "{telemetry_url}");', await_promise=True ) - return [await get_telemetry_id() for _ in range(1)] + return [await get_telemetry_id()] finally: - await tab.close()
\ No newline at end of file + if page is not None: + await page.close()
\ No newline at end of file |