How to bypass anti-bot protection when scraping public pages
Your scraper gets a 403, a "Just a moment..." page, a slider CAPTCHA or an "Access Denied" with a reference number, while the same URL opens fine in your browser. That is an anti-bot system deciding your request is not a person.
This guide covers how to tell which system you are facing, the layers they all check, the order to fix them in, and links to a detailed guide for each vendor.
Which anti-bot system is it?
Start by finding out what you are up against. Every vendor leaves recognisable cookies, headers or block pages:
| System | Tell-tale signs |
|---|---|
| Cloudflare | server: cloudflare, cf-mitigated: challenge, __cf_bm, "Just a moment..." |
| DataDome | datadome cookie, x-datadome header, captcha-delivery.com |
| Akamai Bot Manager | _abck, bm_sz cookies, "Access Denied ... Reference #18" |
| PerimeterX (HUMAN) | _px3, _pxhd cookies, "Press & Hold" |
| Kasada | x-kpsdk-* headers, ips.js, 429 on first load |
| AWS WAF | aws-waf-token cookie, 202 / 405 with a script |
| CAPTCHAs | reCAPTCHA, hCaptcha or Turnstile iframe on a thin page |
A rough check in Python. It only tells you what the site uses, not whether you were blocked; several of these load on ordinary pages too:
import re, requests
SIGNS = {
"Cloudflare": r"cf-ray|__cf_bm|cf_clearance|just a moment",
"DataDome": r"datadome|captcha-delivery\.com",
"Akamai": r"_abck|bm_sz|akamaighost|reference #18",
"PerimeterX": r"_px3|_pxhd|px-captcha|perimeterx",
"Kasada": r"x-kpsdk|ips\.js",
"AWS WAF": r"aws-waf-token|awswafintegration",
}
r = requests.get("https://www.example.com/", timeout=30)
blob = " ".join([str(r.status_code), str(r.headers), r.text[:20_000]]).lower()
print(r.status_code, [name for name, rx in SIGNS.items() if re.search(rx, blob)])The layers every system checks
Vendors differ in details, but they all build a score from the same layers, roughly in the order a request meets them:
1. IP reputation
Datacenter ranges start low; residential and mobile IPs start high. IPs seen sending bot traffic carry that history, often across every site the vendor protects.
2. TLS fingerprint
The TLS handshake (cipher order, extensions, curves; JA3/JA4) identifies the client library before any HTTP is sent. Python, Node and Go clients look nothing like Chrome.
3. HTTP/2 fingerprint and headers
SETTINGS frames, window sizes, pseudo-header order and the order of ordinary headers. A Chrome User-Agent on a non-Chrome HTTP/2 stack is a contradiction the edge sees immediately.
4. JavaScript environment
Challenge scripts probe the browser: automation flags, API inconsistencies, canvas and WebGL, fonts, timing. Plain HTTP clients cannot run them; default headless browsers fail them.
5. Behaviour and session
Where a visitor arrives, whether cookies persist, how fast and how regularly requests come. A first-ever visit that lands on a deep URL is unusual for a person.
6. The challenge
When the score is doubtful: an interstitial that runs and reloads, Turnstile, reCAPTCHA, hCaptcha, a slider, Press & Hold. When it is bad: a block.
Fix them in order, cheapest first
- —Fingerprint first. Use a client that reproduces Chrome's TLS and HTTP/2 (curl-impersonate, curl_cffi, tls-client). It costs nothing at runtime and is enough for many sites.
- —Then the IP. Residential exits for anything at volume. Rotate across sites; keep one IP per session on the same site.
- —Then a browser, only where needed. When a challenge or empty shell comes back, use a real browser engine with automation traces patched in the engine, not injected stealth scripts.
- —Then behaviour. Start sessions on the homepage, keep cookies, keep the per-site rate low, rest an exit after it is challenged.
- —Avoid challenges rather than solve them. A CAPTCHA means an earlier layer failed. Change the exit instead of paying to solve it. See the CAPTCHA guide.
Detect blocks correctly
Two mistakes cost scrapers more than any vendor does:
- —Trusting a 200. Some challenge pages come back with status 200. Check the title and a few markers before storing a page, or you will parse a wall as data.
- —Failing on a vendor's name. DataDome and PerimeterX load their scripts on every page of a protected site. A page that mentions them is not blocked; only the wall itself (captcha-delivery.com, px-captcha) is.
- —Believing the first 403. Cloudflare's non-interactive page, DataDome's device check, Akamai's sec-cpt and AWS WAF's challenge all answer with a blocking status and then reload into the page. Give them a few seconds in a browser.
The same, as one API call
UnblockingAPI does those steps for every request: a plain fetch with Chrome's TLS and HTTP/2 fingerprint first, a patched real browser on a residential exit when the answer is a block, a challenge or an empty shell, homepage priming, challenge pages given time to reload, and a different exit when one is challenged. What a site needs is learned per site. One successful request is one credit, whichever path it took, and failed requests are free.
curl -G "https://api.unblockingapi.com/unblock" \
-H "X-Api-Key: $UNBLOCKINGAPI_KEY" \
--data-urlencode "url=https://www.example.com/products/123"render_reason in the response tells you which path was used and why. See how it works and the API docs.
A guide for each system
Cloudflare
"Just a moment...", error 1020, Turnstile and cf_clearance, and what actually gets through.
DataDome
captcha-delivery.com, the datadome cookie, device checks and why deep links get blocked.
Akamai Bot Manager
_abck and bm_sz cookies, sensor data, "Access Denied" reference pages and sec-cpt.
PerimeterX (HUMAN)
"Press & Hold", _px3 and _pxhd cookies, and why a vendor tag is not a block.
Kasada
x-kpsdk headers, ips.js and proof-of-work: a defence with no CAPTCHA to look at.
AWS WAF Bot Control
aws-waf-token, challenge.js and the 202/405 responses AWS WAF sends instead of the page.
CAPTCHAs (reCAPTCHA, hCaptcha, Turnstile)
Why the best way past reCAPTCHA, hCaptcha and Turnstile is not to be shown one.
Frequently asked questions
Pass every detection layer at once: a TLS and HTTP/2 fingerprint that matches the browser you claim, a clean residential IP, a real browser when the site runs JavaScript checks, a session that starts on the homepage, and a request rate a person could plausibly produce. Fixing one layer while failing another still gets you blocked.
No. They fix IP reputation, which is one layer. A Python HTTP client on a residential IP still has a Python TLS fingerprint and still cannot run JavaScript challenges.
Reading public pages is generally lawful in most jurisdictions, but the details depend on where you are, what you collect and how you use it. Don't access accounts, collect personal data without a legal basis, or overload sites. Get legal advice for your specific case.
Your home connection is a residential IP with good reputation; your server is in a datacenter range many sites score low or block. The code did not change; the IP did.
No. Many sites only check the TLS fingerprint and IP, and a plain request with a Chrome-like fingerprint gets through. Use a browser only when a challenge or an empty JavaScript shell comes back; it is slower and heavier.
Try a URL that blocks your scraper.
Test the fetching layer before building your parser. Start with 500 free credits and no credit card. See pricing for credits from €5, with no subscription.
One successful request is one credit. No multipliers for rendering, proxies or retries.
