TLS fingerprint scraping: try curl_cffi before a headless browser
46 minutes ago
Author: admin

TLS fingerprint scraping: try curl_cffi before a headless browser

TLS fingerprint scraping: try curl_cffi before a headless browser

Many scrapers start with a headless browser because it feels like the safe default. It is also the most expensive option. If a site blocks your plain HTTP client, the cause is often the TLS fingerprint and not missing JavaScript. This article explains TLS fingerprint scraping issues and a cheaper first fix.

Why a plain HTTP client gets blocked

A TLS handshake carries details about the client: cipher order, extensions and other parameters. Anti-bot systems turn those details into a fingerprint, and the fingerprint of a default Python HTTP library does not look like the fingerprint of Chrome. The HTTP/2 settings your client sends can give it away too.

The directory at scrapingreview.com describes this for several defenses. Its notes say Cloudflare checks JA4 TLS fingerprints and HTTP/2 SETTINGS frame parameters. Other systems look elsewhere:

DefenseSignals named in the directory
CloudflareJA4 TLS fingerprint, HTTP/2 SETTINGS parameters
DataDomeBehavioral telemetry, a datadome session cookie
AkamaiSensor script, _abck cookie, WebGL checks, TLS cipher order
PerimeterX / HUMANNative JavaScript prototypes, CDP traces, _px3 cookie, Press and Hold challenge

The first row is the one you can often fix without a browser. The other rows lean on behavior and browser signals, so they may need a real browser or a specialist service.

Try TLS impersonation first

The curl_cffi library for Python can send requests with the TLS and HTTP/2 profile of a real browser. The API is close to requests:

from curl_cffi import requests

r = requests.get("https://example.com/", impersonate="chrome")
print(r.status_code)

If the status code changes from a block to 200, you saved yourself a whole browser fleet. A browser costs far more CPU and RAM per page than an HTTP call does, so this change can cut your infrastructure bill.

It will not work everywhere. Some targets need JavaScript to produce the data, and some check behavior. Treat impersonation as the first test, not as the final answer.

A decision path

  1. Request the page with a plain client. Note the status code and the response body.
  2. Try the same request with TLS impersonation.
  3. If the data is missing, check if it comes from a separate JSON endpoint in the browser network tab, and call that endpoint directly.
  4. If the page really needs JavaScript, use a headless browser.
  5. If a behavioral defense blocks you, evaluate a managed scraping service or browser.

Each step costs more than the one before, so stop at the first step that returns clean data.

Tools that help you diagnose

The site has three tools that fit this workflow:

  • An anti-bot tester at /anti-bot-tester, which inspects headers and response signatures to identify the active defense.
  • A cURL-to-code converter at /curl-converter, which turns a request copied from the browser into Python (requests, httpx or curl_cffi) or Node.js code.
  • A cost calculator at /calculator, which estimates total cost from proxy bandwidth, concurrency and captcha solving rates.

The converter is useful because it keeps the headers from the browser request. Missing headers are a common reason why a copied request fails.

Practice on open sources

Practice the workflow on sites that allow it. A public website with open content, such as Indexoid, is an example of a source for practicing request handling and data extraction. Read the terms of any site first and respect rate limits.

Know the limits of recommendations

Success rates on comparison sites often come from integrated partner stacks. Recommendations can reflect partner relationships. Run a small test on your own target and measure the success rate and the cost per successful page before you scale.

Checklist

  • Do not start with a browser. Start with the cheapest client.
  • Test TLS impersonation before you add infrastructure.
  • Look for the JSON endpoint behind the page.
  • Copy browser headers with a cURL converter.
  • Track cost per successful page.

Discussion

To add a comment, please log in