From dc441e60efe3f1b4843c1733dc9fe96c44220ebb Mon Sep 17 00:00:00 2001 From: protokey Date: Wed, 23 Sep 2026 16:48:55 +0400 Subject: [PATCH] =?UTF-8?q?fix:=20=D0=BF=D0=BE=D0=B2=D1=8B=D1=88=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D1=81=D1=82=D0=B0=D0=B1=D0=B8=D0=BB=D1=8C?= =?UTF-8?q?=D0=BD=D0=BE=D1=81=D1=82=D0=B8=20=D0=BE=D0=B1=D1=85=D0=BE=D0=B4?= =?UTF-8?q?=D0=B0=20cf=5Fturnstile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/antibot/known_providers/cloudflare.py | 13 ++++++++++++- src/antibot/orchestrator.py | 7 ++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/antibot/known_providers/cloudflare.py b/src/antibot/known_providers/cloudflare.py index 8ebe65c..c7f5401 100644 --- a/src/antibot/known_providers/cloudflare.py +++ b/src/antibot/known_providers/cloudflare.py @@ -61,6 +61,7 @@ iFrame with checkbox import logging import re import time +import traceback from random import randint from patchright.async_api import Page @@ -158,7 +159,17 @@ class CloudflareDetector(Detector): "managed", "interactive", ) - page_content = await page.content() + + for _ in range(2): + try: + page_content = await page.content() + except Exception: + traceback.print_exc() + await wait_for_page_stability(page, True, True) + continue + else: + break + for ctype in challenge_types: if f"cType: '{ctype}'" in page_content: return ctype diff --git a/src/antibot/orchestrator.py b/src/antibot/orchestrator.py index d3ccad8..5b1847d 100644 --- a/src/antibot/orchestrator.py +++ b/src/antibot/orchestrator.py @@ -3,6 +3,7 @@ """ import logging import time +import traceback from dataclasses import dataclass from captcha import load_captcha @@ -53,7 +54,11 @@ async def pass_challenges( if info.success: # noqa return ChallengeOutcome(True, reason=(info.meta or {}).get("reason")) # 2. передаем страницу в класс и ждем решения - await provider.solve(page, info) # noqa + try: + await provider.solve(page, info) + except Exception as e: + traceback.print_exc() + continue else: return ChallengeOutcome( False,