SPB Git forge

spb/fetcha

Public
11commits 1branches 0releases
1.5 MBsize
maindefault branch
16 days agolast push
TypeScript 97.5% SQL 1.4% Python 0.8%

browser: detect challenge completion by interstitial markers only (beacon URLs on the real page kept it 'blocked')

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Simon-Pierre Boucher committed 16 days ago (Sep 8, 2026) parent 0f06945

1 changed file +3 −1

modified packages/browser/src/index.ts +3 −1
@@ -464,7 +464,9 @@ export class BrowserPool {
464 464 headers = lower(navResp.headers());
465 465 }
466 466 html = await page.content().catch(() => "");
467 const stillChallenge = CHALLENGE_SELECTORS.some((sel) => html.includes(sel.replace(/^[#.]/, "")) && /challenge|turnstile|captcha|datadome|px-/i.test(sel)) && looksBlocked(status, html, headers).blocked;
467 + // Interstitial markers only: the real page of a protected site also references
468 + // challenges.cloudflare.com (beacon), so vendor script URLs must not count here.
469 + const stillChallenge = /cf_chl_opt|__cf_chl_|id="challenge-(running|stage|form|error-text)"|<title>\s*Just a moment|id="px-captcha"|geo\.captcha-delivery\.com|id="datadome"|Verifying you are human|Performing security verification/i.test(html.slice(0, 60_000));
468 470 const v = looksBlocked(navResp ? status : 200, html, headers);
469 471 if (!v.blocked && !stillChallenge && html.length > 1500) {
470 472 challengeSolved = true;
471 473