Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
refactor: detect BasedFlare
NTFSvolume537014c55b50
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 64155a330..63c2470b2 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -22,6 +22,12 @@ All notable changes to this project will be documented here. For more details, vThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).+## UNRELEASED++### Changed++- Detect and report BasedFlare anti-bot protection+## [9.15.1] - 2026-06-11### Fixeddiff --git a/cyberdrop_dl/ddos_guard.py b/cyberdrop_dl/ddos_guard.pyindex ec32d2e02..33234ae01 100644--- a/cyberdrop_dl/ddos_guard.py+++ b/cyberdrop_dl/ddos_guard.py@@ -38,7 +38,7 @@ async def check_resp(resp: _Response, /) -> None:returnmitigations: list[type[DDosGuard]] = []- for cls in (DDosGuard, CloudFlareTurnstile, Anubis):+ for cls in _ALL_PROTECTIONS:if not cls.may_be_challenge(resp):continueif cls._is_challenge(resp):@@ -58,7 +58,7 @@ def check_html(html: str) -> None:def check_soup(soup: BeautifulSoup, /, posibilities: Iterable[type[DDosGuard]] | None = None) -> None:if posibilities is None:- posibilities = (DDosGuard, CloudFlareTurnstile, Anubis)+ posibilities = _ALL_PROTECTIONSfor protection in posibilities:if protection.check(soup):raise DDOSGuardError(f"{protection.__name__} anti-bot protection detected")@@ -75,6 +75,9 @@ class DDosGuard:))+ def __init_subclass__(cls) -> None:+ _ALL_PROTECTIONS.append(cls)+@classmethoddef may_be_challenge(cls, resp: _Response) -> bool:server = resp.headers.get("server")@@ -102,6 +105,9 @@ class DDosGuard:return bool(soup.select_one(cls.SELECTOR))+_ALL_PROTECTIONS = [DDosGuard]++class CloudFlareTurnstile(DDosGuard):TITLES = "Simpcity Cuck Detection", "Attention Required! | Cloudflare", "Sentinel CAPTCHA"SELECTOR = ", ".join(@@ -134,6 +140,17 @@ class CloudFlareTurnstile(DDosGuard):return super().check(soup) and bool(soup.select_one("script[src*='challenges.cloudflare.com/turnstile/v']"))+class BasedFlare(DDosGuard):+ # TODO: add logic to solve it: https://gitgud.io/fatchan/haproxy-protection/-/blob/71015f402c49afcdcb3e70bc98dbaddc5ccbc74c/src/js/ch.js#L105+ TITLES = ("Hold on...",)+ SELECTOR = ", ".join(("head[data-langjson*='Performance & security by BasedFlare')]", "body[data-pow][data-mode]"))++ @classmethod+ @override+ def check(cls, soup: BeautifulSoup) -> bool:+ return bool(soup.select_one(cls.SELECTOR))++class Anubis(DDosGuard):TITLES = ("Making sure you're not a bot!",)CHALLENGE = "script#anubis_challenge:-soup-contains(algorithm)"@@ -196,7 +213,7 @@ class Anubis(DDosGuard):passelapsed = time.monotonic() - start_time- raise DDOSGuardError(f"Unable to solve challenge after {elapsed:0.2f} seconds: {challenge}")+ raise DDOSGuardError(f"Unable to solve Anubis challenge after {elapsed:0.2f} seconds: {challenge}")@dataclasses.dataclass(slots=True, frozen=True)