Thin out one repeated construction, and give the last eight orphans a home (#177)

Two related pieces of corpus hygiene.

The first: "rather than" ran at 2.60 per thousand words across 454 pages, with
one page using it sixteen times. A construction repeated at that rate is a
signature and not a style, which this corpus established in July when the same
phrase was cut from 63 uses across 21 pages down to 23. The corpus has grown
twentyfold since and nobody recounted.

136 pages were over five uses. 351 of them are rewritten, bringing every page
to five or fewer and the corpus mean from 4.4 to 3.6 per page.

The rewrites are varied on purpose. Replacing all 351 with "instead of" would
have taken that phrase from 1.19 to 1.65 per thousand words, which is trading
one signature for another. The load is spread by syntactic context instead: a
gerund takes "instead of", a preposition and a bare noun take a comma and
"not", a determiner alternates between the three. The result moves "rather
than" from 2.60 to 2.14, "instead of" from 1.19 to 1.32, ", not" from 2.45 to
2.71, and "in place of" from 0.01 to 0.05. Nothing spikes.

Verbs in the base form were left alone: rewriting those needs a judgement per
sentence, they are only 30 cases in the corpus, and there were plenty of safe
candidates without them.

The second piece: eight pages published on 5 September had no inbound link
from anywhere in the prose. Each now has one entry in the body of the pillar
it declares as its parent, in the section it belongs to. Both corpora are now
at zero orphans. Worth stating plainly, because the obvious reading is wrong:
this is not an indexing fix. All eight are outside Google's index, and so are
the two pages of the same wave that did have inbound links.

Internal links all resolve, no line endings touched, and the four files with
unbalanced brackets are code samples that were already that way.
This commit is contained in:
Federico authored and GitHub committed 2026-09-08 02:01:55 +02:00
1 parent 5f528357a6
commit d34a11e886
141 files changed
+371 -357

No files matched your search

+3 -3
View File
@@ -72,7 +72,7 @@ see is a header an injection cannot fix.
## How this project keeps header and property in agreement
Because the fingerprint is applied at the browser level rather than in the page, the
Because the fingerprint is applied at the browser level, not in the page, the
language is set through the same native preference a real profile uses, so both surfaces
read from it. There is nothing to inject into the page and nothing to keep in sync: the
header and the array are the same value formatted twice, by the browser, the way they
@@ -98,7 +98,7 @@ failure be replayed instead of guessed at.
## Prove they match, do not assume it
The point of this page is a check you can run rather than a claim to trust. Capture the
The point of this page is a check you can run, not a claim to trust. Capture the
`Accept-Language` header the browser actually sent, read `navigator.languages` from the
loaded page, and compare the two directly. Use any endpoint that echoes request headers
back; the snippet below reads the header off the outgoing request instead, so it needs no
@@ -132,7 +132,7 @@ with InvisiblePlaywright(seed=42) as browser:
Follow the method from
[how to test whether your browser is detected](how-to-test-bot-detection.md): assert the
values are present and agree, rather than asserting nothing looks wrong. A property that
values are present and agree, not asserting nothing looks wrong. A property that
comes back empty, or a header your capture never saw, is a failure and not a pass. Run it
against a stock browser on the same machine too, and the header and array should match
there in exactly the same way.
+3 -3
View File
@@ -69,7 +69,7 @@ and `headless` on `BrowserProfile`. The surrounding code is Chrome executable di
and Chrome profile handling, and the channel type is a Chromium channel.
The useful move there is pointing `executable_path` at your **real installed Chrome**
rather than the bundled Chromium, and pointing `user_data_dir` at a profile that has been
instead of the bundled Chromium, and pointing `user_data_dir` at a profile that has been
used. [The full version is here](browser-use-detection.md).
## Stagehand
@@ -77,7 +77,7 @@ used. [The full version is here](browser-use-detection.md).
Exposes `executablePath` and documents it, which is more than most. The rest of the
codebase is CDP: local CDP discovery, CDP tailing, a CDP client. Chromium references
outnumber Firefox ones by a wide margin, and the Firefox mentions are in an OpenAPI
schema and a client for someone else's API rather than in a launch path.
schema and a client for someone else's API, not in a launch path.
So the option exists and it expects a Chromium build.
@@ -97,7 +97,7 @@ documentation notes does not support Firefox, so that combination is largely ine
## Maxun
Playwright is in the manifest and no executable path is exposed. As a no-code platform
that is a coherent product decision rather than an oversight.
that is a coherent product decision instead of an oversight.
## What applies regardless of the engine
+2 -2
View File
@@ -15,7 +15,7 @@ payload, and a server-side model combines that payload with the request's networ
fingerprint into a Bot Score from 0 (human) to 100 (bot). Passing one layer of that
pipeline, even the hardest layer, does not mean you pass the rest.
A real, documented case makes that concrete rather than theoretical. In April 2026 a
A real, documented case makes that concrete, not theoretical. In April 2026 a
user of [Camoufox](https://github.com/daijro/camoufox), a separate open-source project
that also patches Firefox at the C++ level for automation, filed
[an issue](https://github.com/daijro/camoufox/issues/555) reporting that an
@@ -112,7 +112,7 @@ It does not remove the other six.
## The case that shows "matching fingerprint" is not "passing"
Here is what the GitHub issue actually contains, read directly rather than summarized
Here is what the GitHub issue actually contains, read directly, not summarized
from memory.
The reporter, running Camoufox v135.0.1-beta.24 through Playwright 1.58.0 on Linux, was
+1 -1
View File
@@ -9,7 +9,7 @@ nav_order: 34
# Anubis: The Proof-of-Work Firewall, Explained
Every other vendor on this list is a commercial product whose internals have to be pieced together from reverse engineering, because the company that built it has no reason to publish them. Anubis is different: it is MIT-licensed, its full source is on GitHub, and its author writes publicly about why it exists and what it does not solve. This page is built almost entirely from primary material, its own repository, its own documentation, and a named security researcher's own published analysis, rather than practitioner reconstruction. Say that plainly, because it is the exception in this corpus, not the rule.
Every other vendor on this list is a commercial product whose internals have to be pieced together from reverse engineering, because the company that built it has no reason to publish them. Anubis is different: it is MIT-licensed, its full source is on GitHub, and its author writes publicly about why it exists and what it does not solve. This page is built almost entirely from primary material, its own repository, its own documentation, and a named security researcher's own published analysis, not practitioner reconstruction. Say that plainly, because it is the exception in this corpus, not the rule.
Anubis was created by Xe Iaso, a pseudonymous developer, in January 2025, after Amazon's web crawler overloaded Iaso's own Git server while ignoring `robots.txt` entirely. It is now maintained by Techaro. The name is the joke and the mechanic at once: Anubis, the Egyptian god who weighs the hearts of the dead, and the software "weighs the soul" of an incoming HTTP request before deciding whether it deserves to reach the backend at all.
+2 -2
View File
@@ -17,9 +17,9 @@ This is one of the vendors in this corpus closer to an actual CAPTCHA than to a
## What Arkose's own materials say, and where they stop
Arkose's own public site describes its detection in terms of scale and adaptivity rather than mechanism: "225+ risk signals," "dynamic challenges that evolve in real time to counter emerging attack vectors," and device identification that combines "deterministic methods with machine learning similarity detection." Its own numbers past that point are business outcomes, not technical detail, customer satisfaction figures, dollar savings, account-growth multipliers, not the field names or scoring weights behind the 225 signals.
Arkose's own public site describes its detection in terms of scale and adaptivity, not mechanism: "225+ risk signals," "dynamic challenges that evolve in real time to counter emerging attack vectors," and device identification that combines "deterministic methods with machine learning similarity detection." Its own numbers past that point are business outcomes, not technical detail, customer satisfaction figures, dollar savings, account-growth multipliers, not the field names or scoring weights behind the 225 signals.
That is a real limit on what this page can say with a straight face. Arkose does not publish, in the materials checked for this page, the specific list of what those 225+ signals are or how the risk engine weighs them. What follows past this point comes from independent, practitioner-level reverse engineering rather than Arkose's own documentation, and is marked as such.
That is a real limit on what this page can say with a straight face. Arkose does not publish, in the materials checked for this page, the specific list of what those 225+ signals are or how the risk engine weighs them. What follows past this point comes from independent, practitioner-level reverse engineering, not Arkose's own documentation, and is marked as such.
## What practitioner reverse engineering has converged on
@@ -66,7 +66,7 @@ install. Its own documentation describes it plainly:
> encapsulate a connection to an IMAP4 server and implement a large subset of the
> IMAP4rev1 client protocol as defined in RFC 3501."
Use `IMAP4_SSL` for the connection, and pass an explicit SSL context rather than the
Use `IMAP4_SSL` for the connection, and pass an explicit SSL context instead of the
default one - the standard library is direct about why:
> "With the default ssl_context, the connection is encrypted but the server certificate
+5 -5
View File
@@ -9,7 +9,7 @@ nav_order: 33
# AWS WAF Bot Control, Explained
AWS WAF Bot Control is a managed rule group, not a separate product with its own dashboard and SDK ecosystem the way Akamai or DataDome ship one. You add it to a Web ACL (AWS's term for a firewall policy) the same way you'd add any other managed rule group, and unlike most of the vendors in this corpus, AWS documents its rules by name, in public, with what each one inspects and what action it takes by default. That is unusually specific for this category, and this page leans on it: almost everything below is quoted or closely paraphrased from AWS's own developer guide rather than reconstructed from outside reverse engineering.
AWS WAF Bot Control is a managed rule group, not a separate product with its own dashboard and SDK ecosystem the way Akamai or DataDome ship one. You add it to a Web ACL (AWS's term for a firewall policy) the same way you'd add any other managed rule group, and unlike most of the vendors in this corpus, AWS documents its rules by name, in public, with what each one inspects and what action it takes by default. That is unusually specific for this category, and this page leans on it: almost everything below is quoted or closely paraphrased from AWS's own developer guide, not reconstructed from outside reverse engineering.
Read from AWS's own documentation on 2026-08-30.
@@ -25,7 +25,7 @@ Two sub-families of targeted rules are named directly by their prefix. Rules beg
## The token: what ties a session's evidence together
Targeted detection runs on a **token**, generated by the JavaScript or mobile SDK and carried on subsequent requests, and AWS's rules read the token's state rather than re-deriving everything from scratch on every request. Two labels attached to every token matter most:
Targeted detection runs on a **token**, generated by the JavaScript or mobile SDK and carried on subsequent requests, and AWS's rules read the token's state instead of re-deriving everything from scratch on every request. Two labels attached to every token matter most:
- `awswaf:managed:token:id:{{identifier}}`, a session identifier tied to the specific token in use, changing if the client acquires a new one.
- `awswaf:managed:token:fingerprint:{{fingerprint-identifier}}`, a browser fingerprint AWS computes from client signals, which "stays the same across multiple token acquisition attempts" and is explicitly "not unique to a single client," AWS's own words for a value meant to identify a device class, not a specific visitor.
@@ -34,7 +34,7 @@ A token can be `accepted` (present, with a valid, unexpired challenge or CAPTCHA
## What the individual rules actually check
A sample of named rules, quoted from AWS's own rule listing, gives a concrete sense of what "browser interrogation" and "behavior heuristics" mean in practice rather than as marketing language:
A sample of named rules, quoted from AWS's own rule listing, gives a concrete sense of what "browser interrogation" and "behavior heuristics" mean in practice, not as marketing language:
| Rule | What it inspects | Default action |
|---|---|---|
@@ -50,11 +50,11 @@ A sample of named rules, quoted from AWS's own rule listing, gives a concrete se
The token-reuse family is worth pausing on: it does not ask whether any single request looks automated, it asks whether one browser's proof-of-legitimacy is being shared across more devices, networks or countries than a single real session plausibly touches in five minutes. That is a detection axis with no fingerprint answer at all, honest or otherwise, because the thing being scored is reuse across sessions, not any property of one session's browser.
AWS is also explicit about a category it treats differently from everything above: a maintained list of verified bots (search engine crawlers, monitoring services, SEO tools) that Bot Control identifies and does not block, adding a `bot:verified` label plus category and organization labels instead. A newer addition, **Web Bot Authentication**, lets a bot cryptographically sign its requests against a public key directory; a verified signature (`web_bot_auth:verified`) causes the category-block and `TGT_TokenAbsent` rules to skip that request entirely, a mechanism for bots that want to identify themselves honestly and be let through rather than evade detection.
AWS is also explicit about a category it treats differently from everything above: a maintained list of verified bots (search engine crawlers, monitoring services, SEO tools) that Bot Control identifies and does not block, adding a `bot:verified` label plus category and organization labels instead. A newer addition, **Web Bot Authentication**, lets a bot cryptographically sign its requests against a public key directory; a verified signature (`web_bot_auth:verified`) causes the category-block and `TGT_TokenAbsent` rules to skip that request entirely, a mechanism for bots that want to identify themselves honestly and be let through, not evade detection.
## What an engine answers honestly, and what a browser cannot touch
`SignalAutomatedBrowser`, `TGT_SignalBrowserAutomationExtension`, and `TGT_SignalBrowserInconsistency` are the rules a real, engine-level browser answers by construction: a genuinely real Firefox, patched below the JavaScript layer rather than scripted from a content script, does not carry automation-framework tells, does not have a Selenium-style extension installed, and does not produce internally inconsistent browser-interrogation data, because nothing is faking any of those signals from the inside. That is the same argument this corpus makes for [BotD](botd-explained.md) and [CreepJS](creepjs-explained.md), applied to a managed rule group instead of an open-source script.
`SignalAutomatedBrowser`, `TGT_SignalBrowserAutomationExtension`, and `TGT_SignalBrowserInconsistency` are the rules a real, engine-level browser answers by construction: a genuinely real Firefox, patched below the JavaScript layer, not scripted from a content script, does not carry automation-framework tells, does not have a Selenium-style extension installed, and does not produce internally inconsistent browser-interrogation data, because nothing is faking any of those signals from the inside. That is the same argument this corpus makes for [BotD](botd-explained.md) and [CreepJS](creepjs-explained.md), applied to a managed rule group instead of an open-source script.
Several rule families sit entirely outside what any browser engine can affect. `SignalKnownBotDataCenter` and the cloud-service-provider signal read the network origin, not the browser. The `TGT_VolumetricSession` and `TGT_TokenReuseIp/Country/Asn` families score session and token behavior across time and across requests, a property of how the automation is orchestrated (how many machines, how many networks, how fast) rather than of the browser rendering any one page. And `TGT_ML_CoordinatedActivity`, by AWS's own description, runs on aggregate traffic statistics across a site's whole visitor population, comparing against a baseline no single session's engine fidelity can influence.
+3 -3
View File
@@ -41,13 +41,13 @@ internally consistent identity per session - GPU, canvas, audio, fonts, screen,
concrete things move:
- **The engine the screenshots come from.** The pixels the model sees are rendered by a
browser whose fingerprint, TLS handshake and driver layer read as a genuine Firefox
rather than as an automation build announcing itself. This is why it clears most
browser whose fingerprint, TLS handshake and driver layer read as a genuine Firefox,
not as an automation build announcing itself. This is why it clears most
fingerprint, TLS and driver-layer checks: it is built to look like a real browser
driven by a real person, not to suppress signals. A suppressed or blank surface is its
own tell, so the goal is a present, plausible value, not a missing one.
- **The page the clicks land on.** Coordinate clicks arrive on a page inside that engine,
and pointer motion between them follows a Bezier curve rather than teleporting from
and pointer motion between them follows a Bezier curve instead of teleporting from
point to point.
What it does not touch is equally important, and the next section is about that.
+1 -1
View File
@@ -20,7 +20,7 @@ That single fact turns the Battery API into a small but reliable consistency che
page that claims to be Firefox in its user agent, and then successfully obtains a
battery object, has not measured your battery. It has caught a browser that is lying
about what it is. This page explains why that happens, why the honest answer is to have
no Battery API rather than a convincing fake one, and how a genuine Firefox build gets
no Battery API instead of a convincing fake one, and how a genuine Firefox build gets
that for free.
## What the Battery Status API was, and why Firefox dropped it
+1 -1
View File
@@ -35,7 +35,7 @@ look. Line them up and the confusion evaporates:
belongs to the same visitor as before. It is about linkability, not about looking
automated.
- **A reCAPTCHA v3 score** is a risk estimate between 0.0 and 1.0, built mostly from
behaviour and reputation rather than from what the DOM reports at all.
behaviour and reputation, not from what the DOM reports at all.
| Number | The question it answers | What it reads | What moves it |
|---|---|---|---|
+1 -1
View File
@@ -65,7 +65,7 @@ most of why people get confused.
- **ClientRects.** Reads the sub-pixel bounding boxes of positioned elements with
[`getClientRects()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getClientRects).
Like canvas, the exact fractional geometry varies with the
rendering stack, so it is a fingerprint rather than a setting.
rendering stack, so it is a fingerprint instead of a setting.
There are more pages - TLS, HTTP headers, geolocation, DNS - but these five are the ones
people arrive worried about, and they are all raw-value readouts with no cross-check
+9 -9
View File
@@ -71,13 +71,13 @@ something isn't in its bundle-only list, and each of those defaults quietly reac
the host if you don't close it explicitly:
- One backend's safety fallback, when the bundle is unreadable, is to fail toward an
empty list rather than the host - which breaks rendering visibly instead of leaking
empty list instead of the host - which breaks rendering visibly instead of leaking
silently, the correct failure direction for a fingerprinting surface.
- Another's default path, taken naively, falls straight through to a live host
enumeration call the moment the bundle-only condition isn't satisfied.
- The third had no bundle-only mode at all going in; it enumerates host and bundled
fonts through the same single API call, so keeping the host out requires filtering
every result rather than skipping a call.
every result instead of skipping a call.
Closing all three took a different patch per backend, because "don't enumerate the
host" means something different to DirectWrite, to fontconfig, and to CoreText. There
@@ -89,7 +89,7 @@ CoreText's version of this fix shipped later than Windows' and Linux's, and not
because it was harder to write. It was harder to *know was wrong*, because nobody
doing the work had a Mac to run it on.
**Layer one, found by reading the code rather than running it:** the block-at-birth
**Layer one, found by reading the code instead of running it:** the block-at-birth
hook that stops each backend from falling back to a live host enumeration had been
wired into the Windows and Linux font backends, and simply never ported to CoreText.
Reading the three backends side by side made that omission visible without running
@@ -108,7 +108,7 @@ built in. A hook that is correct and a build that never includes it produce the
observed nothing.
Both layers are closed now, and CoreText enumerates the identical family set the
other two backends do. The reason this is worth telling as one story rather than two
other two backends do. The reason this is worth telling as one story, not two
separate fixes: the first fix looked complete by every check available without a
real Mac, and was not. The only thing that caught the second layer was an automated
run on the actual operating system, checking the actual output, after the fix that
@@ -122,18 +122,18 @@ bundle, zero host fonts leaking through on either,
[generic CSS families](https://www.w3.org/TR/css-fonts-4/) (serif, sans,
monospace, and the per-script CJK generics) resolving to the same bundled fonts rather
than collapsing to whatever the host happens to have. The same check on macOS runs in
CI rather than locally, for the ordinary reason that not every setup has a Mac to test
CI, not locally, for the ordinary reason that not every setup has a Mac to test
on, and it has passed there too.
The cost is real and worth naming rather than glossing over. The binary is
meaningfully larger, because it now carries real font files rather than relying on
The cost is real and worth naming instead of glossing over. The binary is
meaningfully larger, because it now carries real font files instead of relying on
whatever the OS already had installed. And a fixed bundle also fixes the family list
in time: unlike a live host, the browser cannot pick up a font a real Windows Update
might add later. Both are the price of an answer that has no per-platform seams to find.
## Where it still leaks, named rather than hidden
## Where it still leaks, named, not hidden
Consistent with treating a suppressed signal as a fail rather than a pass, the honest
Consistent with treating a suppressed signal as a fail instead of a pass, the honest
gaps in this approach, found and not yet closed:
- One backend's [CSS `local()`](https://www.w3.org/TR/css-fonts-4/) font lookup path
@@ -54,7 +54,7 @@ string](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_debug_renderer_in
says so in plain text: a basic or generic renderer name, or the well-known software
rasterizer strings. A real desktop reports a specific GPU model from a specific vendor.
This is the single loudest VM tell
in the browser, because it is a string you can read directly rather than a statistic
in the browser, because it is a string you can read directly instead of a statistic
you have to accumulate.
Worse, the string and the pixels can disagree: a renderer that
+4 -4
View File
@@ -8,7 +8,7 @@ nav_order: 3
# Chromium is not Chrome, and detectors know the difference
**Short answer:** no, they are not the same, and the gap moved in 2026 rather than closing.
**Short answer:** no, they are not the same, and the gap moved in 2026 instead of closing.
Playwright's default Chromium - Chrome for Testing since v1.57 - now plays the same
H.264/AAC codecs as real Chrome, checked directly in a live session. It still fails
Chrome's [Widevine DRM check](https://developer.mozilla.org/en-US/docs/Web/API/Encrypted_Media_Extensions_API), and that part cannot be patched from JavaScript because it is
@@ -20,16 +20,16 @@ The gap is real, it moved in 2026, and one part of it is still a **compiled-in c
that a page can test for directly and that no amount of JavaScript patching can produce.
This page is what Playwright actually ships today, what changed and what didn't, why the
part that remains cannot be patched, why spoofing the user agent makes it worse rather than
part that remains cannot be patched, why spoofing the user agent makes it worse, not
better, and why Firefox has no equivalent gap.
## What Playwright ships today, checked directly rather than assumed
## What Playwright ships today, checked directly, not assumed
Playwright's own browser documentation used to be the whole answer: the default managed
Chromium was an open-source build, missing the proprietary parts Google adds on top. As of
[Playwright 1.57](https://playwright.dev/docs/release-notes), that changed. The default managed binary - launched with no `channel` set
at all - is now **Chrome for Testing**, Google's own dedicated distribution for automated
testing, pinned to the Playwright version rather than auto-updating.
testing, pinned to the Playwright version instead of auto-updating.
Chrome for Testing is not the stripped-down build the old default was. It ships the same
proprietary codec support as the Chrome a real visitor runs. Checked directly, in a live
+1 -1
View File
@@ -25,7 +25,7 @@ The mechanism, per Cloudflare's own description, uses "Workers AI with an open s
**The content is real, but deliberately unrelated.** Cloudflare states the generated pages cover "scientific facts, just not relevant or proprietary to the site being crawled." It is not garbage text and not misinformation by design, it is genuine, coherent content that has nothing to do with the site a crawler thinks it is scraping, chosen specifically so the maze does not itself become a source of false claims circulating under someone else's domain.
**It is pre-generated, not created live per request.** Cloudflare's post describes "a pre-generation pipeline that sanitizes the content to prevent any XSS vulnerabilities," with pages stored (in Cloudflare's own infrastructure, via R2 object storage) rather than generated fresh for every hit. That is a performance and safety choice: generating unique HTML live for every crawler request at Cloudflare's traffic volume would be its own cost and attack surface, and pre-screening for injected script content closes an obvious way a maze of AI-generated pages could otherwise be turned against the very sites serving them.
**It is pre-generated, not created live per request.** Cloudflare's post describes "a pre-generation pipeline that sanitizes the content to prevent any XSS vulnerabilities," with pages stored (in Cloudflare's own infrastructure, via R2 object storage), not generated fresh for every hit. That is a performance and safety choice: generating unique HTML live for every crawler request at Cloudflare's traffic volume would be its own cost and attack surface, and pre-screening for injected script content closes an obvious way a maze of AI-generated pages could otherwise be turned against the very sites serving them.
## It is also a honeypot, not just a delay tactic
+2
View File
@@ -92,6 +92,8 @@ need rendering. Each page below states where the other tool covers more.
- [invisible_playwright vs hrequests](vs-hrequests.md) - A hybrid TLS-impersonating HTTP client plus a browser mode with injected fingerprints.
- [tls-client vs a real browser: when TLS is enough](vs-tls-client.md) - When JA3/HTTP2 socket spoofing suffices on JSON and HTML, and where JS forces a full browser.
- [invisible_playwright vs browser-use: different jobs](vs-browser-use.md) - An LLM-driven agent framework against an engine you drive yourself, and where each one fits.
## Unmaintained tools
- [puppeteer-extra-plugin-stealth: unmaintained since 2024](puppeteer-extra-stealth-unmaintained.md) - No real update since mid-2024; old patches still work but the checklist froze.
@@ -58,7 +58,7 @@ There are two different reasons you might reach for this flag, and only one of t
survives contact with what the flag actually does.
**Legitimate testing need: your own code, your own CSP.** If you are testing a page you
control and the point of the test is the page's functionality rather than its CSP
control and the point of the test is the page's functionality instead of its CSP
configuration, bypassing CSP to let your own instrumentation or a third-party testing
widget run is a reasonable, disclosed tradeoff. You know the header is there, you know
you are turning it off for the test, and the production page a real visitor loads still
@@ -108,7 +108,7 @@ broader than most cases need.
**Known limitation:** documented reports exist of `bypassCSP` not resolving every CSP or
CORS error depending on the specific directive and browser version, so confirm the
console warning is actually gone after setting the option rather than assuming the flag
console warning is actually gone after setting the option instead of assuming the flag
is unconditionally comprehensive.
## Diagnostic checklist
@@ -116,11 +116,11 @@ is unconditionally comprehensive.
1. Check the browser console for a `Content-Security-Policy` message naming the refused
directive before assuming your injection code is broken.
2. Read the response's `content-security-policy` header directly to see the actual
policy rather than guessing from the symptom.
policy instead of guessing from the symptom.
3. Confirm the refusal is `script-src` (or `default-src` covering it), not an unrelated
directive that happens to also block something in your flow.
4. Decide whether this is your own page under test or a third-party target, and apply
the tradeoff above rather than reaching for `bypass_csp` reflexively.
the tradeoff above instead of reaching for `bypass_csp` reflexively.
5. After setting `bypass_csp=True`, re-check the console to confirm the specific warning
is gone; a version-specific gap means it is not always comprehensive.
+4 -4
View File
@@ -67,16 +67,16 @@ Same source: DataDome states its engine processes on the order of three
trillion signals a day (2022 figure). A separate 2026 write-up from
Scrapfly, a scraping infrastructure vendor, cites five trillion a day and
"over 85,000 customer-specific and use-case-specific models," one set per
protected site rather than one global model. Four years apart and not
protected site instead of one global model. Four years apart and not
necessarily in tension, but neither figure is audited, so treat both as
vendor reporting rather than something this page verified independently.
vendor reporting, not something this page verified independently.
IP and ASN sit in the same layer conceptually: whether the address is
residential, mobile or datacenter, its distance from the claimed timezone,
how many recent requests share it. [What ASN and IP reputation actually
score, and how fast it decays, is covered separately](asn-and-ip-reputation-in-bot-detection.md);
DataDome's docs do not detail IP scoring, so this leans on the practitioner
writeups rather than DataDome's own pages.
writeups, not DataDome's own pages.
## The device check: what the JavaScript tag actually collects
@@ -114,7 +114,7 @@ lists, camera/microphone permission state, and two separate sets of
User-Agent Client Hints. A vendor selling a bypass product has an obvious
incentive to make its own reverse engineering sound thorough, so read this
list as corroborated in outline, two unrelated writeups converge on canvas,
WebGL, fonts and automation-framework checks, rather than verified line by
WebGL, fonts and automation-framework checks, not verified line by
line.
DataDome's own **Device Check** feature is the name for the invisible
+1 -1
View File
@@ -94,7 +94,7 @@ consumer operating system, and that mismatch is the signal.
Claiming Windows in the user agent while the font vector is a Linux base image
is a one-line contradiction, and it is exactly the kind of internal disagreement
that [a browser that inspects consistency rather than values](how-to-test-bot-detection.md)
that [a browser that inspects consistency, not values](how-to-test-bot-detection.md)
records as a lie.
The same probe list produces a different vector in each of these three cases:
@@ -12,7 +12,7 @@ nav_order: 12
No. A VPN changes one thing: the IP address the server sees. The browser
fingerprint - canvas, WebGL, installed fonts, the user agent, the timezone, the
hardware counters - is exactly what it was before you connected. Worse, a VPN can
make a session look more suspicious rather than less, because it introduces a second
make a session look more suspicious, not less, because it introduces a second
story about where you are and gives a detector two stories to compare.
This page is what a VPN moves, what it leaves in place, the specific way it can
@@ -35,7 +35,7 @@ different problem with a different owner.
## What a VPN leaves untouched
Open any fingerprinting report through a VPN and read the fields rather than the
Open any fingerprinting report through a VPN and read the fields, not the
verdict. The address at the top has changed. Nothing below it has:
- **[Canvas](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API) and
@@ -18,7 +18,7 @@ not a launch-time argument Playwright resolves for you.
This gets asked because the Chromium path is well documented and looks like it should
generalize, and because the honest answer involves a handful of old, still-open
GitHub issues rather than a clean feature page. Here is what Playwright actually
GitHub issues instead of a clean feature page. Here is what Playwright actually
supports, what does not work, and the one route that does.
## What Playwright's documented extension support actually is
+1 -1
View File
@@ -69,7 +69,7 @@ are consistency gaps: a headless context with no real GPU, a screen size no disp
list or font set that does not match the claimed platform. Each is a small addition to the
score, and together they are the fingerprint contribution.
You can see this contribution directly rather than taking it on faith. Open the same
You can see this contribution directly instead of taking it on faith. Open the same
detector page in your automated browser and in a stock browser on the same machine, and
diff the reports field by field. The
[method for doing that comparison honestly](how-to-test-bot-detection.md) is worth reading
+3 -3
View File
@@ -10,7 +10,7 @@ nav_order: 10
# Emoji fingerprinting: why emoji look the same on any OS
Emoji look the same on any OS in Firefox because Firefox draws colour emoji from
its own bundled font rather than the platform's, so the render is host-independent.
its own bundled font instead of the platform's, so the render is host-independent.
That is worth explaining, because emoji are otherwise one of the oldest
operating-system tells there is. The same code point is drawn from a different font
on each platform, and those fonts do not agree on a single pixel: Windows renders
@@ -48,7 +48,7 @@ operating system's emoji font at all. It ships its own colour-emoji font, based
Twemoji, inside the browser package, and it rasterises colour emoji from that
bundled file on every platform it runs on. A stock Firefox on Windows, a stock
Firefox on macOS and a stock Firefox on Linux all draw the same emoji from the
same font, because the font travels with the browser rather than coming from the
same font, because the font travels with the browser instead of coming from the
host.
That is a structural difference from Chrome, which defers to the platform emoji
@@ -63,7 +63,7 @@ assume. The engine has already made the render host-independent.
This project builds on that property deliberately. To make text match Windows on
any host, the build bundles a set of real Windows font files and exposes only
those families, so a Linux server draws Latin, CJK and the rest from genuine
Windows glyphs rather than from whatever the host happens to have installed. The
Windows glyphs, not from whatever the host happens to have installed. The
same idea is covered in detail under [bundled fonts that render the same on every OS](bundled-fonts-cross-platform.md).
The emoji font is treated differently, and on purpose. The colour-emoji file is
+1 -1
View File
@@ -20,7 +20,7 @@ already worked.
## The causes that are usually fine
**A download started instead of a page load.** When a navigation resolves to a file
download rather than an HTML response, the browser aborts the page-level navigation
download instead of an HTML response, the browser aborts the page-level navigation
in favor of handing the response to the download machinery, and Playwright surfaces
that abort as `net::ERR_ABORTED` even though the file saves correctly.
[microsoft/playwright-java#541](https://github.com/microsoft/playwright-java/issues/541)
@@ -68,7 +68,7 @@ Wi-Fi, because the check that would have told them apart is the check you disabl
The narrower, safer alternative when the actual goal is trusting one specific proxy
is installing that proxy's own root CA certificate into the browser's trust store,
so only that one issuer becomes trusted rather than every issuer becoming
so only that one issuer becomes trusted, not every issuer becoming
irrelevant. Where that is not practical, the operationally honest habit is scoping
`ignoreHTTPSErrors` to sessions that are genuinely, deliberately behind a proxy you
control, never to a context whose traffic might also touch a network you do not
+6 -6
View File
@@ -10,7 +10,7 @@ nav_order: 37
# net::ERR_CONNECTION_REFUSED in Playwright
`net::ERR_CONNECTION_REFUSED` means the machine at the other end of the address and port
actively refused the connection: it answered with a TCP reset rather than staying silent.
actively refused the connection: it answered with a TCP reset instead of staying silent.
Chromium's own network error list defines it in five words, "A connection attempt was
refused," code -102. `page.goto()` throws it fast, usually in well under a second, because
a refusal is an immediate reply, not a wait for something that never comes.
@@ -27,7 +27,7 @@ on that exact port, or something is actively and deliberately rejecting the atte
started, a service that crashed, or a port number that is simply wrong. Confirm the
process is actually running and bound to the port you are navigating to.
**A firewall or security group actively rejecting rather than silently dropping.** Some
**A firewall or security group actively rejecting, not silently dropping.** Some
firewall configurations answer a blocked port with a reset (refused) and others simply
drop the packet (timeout). Which one you get depends on the device, not on Playwright.
@@ -40,7 +40,7 @@ it enough time, headless did not.
[A GitHub Actions report](https://github.com/microsoft/playwright/issues/21414) and
[a CircleCI report](https://github.com/microsoft/playwright/issues/20343) both show
`ERR_CONNECTION_REFUSED` against `localhost` reproducing reliably in CI and not locally,
which is the signature of an environment-specific networking difference rather than a
which is the signature of an environment-specific networking difference instead of a
code regression.
## The Docker and CI networking variant, in detail
@@ -65,8 +65,8 @@ instead, where nothing is listening, and gets refused. The same code works perfe
developer's own machine, because there `localhost` genuinely is the machine running both
the browser and the server, no namespace boundary in between, which is exactly why the
bug reads as "nothing changed" when the entire network topology did. Port publishing
(`-p 3000:3000`) does not fix this either if the server itself is bound to `127.0.0.1`
rather than `0.0.0.0`: "the server is listening on 127.0.0.1 inside the container network
(`-p 3000:3000`) does not fix this either if the server itself is bound to `127.0.0.1`,
not `0.0.0.0`: "the server is listening on 127.0.0.1 inside the container network
namespace" while the forwarded traffic arrives on the external interface, an address the
server was never told to listen on. [A real report](https://github.com/microsoft/playwright/issues/24582)
shows exactly this shape: the port listed as exposed in a Compose file, and the connection
@@ -89,7 +89,7 @@ the equivalent Compose `extra_hosts` entry.
Playwright's process, the target service, and your own terminal can each be in a
different network namespace, each with its own idea of `localhost`.
3. **Check what interface the target service binds to**, and address other Compose
services by their service name rather than `localhost`, which does not cross
services by their service name, not `localhost`, which does not cross
container boundaries at all.
4. **In CI specifically, test from inside the runner**, since a firewall or security
group there can behave differently from your own machine even when the code and the
+2 -2
View File
@@ -22,7 +22,7 @@ failure and not a handshake failure. Something answered the socket, then said no
**A crashed or overloaded backend.** A worker process dying mid-request, an
out-of-memory kill, or a request handler that raises before writing a single byte all
leave the reverse proxy or load balancer in front of it holding an open connection with
nothing to forward. The proxy closes the client connection rather than inventing a
nothing to forward. The proxy closes the client connection instead of inventing a
response, and the browser reports exactly this.
**A proxy or load balancer timing out on the backend and giving up without answering.**
@@ -36,7 +36,7 @@ documented, ordinary feature of production web servers, not a theory about hosti
intent. nginx's own status code `444` exists specifically to close a connection without
sending any response, and the `reset_timedout_connection` directive, in nginx's own
words, applies to "connections closed with the non-standard code 444," releasing the
socket with a TCP reset rather than a normal close. A server operator who wants to deny
socket with a TCP reset, not a normal close. A server operator who wants to deny
a request with zero information leakage, whether the requester is a scanner, a bot, or
simply unwanted traffic, has this as a first-class, standard option: return nothing
rather than a status code that says "blocked."
@@ -40,7 +40,7 @@ not before a tunnel opened.
Chromium's error list places several related, more specific failures right next to this
one, and which one you actually see narrows the cause: `ERR_MISSING_AUTH_CREDENTIALS`
(-341), "No Kerberos credentials were available during HTTP Authentication," the
GSSAPI-specific case of having nothing to offer for a Negotiate challenge rather than
GSSAPI-specific case of having nothing to offer for a Negotiate challenge instead of
offering something that gets rejected; `ERR_UNSUPPORTED_AUTH_SCHEME` (-339), "An HTTP
Authentication scheme was tried which is not supported on this machine," a platform gap
rather than wrong credentials; and `ERR_MALFORMED_IDENTITY` (-329), "The identity used
+3 -3
View File
@@ -42,7 +42,7 @@ on a failure that happens a step earlier than anything it controls.
**A cipher suite or TLS version neither side supports.** The client offers a set of
ciphers and protocol versions in its ClientHello; if the server's own configuration has
no overlap with what was offered, at whatever versions each side is willing to speak,
the handshake fails outright rather than falling back gracefully. This is common on
the handshake fails outright instead of falling back gracefully. This is common on
older or misconfigured servers, and on modern servers being reached by an outdated or
deliberately restricted client.
@@ -66,7 +66,7 @@ reach.
**A port or scheme mismatch.** Requesting `https://` against a port actually serving
plain HTTP, or the reverse, produces bytes that do not parse as the protocol either side
expected, which surfaces as a protocol-level failure rather than a clean rejection.
expected, which surfaces as a protocol-level failure, not a clean rejection.
**HTTP/3 or QUIC negotiation failing where HTTP/2 or HTTP/1.1 would have worked.**
Cloudflare's own documentation names HTTP/3 incompatibility as a distinct cause
@@ -90,7 +90,7 @@ forcing an older protocol.
5. **Do not reach for `ignoreHTTPSErrors` first.** It has no effect on a handshake that
never produced a certificate to evaluate; testing it and seeing no change, the way
the real report above did, is itself useful confirmation the failure is
protocol-level rather than trust-level.
protocol-level, not trust-level.
## What Firefox reports instead
@@ -23,7 +23,7 @@ The collection code is not a plain script a browser's devtools can read line by
F5's own phrasing: "Bot Defense examines the telemetry collected from requests before they are permitted to reach your application." A bot detection rule, in F5's own terms, "contains criteria that Bot Defense uses to determine whether a transaction is from a human or automated source," and that determination is made before the origin server does anything with the request at all.
Two outcomes follow. For traffic Bot Defense calls human or an explicitly allowed automated source, "Bot Defense adds a custom HTTP request header to the request and allows the traffic to continue to the origin," which gives the origin application a signal it can check without having to run its own detection. For traffic it calls automated, the configured mitigation, monitor, block, or redirect, applies instead; F5's docs describe this as configurable per endpoint policy rather than a single global switch.
Two outcomes follow. For traffic Bot Defense calls human or an explicitly allowed automated source, "Bot Defense adds a custom HTTP request header to the request and allows the traffic to continue to the origin," which gives the origin application a signal it can check without having to run its own detection. For traffic it calls automated, the configured mitigation, monitor, block, or redirect, applies instead; F5's docs describe this as configurable per endpoint policy instead of a single global switch.
## The 2020 shift, and what F5's newer material adds
+2 -2
View File
@@ -38,7 +38,7 @@ Once loaded, the script's execution feeds three system signals a site owner can
| Signal | What it indicates |
|---|---|
| `SUSPECTED-BOT.HEADLESS` | Probable headless browser activity |
| `SUSPECTED-BAD-BOT.HEADLESS` | Headless activity Fastly's model treats as malicious rather than merely automated |
| `SUSPECTED-BAD-BOT.HEADLESS` | Headless activity Fastly's model treats as malicious, not merely automated |
| `CLIENTSIDE-COOKIE-VALID` | The client-side script ran and produced a cookie, i.e. it is a real, executing browser environment |
The cookie itself is named `_fs_cd_cp_` in Fastly's own docs, and its presence is how a site owner or a Fastly rule confirms the script actually executed rather than being blocked or skipped.
@@ -47,7 +47,7 @@ Handling then splits by inspection point: pre-cache rules can act on a `fastly.b
## Signals beyond headless detection
Fastly's broader materials name additional categories without publishing the same level of implementation detail as the headless script: **client fingerprinting**, to "identify client types and detect bots designed for malicious activities," and **AI bot detection**, aimed specifically at "AI crawlers and fetchers" as their own traffic class. A 2024 addition, the `BOT-ANALYSIS` system signal, is documented only at the level of "a request that was analyzed for bots," without the finer distinctions Fastly gives the headless-specific signals; this page reports that limitation rather than guessing at what `BOT-ANALYSIS` adds beyond the headless triad.
Fastly's broader materials name additional categories without publishing the same level of implementation detail as the headless script: **client fingerprinting**, to "identify client types and detect bots designed for malicious activities," and **AI bot detection**, aimed specifically at "AI crawlers and fetchers" as their own traffic class. A 2024 addition, the `BOT-ANALYSIS` system signal, is documented only at the level of "a request that was analyzed for bots," without the finer distinctions Fastly gives the headless-specific signals; this page reports that limitation instead of guessing at what `BOT-ANALYSIS` adds beyond the headless triad.
## What an engine answers honestly, and what stays server-side
@@ -41,7 +41,7 @@ your index is empty, but no amount of waiting for JavaScript fixes it, because t
JavaScript was never allowed to run.
A real browser addresses both at once: it executes the page's JavaScript, and it makes a
request that reads as a genuine Firefox rather than a script. That is the whole reason to
request that reads as a genuine Firefox instead of a script. That is the whole reason to
put a browser in front of the index instead of an HTTP loader.
## The fetch stage: render with a real browser fingerprint
+2
View File
@@ -40,6 +40,8 @@ override from the page, because the page is not where the tell originates.
- [Execution context was destroyed, and when it means detection](execution-context-destroyed.md) - Usually a race condition, but sometimes a redirect to a challenge; how to tell the two apart.
- [Why content_frame() returns None for a cross-origin iframe](cross-origin-iframe-unreachable.md) - One shared cause behind None, throws and timeouts: process isolation, not a permissions bug.
- [Running Playwright Firefox on ARM64 Linux](playwright-firefox-arm64-linux.md) - What ships per architecture on ARM64 Linux, the emulation trap, and the memory ceiling.
## Human-like input and interaction
- [Human-like mouse movement: Bezier curves are the easy part](human-mouse-movement.md) - Every pointer event carries fields saying where it came from, and a perfect curve can still fail.
+2
View File
@@ -26,6 +26,8 @@ platform the browser claims to be, not just look plausible in isolation.
- [WebGL shader precision as a fingerprint surface](webgl-shader-precision-fingerprint.md) - getShaderPrecisionFormat is a third WebGL fingerprint, hashed apart from parameters and extensions.
- [Is WebGPU a browser fingerprint?](is-webgpu-a-browser-fingerprint.md) - navigator.gpu exposes a second GPU identity most guides ignore, and it must match WebGL.
- [Why the same canvas draws differently on Windows and Linux](canvas-differs-across-operating-systems.md) - Why the same canvas call draws different pixels on Windows and on Linux, layer by layer.
## Fonts, emoji and text metrics
- [How to make Linux and macOS report real Windows fonts](bundled-fonts-cross-platform.md) - Bundle the real font files and read only from them; filtering a list leaves the host underneath.
+2
View File
@@ -47,6 +47,8 @@ whether a browser is telling the truth about what it claims to be.
- [hCaptcha Enterprise vs Standard](hcaptcha-enterprise-vs-standard.md) - the same mechanism, plus custom difficulty tuning, dedicated risk models and an SLA instead of the free tier's labeled-data economy.
- [Cloudflare Bot Management, Explained](cloudflare-bot-management-explained.md) - the always-on scoring engine behind Cloudflare's edge, distinct from the Turnstile widget: a 1-99 bot score from JA3/JA4, HTTP fingerprinting, ML and behavior.
- [Queue-it virtual waiting rooms, explained for automation](queue-it-virtual-waiting-room-explained.md) - How a virtual waiting room splits the redirect, the return token and the JavaScript half from the server half.
## What a fingerprint is and how accurate it is
- [What is a browser fingerprint?](what-is-a-browser-fingerprint.md) - the join of dozens of low-entropy attributes that identify a browser with no cookie.
+5 -3
View File
@@ -12,10 +12,10 @@ The rest of the Guides explain how a single surface gives you away. This group i
other direction: a concrete task, in order, with the code that does it and the specific
thing that breaks it.
Every page here is written against a real browser rather than a generic recipe. The
Every page here is written against a real browser instead of a generic recipe. The
launch is a two-line change from stock Playwright, the browser returned is a real
Playwright `Browser` with no wrapped subset to learn, and each how-to carries at least one
mistake we made first, measured and fixed rather than assumed.
mistake we made first, measured and fixed, not assumed.
Start with [how to scrape without getting blocked](how-to-scrape-without-getting-blocked.md)
for the model that orders the rest, then pick the task you have.
@@ -58,6 +58,8 @@ for the model that orders the rest, then pick the task you have.
- [Scrape a map-based search with Playwright](how-to-scrape-map-based-search-playwright.md) - Capture the bounding-box marker XHR, pan and zoom, grid the viewport to cover the area.
- [How to scrape map-based local results with Playwright](how-to-scrape-map-based-local-results-playwright.md) - Drive the viewport, capture the bounds-keyed XHR per step, tile an area through an in-region proxy.
- [Select from dropdowns with Playwright, native and custom](playwright-select-option-dropdowns.md) - select_option() drives a real select element; a custom listbox needs a click, a wait, then a second click.
## Extracting content and structured data
- [How to extract JSON-LD structured data with Playwright](how-to-extract-json-ld-structured-data-playwright.md) - Parse JSON-LD and @graph instead of fragile selectors; an empty result reads as a blocked page.
@@ -111,7 +113,7 @@ for the model that orders the rest, then pick the task you have.
- [How to scrape EV charging availability with Playwright](how-to-scrape-ev-charging-availability-playwright.md) - Capture the status feed behind the map, keep the operator's timestamp apart from yours, store transitions not snapshots.
- [How to scrape fuel prices with Playwright](how-to-scrape-fuel-prices-playwright.md) - Set the location explicitly, keep grade and unit with every price, and record whether the number was reported or observed.
- [How to scrape snow reports with Playwright](how-to-scrape-snow-reports-playwright.md) - Pin the unit before reading, keep base and summit as separate measurements, and take the resort's own report time.
- [How to scrape parking rates with Playwright](how-to-scrape-parking-rates-playwright.md) - Capture the tariff table as duration bands rather than a price, and keep the small print that outranks the table.
- [How to scrape parking rates with Playwright](how-to-scrape-parking-rates-playwright.md) - Capture the tariff table as duration bands instead of a price, and keep the small print that outranks the table.
- [How to scrape energy tariff comparisons with Playwright](how-to-scrape-energy-tariffs-playwright.md) - Drive the consumption form, keep standing charge and unit rate apart, and copy the inputs into every quoted row.
- [How to scrape bank interest rates with Playwright](how-to-scrape-bank-interest-rates-playwright.md) - Resolve the footnote markers while you have the DOM, keep the balance tiers as rows, and take the effective date.
- [How to scrape stock and financial data with Playwright](how-to-scrape-stock-and-financial-data-playwright.md) - Scrape fundamentals from tables, capture the live quote stream at the WebSocket or polling XHR.
+4
View File
@@ -50,7 +50,11 @@ telling the difference before you ship a fix, not after.
- [Playwright TargetClosedError: the causes and the fixes](playwright-targetclosederror-causes.md) - usually not a timeout; three specific Firefox and Juggler causes, their symptoms, and how to tell them apart.
- [Firefox preferences that silently do nothing](firefox-prefs-not-applying.md) - a preference you set can be silently ignored with no error; the reasons in order, and how to confirm which one you hit.
- [First Firefox launch fails on Windows, then works](first-firefox-launch-fails-then-works-windows.md) - The first launch of a freshly extracted build fails, every later one works: what Windows remembers between the two.
- [Keep Playwright Firefox memory flat on long runs](playwright-firefox-memory-long-runs.md) - Memory that grows over a long run comes from unclosed contexts, an accumulating list, or one context kept too long.
## Canvas, screenshots and fingerprint noise
- [Canvas fingerprint changes every run: use a seed](canvas-fingerprint-changes-every-run.md) - canvas, WebGL and audio hashes change each run; pass a fixed seed to make readbacks byte-identical.
- [Playwright screenshot returns noise: readback fix](playwright-screenshot-returns-noise.md) - why page.screenshot() returned a noise PNG, and the principal-split canvas readback fix that made captures clean.
- [Missing fonts in Docker break Playwright screenshots](playwright-firefox-fonts-docker.md) - A container ships almost no fonts, so text renders as boxes or as the wrong family.
+5 -5
View File
@@ -19,7 +19,7 @@ underneath, the same mechanism.
The short version: Enterprise is not a stricter widget. It is the same
checkbox-or-invisible, escalate-to-a-puzzle model, given a visible risk score, custom
challenge content, difficulty controls a free integration never sees, and a support
contract, sold as a metered or negotiated product rather than embedded for free in
contract, sold as a metered or negotiated product, not embedded for free in
exchange for the puzzle answers themselves.
## Three tiers, not two
@@ -31,7 +31,7 @@ choosing among four fixed difficulty modes: "Easy, Medium, Difficult, and Auto."
is a paid, self-serve tier priced, per hCaptcha's own pricing page, at "$99/month"
billed annually or "$139/month" billed monthly, including 100,000 evaluations a month
with overage at "$0.99/1K" beyond that, with a two-week free trial. **Enterprise** is
custom-priced and sold through a sales contact rather than a checkout page.
custom-priced and sold through a sales contact, not a checkout page.
## What Pro adds over Basic
@@ -49,10 +49,10 @@ score, or the analytics.
## What Enterprise adds on top of Pro
This is the part that is a genuine capability gap rather than a bigger number on the
This is the part that is a genuine capability gap instead of a bigger number on the
same feature, and hCaptcha's own plans page names it directly: **private learning**,
described as training detection models on an Enterprise customer's own traffic patterns
rather than a shared, general model, plus **custom challenges** and **challenge content
in place of a shared, general model, plus **custom challenges** and **challenge content
control**, meaning an Enterprise account can bring its own images or questions instead
of using hCaptcha's default challenge pool. hCaptcha's plans page also lists **human
threat detection**, **difficulty tuning**, called out specifically as including the
@@ -71,7 +71,7 @@ gives that customer direct control over what the puzzle even looks like, and add
operational scaffolding (SLA, SSO, reporting) an organization actually deploying this at
scale asks for. None of it is a stricter version of the puzzle itself, it is control
over when and how the puzzle appears, and how well the risk model fits one customer's
own traffic rather than the general population hCaptcha sees.
own traffic instead of the general population hCaptcha sees.
| | Basic (free) | Pro | Enterprise |
|---|---|---|---|
+2 -2
View File
@@ -19,7 +19,7 @@ validating itself against the one call almost no real script makes.
Every guide to human-like mouse movement measures the same thing: draw a curve, add
jitter, check that the shape looks plausible. [The curve is the easy half](human-mouse-movement.md).
This page is about a failure mode one level up, found by measuring the feature on the
call scripts actually make rather than the one it's easiest to test with, and it
call scripts actually make instead of the one it's easiest to test with, and it
turned out the humanization had been validating itself against the wrong call the
whole time.
@@ -45,7 +45,7 @@ That is a teleport with two extra samples decorating it, not a human path.
## Why the hit-target check eats the movement
The mechanism is specific rather than mysterious. A hit-target check has to move the
The mechanism is specific, not mysterious. A hit-target check has to move the
pointer onto the target before it can confirm the target is really there. If the
humanized path is generated *inside* that same step, the check consumes the distance
first, and the path that runs afterward has almost nothing left to cover. The stroke
@@ -16,7 +16,7 @@ and its neighbours is real, it is worth doing, and it is also the cheapest thing
detector checks. The durable tells are not values you can redefine from a page
script. They are outputs a real machine produces and a script cannot: what the
engine actually renders, what it can actually decrypt, how a pointer actually moves.
Building toward that from the start, rather than patching properties after a block
Building toward that from the start, not patching properties after a block
shows up, is the difference this page is about.
This page is written for before you launch a session, not after one gets blocked. If
@@ -43,14 +43,14 @@ ceiling:
[The full breakdown of what each level can and cannot reach is
here](playwright-stealth-levels.md). The proactive move is to pick a level
deliberately, before you write a line of scraping code, rather than discovering the
deliberately, before you write a line of scraping code, not discovering the
ceiling of level 1 three weeks into a project when a site starts checking something
a page script cannot touch.
## Start from what a level-1 patch actually buys you
`navigator.webdriver` is the property everyone reaches for first, and it is worth
doing correctly rather than skipping. The naive version looks like this:
doing correctly instead of skipping. The naive version looks like this:
```python
from playwright.sync_api import sync_playwright
@@ -90,13 +90,13 @@ none of them are JavaScript properties:
- **The behaviour.** How the pointer moves, how a form gets filled, whether the page
is ever scrolled.
This is the argument for moving down a level rather than writing a longer init
This is the argument for moving down a level instead of writing a longer init
script. A property can be redefined by anyone with a console. An output has to be
produced by something that actually has the capability being tested.
## The capability check a Playwright property patch cannot pass
A capability check asks the browser to do something rather than report something,
A capability check asks the browser to do something, not report something,
which is why a page-level patch cannot pass one. Here is a concrete version you can
run yourself against whatever Playwright launches today.
@@ -124,7 +124,7 @@ with sync_playwright() as p:
On a default managed Chromium this prints `no`. Setting the user agent to claim
Chrome does not change the answer, because the missing piece is a DRM module, not a
string. [The full argument, including why this is a capability rather than a
string. [The full argument, including why this is a capability, not a
value and what closes it, is here](chromium-is-not-chrome.md). No `add_init_script`
reaches this, because there is no property to redefine. The module either exists in
the binary or it does not.
+1 -1
View File
@@ -95,7 +95,7 @@ with InvisiblePlaywright(seed=42) as browser:
```
Two habits worth keeping. Build the destination name from
`suggested_filename` rather than from link text, and always assert a non-zero
`suggested_filename`, not from link text, and always assert a non-zero
size afterwards. An empty file that saved without raising is the download
equivalent of a page that came back blank: it did not error, and it is still a
failure.
@@ -51,7 +51,7 @@ that happens to be all furniture and no article.
## Render first: wait for the body, then take page.content()
The fix has two halves. Let the page finish rendering, then hand the *rendered*
HTML to the extractor rather than the initial response.
HTML to the extractor instead of the initial response.
[`page.content()`](https://playwright.dev/python/docs/api/class-page#page-content)
serialises the live DOM as it stands now, after scripts have run and injected
@@ -146,7 +146,7 @@ reading it *after* the body was injected.
## Why a real engine sees paragraphs an HTTP fetch never receives
There is a reason this recipe uses a browser at all rather than `requests` plus
There is a reason this recipe uses a browser at all, not `requests` plus
readability. The clean-extraction problem and the not-getting-blocked problem
share a root cause, and it is worth being explicit about.
@@ -168,7 +168,7 @@ wearing two hats.
This is where a consistent, real-looking fingerprint earns its place. Because
`InvisiblePlaywright` derives every surface - GPU, canvas, audio, fonts, screen
- from one seed, `seed=42` gets you the same coherent machine on every run, so
the same full article is served each time rather than the article once and a
the same full article is served each time instead of the article once and a
stripped variant the next. That reproducibility is also what makes a broken
extraction debuggable: a failing run replays exactly instead of vanishing into
the next random draw. The general version of "get the real page, not the bot
@@ -187,7 +187,7 @@ Three cheap checks catch most of the failures:
- **Byline and headline survived.** These often sit in their own elements
outside the main content block, and readability drops them more often than it
drops paragraphs. If you need the author, extract it separately rather than
drops paragraphs. If you need the author, extract it separately instead of
hoping the summary kept it.
- **It did not truncate at an inline widget.** A pull-quote, an embedded video,
a subscribe box or a mid-article "related" card can look like the end of the
@@ -14,7 +14,7 @@ To extract JSON-LD structured data with Playwright, select every
`all_text_contents()`, and `json.loads` it; then flatten any `@graph` array and filter
by `@type` instead of trusting document order. It is less fragile than chasing CSS
selectors, and an empty result is a useful signal that you were handed a blocked or
simplified page rather than the real one.
simplified page instead of the real one.
Most scraping guides teach you to chase CSS selectors down through a layout that
changes the week after you ship. There is often a cleaner record sitting on the same
@@ -48,7 +48,7 @@ The difference in practice:
A class name changes, a wrapper `div` moves, a component re-renders with different
attributes, and your selector-based extractor breaks. The JSON-LD block is a contract
with search engines, so it changes far less often and, when it does, it changes in a
documented shape rather than an arbitrary one.
documented shape, not an arbitrary one.
The one thing to know before you start: a page can carry several blocks of different
`@type`, and they can be nested inside a `@graph` array. You cannot take the first
@@ -90,10 +90,10 @@ with InvisiblePlaywright(seed=42) as browser:
```
`all_text_contents()` returns the text of every matching `<script>` tag, so you get
all of them in one call rather than looping locators by hand. `json.loads` turns each
all of them in one call instead of looping locators by hand. `json.loads` turns each
into a Python object. The `seed=42` gives you a reproducible identity so that if one
run gets the block and another does not, you can replay the exact same browser and
find out why rather than blaming the random draw.
find out why instead of blaming the random draw.
## Filter by @type, and walk the @graph
@@ -22,7 +22,7 @@ links, a tenth of the pages return an empty dict, and a few come back looking pe
from a page that never actually loaded for you.
This page is the four things that turn that one-liner into something you can trust:
where the tags really live, why you must read the rendered head rather than the first
where the tags really live, why you must read the rendered head instead of the first
response, how to resolve a relative `og:image`, and the fallback chain to use when a
key is simply absent. It ends on one honest caveat that is specific to running against
sites that would rather you did not.
@@ -63,7 +63,7 @@ The engine's mouse model handles per-action realism, not request cadence, so it
rate limit your loop for you. It is worth being precise about what the engine already does,
because it covers one behaviour signal and not the other.
Every click arcs the pointer to the target along a Bezier curve rather than teleporting to
Every click arcs the pointer to the target along a Bezier curve instead of teleporting to
the coordinate, which adds a realistic, variable latency to each action and is
[movement that is produced rather than declared](human-mouse-movement.md). That defeats
the pointer-teleport tell inside a page.
@@ -68,7 +68,7 @@ That matters for reading a benchmark because a table that lists five tools as fi
independent data points, when three of them share a code ancestor or the same underlying
CDP quirks, is reporting less independent evidence than it looks like it's reporting.
Three rows agreeing is weaker evidence than it appears if the three rows are close
cousins rather than three separate engineering efforts arriving at the same answer.
cousins, not three separate engineering efforts arriving at the same answer.
## What a trustworthy report actually looks like, with a real example
@@ -11,7 +11,7 @@ nav_order: 74
To resume an interrupted Playwright scrape, write a small durable checkpoint after each
unit of work, then on restart skip the work already done, re-validate the boundary item,
and relaunch with the same seed so the site sees one returning visitor rather than a new
and relaunch with the same seed so the site sees one returning visitor instead of a new
one. Stock Playwright gives you the checkpoint and the resume path; a seeded fingerprint
keeps the resumed run continuous.
@@ -26,7 +26,7 @@ There is a second failure most guides miss. If every restart launches a fresh br
identity, the site does not see one job that hiccuped. It sees a new visitor appear each
time the job restarts, which is a pattern in its own right. The fix for that is the same
lever this project uses everywhere: a seeded, reproducible fingerprint, so a resumed run
is the same visitor coming back rather than a new one arriving.
is the same visitor coming back, not a new one arriving.
## Why a naive restart is the worst of both options
@@ -53,7 +53,7 @@ a paginated crawl it is the last page number and the last item ID on it. For a c
it is the cursor token the server handed you. For a list of URLs it is the set of URLs
already done.
Two rules make it durable rather than decorative. Write it incrementally, after each unit
Two rules make it durable, not decorative. Write it incrementally, after each unit
of work, not once at the end where a crash guarantees you never reach it. And write it
atomically, so a crash in the middle of writing the file cannot leave you with a
half-written checkpoint that is worse than none.
@@ -142,7 +142,7 @@ def run():
`done_ids` doing the dedup means the boundary page can be re-read safely: rows already
written are skipped by ID, so re-validating costs you a re-fetch and never a duplicate. For
larger runs, keep `done_ids` in a set-backed store (a SQLite table, a Redis set) rather than
larger runs, keep `done_ids` in a set-backed store (a SQLite table, a Redis set) in place of
a growing JSON array, but the shape is identical.
If a page fails transiently rather than fatally, resuming the whole process is the wrong
+3 -3
View File
@@ -29,7 +29,7 @@ mention it because their browser cannot fix it anyway.
Rotate the proxy once per browser session, not once per request: give one browser
launch one proxy and hold it for the whole visit, then close the session and start the
next one on a different proxy. This is the [sticky-session pattern rather than a
next one on a different proxy. This is the [sticky-session pattern instead of a
per-request rotating pool](sticky-vs-rotating-proxy-sessions.md), and for a browser it
is the correct default.
@@ -68,7 +68,7 @@ for i, proxy in enumerate(proxies):
Each iteration is a separate process, a separate seed, and a separate proxy. Each one
gets its own canvas hash, GPU string, font set and timezone, because those are derived
from the seed and the exit rather than left over from the previous session. That is
from the seed and the exit, not left over from the previous session. That is
also the property a shared-browser, proxy-per-context setup does not have: every
context in one browser reports the same hardware regardless of which proxy it is
tunneled through, which is exactly what
@@ -114,7 +114,7 @@ with InvisiblePlaywright(proxy=proxy) as browser:
```
A `socks5://` or `socks4://` server is written into the browser's own proxy
preferences, credentials included, rather than handed to Playwright's proxy layer
preferences, credentials included, not handed to Playwright's proxy layer
where the credentials are silently dropped. `http://` and `https://` servers go to
Playwright directly, because that is the path where its credential support is real.
The endpoint needs an explicit port; a bare host with no port is refused rather than
+4 -4
View File
@@ -9,7 +9,7 @@ nav_order: 63
# How to scrape a sitemap.xml with Playwright
To scrape a `sitemap.xml` with Playwright, treat it as a tree rather than a flat list: read
To scrape a `sitemap.xml` with Playwright, treat it as a tree instead of a flat list: read
the root element to tell a `<sitemapindex>` from a `<urlset>`, recurse into the child
sitemaps, decompress any `.xml.gz` leaves, and key each URL on its `<lastmod>` so later runs
recrawl only what changed. Fetch the whole tree through the browser context, because the file
@@ -56,7 +56,7 @@ A **sitemap index** is a table of contents whose `<loc>` values point at more si
The single most common way this code breaks is iterating a document as if it were a url set
when it is really an index. You get a list of `<loc>` values that look like URLs, you crawl
them, and every one is another XML file rather than a page. So the rule is: read the root
them, and every one is another XML file, not a page. So the rule is: read the root
element first and branch on it. Never assume the shape.
Child sitemaps are frequently gzip-compressed and served as `.xml.gz`, because an
@@ -75,7 +75,7 @@ driving, it returns the file.
So fetch it through the browser context.
[Playwright's request API](https://playwright.dev/python/docs/api/class-apirequestcontext) sends
the fetch through the same browser network stack, sharing its cookies, its proxy, and its
engine-level handshake, which is the whole point of using a patched engine rather than a
engine-level handshake, which is the whole point of using a patched engine instead of a
header generator. With `invisible_playwright` that browser is a real Firefox patched at the
C++ level and driven by stock Playwright, so switching to it is the launch line and nothing else:
@@ -99,7 +99,7 @@ def fetch_xml(page, url):
return ET.fromstring(raw)
```
`resp.body()` gives you the raw bytes rather than a decoded string, which matters because a
`resp.body()` gives you the raw bytes in place of a decoded string, which matters because a
`.xml.gz` leaf is not text yet. Checking the
[two-byte gzip magic](https://datatracker.ietf.org/doc/html/rfc1952) and calling
`gzip.decompress` handles the compressed case; a file the server already decompressed for you
@@ -92,7 +92,7 @@ raises nothing, because an empty string is a legal value for an empty element. A
forty panels finishes green, writes forty rows, and every row is blank.
That is why the guard above is not decoration. An empty panel means your assumption about
the page was wrong, and the run should stop and say so rather than fill a file with nothing.
the page was wrong, and the run should stop and say so, not fill a file with nothing.
## aria-expanded and aria-controls beat class names
@@ -12,7 +12,7 @@ nav_order: 100
To scrape appointment availability with Playwright, capture the calendar response the
page fetches for each week or month instead of reading the painted cells, key every row
to the provider, the service type and the location it was resolved for, stamp it in UTC
when the response lands, and stop at the grid rather than clicking a slot, because in
when the response lands, and stop at the grid instead of clicking a slot, because in
many systems selecting one places a hold that takes it away from every other visitor.
An appointment grid looks like a published schedule and behaves like contested
@@ -89,7 +89,7 @@ not comparable and the page often shows both:
row["rate_kind"] = header_for(column_index) # "APY", "APR", "AER", "nominal"
```
Take the label from the column header rather than assuming. Storing every percentage in a
Take the label from the column header instead of assuming. Storing every percentage in a
column called `rate` merges two different quantities, and the error is invisible until
someone compares a savings account to a loan and gets a sensible-looking answer.
@@ -106,7 +106,7 @@ Banks print an effective date, and it is the closest thing to a timestamp the da
Keep both, for the same reason as any live-status scrape: the page you fetched today may
be serving a rate table from last week, and the effective date is the only field that
reveals it. If the effective date has not moved in weeks while a central bank has, the
page is stale rather than the rates being unchanged.
page is stale, not the rates being unchanged.
## Products live behind a selector
@@ -13,7 +13,7 @@ To scrape business directory listings with Playwright, drive the search form for
location-and-category pair, wait for the results to render, un-obfuscate the contact fields,
and follow the site's own next control to walk the filtered pagination to its end. Run the
whole city-by-category matrix under one pinned identity so it reads as a single visitor
rather than a fleet of one-page strangers.
instead of a fleet of one-page strangers.
A business directory looks like a flat list and behaves like a nested loop. There is no
page you can request that returns every listing. There is a search form that wants a
@@ -41,7 +41,7 @@ for city in cities:
extract the listings on this page
```
That structure is why a directory is throttled by identity rather than by request rate
That structure is why a directory is throttled by identity, not by request rate
alone. A human browsing the plumbers in one city visits a handful of pages. A full sweep
visits every city crossed with every category, and every one of those is the same visitor
asking a slightly different question. If that visitor's fingerprint changes between the
@@ -50,7 +50,7 @@ watching a fleet of one-page strangers, which is a far cheaper thing to detect.
So the first design decision is to pin the identity for the whole sweep with a seed, and
only vary the exit address deliberately. A fixed seed also makes the crawl replayable: if
the extractor breaks on one category, you re-run the exact same browser rather than a new
the extractor breaks on one category, you re-run the exact same browser instead of a new
random one and get the same page back. That reproducibility is the whole reason
[this project derives every surface from one seed](quickstart.md).
@@ -70,7 +70,7 @@ with InvisiblePlaywright(seed=42) as browser:
page.wait_for_selector("[data-testid='listing-card']")
```
Waiting for a concrete element rather than a load event matters more here than on a static
Waiting for a concrete element instead of a load event matters more here than on a static
page, because the grid arrives after the document does. The difference between the load
events and why `networkidle` misleads on a feed like this is covered in [how to wait for a
page to load](how-to-wait-for-page-load-playwright.md); on a faceted search the honest
@@ -10,7 +10,7 @@ nav_order: 132
# How to scrape fitness class schedules with Playwright
To scrape fitness class schedules with Playwright, read each row into a natural key
of studio, class name, room and start time rather than trusting the row's own
of studio, class name, room and start time instead of trusting the row's own
occurrence id, fetch spots remaining and waitlist state from the separate endpoints
that actually carry them instead of the rendered grid, walk the calendar forward one
week per request because there is no week-agnostic feed, and stamp every pull with
@@ -37,7 +37,7 @@ two behave identically until you diff two weeks and every row looks new.
Do not build a pipeline that assumes the id survives. Build the key out of the facts
that describe the slot itself: studio, class name, room and the ISO start time
carries the schedule's meaning, and the occurrence id becomes metadata you store
alongside it rather than the thing you key on.
alongside it, not the thing you key on.
```python
from invisible_playwright import InvisiblePlaywright
@@ -67,7 +67,7 @@ timezone is several surfaces a detector cross-checks, not one value.
## Set the site's location the way a visitor does
Drive the site's location selector rather than injecting a value. The selector is usually
Drive the site's location selector instead of injecting a value. The selector is usually
a control that opens, takes a typed city, and offers a suggestion to click:
```python
@@ -87,7 +87,7 @@ a pointer that traveled to the control, which is
Once the feed is scoped, the cards are a repeating DOM structure and you read them in a
loop. Because the feed is infinite and rotates, treat "how many cards" as "how many you
scroll to", and dedupe on the listing's own id rather than on position, since positions
scroll to", and dedupe on the listing's own id, not on position, since positions
shift as new listings arrive:
```python
@@ -146,7 +146,7 @@ for listing in list(seen.values()):
```
That the click looks human is not a slogan here, it is the whole reason a patched engine
is doing the driving. The pointer travels to the control on a curved path rather than
is doing the driving. The pointer travels to the control on a curved path instead of
teleporting, which is [what human mouse movement means in practice](human-mouse-movement.md),
and the resulting event is trusted rather than synthetic. Space the reveals out. A hundred
reveal clicks a minute from one session is a velocity signal no fingerprint can launder.
@@ -13,9 +13,9 @@ To scrape clinical trial listings with Playwright, timestamp every status read s
status field decays between visits, carry both the registry's own identifier and any
international identifier the same trial carries in a different country's registry, keep
eligibility criteria as a list of text strings instead of parsed logic, store enrollment
as a target figure with its actual-or-anticipated label rather than a headcount, extract
as a target figure with its actual-or-anticipated label instead of a headcount, extract
one recruiting status per listed site instead of one per trial, and log the absence of a
results section as unreported rather than unfinished.
results section as unreported, not unfinished.
A trial listing reads like a fact sheet and behaves like several records glued onto one
page. The status line, the enrollment number, the site table and the results tab each
@@ -9,7 +9,7 @@ nav_order: 162
# How to scrape conference agendas with Playwright
To scrape an agenda, read the schedule as a **grid of tracks over time** rather than as a
To scrape an agenda, read the schedule as a **grid of tracks over time**, not as a
list of sessions, and resolve the timezone once for the whole event. A conference agenda
is one of the few web tables where position carries meaning: the column a session sits in
is its track, and the rows above and below it are what it clashes with.
@@ -63,7 +63,7 @@ both, because a redesign will switch between them.
## The timezone belongs to the event, not to you
Agendas print local times without zones almost universally. Resolve the event's zone once
and attach it, rather than letting each row inherit whatever your machine thinks:
and attach it, not letting each row inherit whatever your machine thinks:
```python
tz = page.eval_on_selector(
@@ -102,7 +102,7 @@ def session_detail(page, href):
}
```
Keep speakers as a list of objects rather than a joined string. A comma-separated field
Keep speakers as a list of objects instead of a joined string. A comma-separated field
looks fine until a name contains a comma, and academic affiliations contain commas
constantly.
@@ -128,7 +128,7 @@ same rule applies: click the control, wait for the content, do not guess a URL.
Schedules are edited constantly in the final weeks: rooms move, speakers cancel, sessions
swap slots. If the change history matters to you, keep each capture whole with its
timestamp rather than updating rows in place, and diff captures later. If it does not,
timestamp instead of updating rows in place, and diff captures later. If it does not,
a daily pass in the fortnight before the event, and one after it, is enough.
Either way this is a small site with a spiky audience, so keep to the pacing in
@@ -11,7 +11,7 @@ nav_order: 159
To scrape a permit portal, drive its **search form** and stay in the session it gives you.
These systems are almost always server-rendered enterprise software, where the results
page is a postback rather than a URL, page two is a form submission, and a link copied out
page is a postback instead of a URL, page two is a form submission, and a link copied out
of the browser returns a session-expired notice ten minutes later.
That single property decides the whole design. You cannot build a list of URLs and fetch
@@ -19,7 +19,7 @@ them in parallel. You drive one session in order, and you make it resumable, bec
run over a year of permits takes long enough that something will interrupt it.
This page covers filling the search the way the form expects, walking result pages that
only exist inside a session, and capturing a permit's status history rather than its
only exist inside a session, and capturing a permit's status history, not its
current state.
## Fill the search in the order the form expects
@@ -71,7 +71,7 @@ seconds or reads the previous page. The general shape is the one in
[scraping paginated pages](how-to-scrape-paginated-pages-playwright.md), with the extra
constraint that here you genuinely cannot skip ahead.
Narrow the query rather than paging deeply. Most portals cap results, often silently, at a
Narrow the query instead of paging deeply. Most portals cap results, often silently, at a
few hundred rows. A month at a time with an explicit row count check is more work and
returns the whole set:
@@ -9,7 +9,7 @@ nav_order: 94
# How to scrape course catalogs with Playwright
To scrape a course catalog with Playwright, treat it as a four-level tree rather than a
To scrape a course catalog with Playwright, treat it as a four-level tree instead of a
list of courses: walk department to course to section to meeting time, pin the term in
the query string so every request describes the same academic period, read seat counts
from the section endpoint instead of the rendered badge, and emit one row per section so
@@ -79,7 +79,7 @@ Put the term in the URL and never rely on the session:
page.goto(f"{base}/search?term={term}&subject={dept}", wait_until="domcontentloaded")
```
If the catalog keeps the term in a cookie or a POST body rather than the query string,
If the catalog keeps the term in a cookie or a POST body, not the query string,
set it once per context and assert it on every response before parsing. The assertion is
cheap and the alternative is a silently mixed dataset.
@@ -92,7 +92,7 @@ The green "Open" pill on the results page is a rendering of a number the page al
fetched. It is rounded, it is cached, and on many catalogs it stops updating once the
section closes. The underlying call carries the real integers.
Capture the response rather than the pixel:
Capture the response instead of the pixel:
```python
seats = {}
@@ -1,6 +1,6 @@
---
title: "How to scrape court docket listings with Playwright"
description: "Scrape public court dockets with Playwright: work case by case rather than by enumeration, capture the docket entries as an ordered record, and handle the documents that open in a viewer."
description: "Scrape public court dockets with Playwright: work case by case, not by enumeration, capture the docket entries as an ordered record, and handle the documents that open in a viewer."
parent: "Scraping with Playwright"
grand_parent: "Guides"
nav_order: 160
@@ -14,7 +14,7 @@ WebSocket and read each price from the frames it delivers, not from the DOM node
live ticker overwrites that node several times a second, so the value you read back is
stale the instant you have it. Handle the ranked market-cap table as a separate
scroll-and-collect job, and hold the connection open with a stable browser identity so
that a dropped-and-reconnected feed reads as one steady client rather than a churn of
that a dropped-and-reconnected feed reads as one steady client instead of a churn of
new devices.
Before writing a line of code, though: if the exchange or aggregator you are reading
@@ -26,8 +26,8 @@ and you have to get them out of a live browser without capturing garbage.
That case is harder than it looks, for a reason specific to prices: they do not sit
still. A crypto ticker updates many times a second over a persistent WebSocket, and
the number you see in the DOM is the tail end of a stream that has already moved on by
the time your `text_content()` call returns. This page is about reading the stream
rather than the tail, paging the market table as a separate job, and keeping the
the time your `text_content()` call returns. This page is about reading the stream,
not the tail, paging the market table as a separate job, and keeping the
connection alive long enough to matter.
## Why the DOM value is a race you lose
@@ -20,7 +20,7 @@ A date-picker looks like a form field and behaves like an application. The value
want is not in the DOM waiting to be read: it is behind a grid that shows one month at
a time, hides the target date until you page forward to its month, greys out the days
you are not allowed to pick, and commits the choice only when you click a rendered day
cell rather than typing into the box.
cell instead of typing into the box.
This page is the mechanics of driving one of those with stock Playwright: how to page
between months without losing the grid, how to tell an available cell from a disabled
@@ -66,7 +66,7 @@ The calendar shows one month. The date you want is some number of months ahead o
is currently displayed, so the first job is to read the visible month, compare it to the
target, and click the forward control the right number of times.
Read the header rather than counting clicks blindly, because the picker may open on the
Read the header instead of counting clicks blindly, because the picker may open on the
current month or on the last month the user touched, and you cannot assume a starting
point.
@@ -134,7 +134,7 @@ def available_day(page, day):
If `available_day` returns `None`, that is data, not a failure: for an availability
scrape, an unpickable day IS the answer for that date. Record it and move to the next
one rather than retrying.
one instead of retrying.
## Click to commit, and re-query after every render
@@ -12,7 +12,7 @@ nav_order: 52
To scrape deals and coupon codes with Playwright, drive a real browser that fires a trusted
click on each card's reveal button, then capture the code from wherever the click sends it
(a new tab, the clipboard, or an XHR response) and read expiry from the card's data
attribute rather than the ticking countdown text. A scripted `dispatchEvent` click is
attribute instead of the ticking countdown text. A scripted `dispatchEvent` click is
untrusted and a reveal guarded by a bot check returns nothing.
Deal and coupon pages look like the easiest scrape on the web: a grid of cards, each with
@@ -69,7 +69,7 @@ with InvisiblePlaywright(seed=42) as browser:
`page.click()` here drives Firefox through its native input path, so the reveal receives
an event with `isTrusted` set to true and the correct pointer sequence in front of it. The
mouse also arcs to the button on a curve rather than teleporting, which is the difference
mouse also arcs to the button on a curve instead of teleporting, which is the difference
between a reveal that fires and one that silently no-ops. Nothing about the code below is
wrapper-specific API: it is ordinary Playwright, which is the point.
@@ -173,13 +173,13 @@ def read_expiry(card):
return None # only fall back to parsing text if no attribute exists
```
Reading the attribute rather than the rendered text gives you the same value on every run
Reading the attribute instead of the rendered text gives you the same value on every run
of the same seed, which is what makes a scrape you can diff against yesterday's.
## Page the grid without a mechanical scroll
Deal grids scroll infinitely: more cards load as you reach the bottom, and there is no page
2 to request. Scroll, wait for the card count to actually grow rather than sleeping a fixed
2 to request. Scroll, wait for the card count to actually grow instead of sleeping a fixed
interval, and stop when it stops growing.
```python
@@ -51,7 +51,7 @@ row = {
```
Those first three fields are part of what the row asserts. Without them, two readings
taken an hour apart describe two different questions rather than a change in
taken an hour apart describe two different questions instead of a change in
availability, and the series you build on top of them measures your own inputs.
## Read the grid response, not the rendered cells
@@ -11,7 +11,7 @@ nav_order: 140
To scrape domain WHOIS records with Playwright, read the record page as labeled
key-value lines instead of fixed positions, treat REDACTED FOR PRIVACY as a real
value rather than a missing field, keep the raw EPP status code instead of
value instead of a missing field, keep the raw EPP status code instead of
paraphrasing it, bind creation, expiry and updated dates to their own labels, flag
records that describe a privacy proxy instead of the actual registrant, and pace
each lookup by whole seconds because the query itself, not the page around it, is
@@ -89,7 +89,7 @@ with InvisiblePlaywright(seed=42) as browser:
```
Repeated labels, `Domain Status` and `Name Server` almost always appear more than
once, collapse into a list rather than overwriting the earlier value. Everything
once, collapse into a list instead of overwriting the earlier value. Everything
downstream reads from `record` by name, never by an index into the raw text.
## REDACTED FOR PRIVACY is a value, not a missing field
@@ -149,7 +149,7 @@ next. There is no single schema to assume.
Normalize before doing anything with the values: map the label variants you have
actually seen onto a small set of canonical keys, and try each known date format
in turn rather than committing to one.
in turn instead of committing to one.
```python
from datetime import datetime
@@ -204,7 +204,7 @@ def canonical_statuses(record):
```
A domain frequently carries two or three statuses at once, so keep the result as
a list rather than collapsing it to a single value.
a list instead of collapsing it to a single value.
## Bind creation, expiry and updated dates to their own labels
@@ -264,9 +264,9 @@ def scrape_domains(domains, seed=42):
return rows
```
Treat a rate-limit response as a hard stop rather than something to retry right
Treat a rate-limit response as a hard stop, not something to retry right
away. Most lookup services signal it with a specific error string, a blank
result, or a captcha page rather than an HTTP error code, and hammering past that
result, or a captcha page, not an HTTP error code, and hammering past that
signal tends to extend the block instead of working around it.
## Conclusion
@@ -296,7 +296,7 @@ value, distinct from a field the registry's format never includes at all.
**The registrant email looks like a company, not a person. Why?** The domain
likely routes through a privacy or proxy service, and the fields you are reading
describe that service, not the actual owner. Flag records like this rather than
describe that service, not the actual owner. Flag records like this instead of
trusting the contact details at face value.
**Can I paraphrase a domain status code to make it more readable?** No. EPP
@@ -63,7 +63,7 @@ There are three places a product number can live, and they are not equally trust
## Select the variant and wait for the price XHR
Playwright gives you the request directly. Wrap the click or the select in
`page.expect_response`, and you get the actual offers payload rather than whatever the
`page.expect_response`, and you get the actual offers payload, not whatever the
DOM happened to show a moment later. The wrapper is a drop-in for stock Playwright, so
`browser` below is a real Playwright `Browser` and every method is the one you already
know.
@@ -93,7 +93,7 @@ DOM node you have to trust. If you would rather subscribe to responses across a
session instead of one at a time, [capturing XHR and API responses in Playwright](how-to-capture-xhr-api-responses-playwright.md)
covers the listener form.
If the base price is what you are after and it is painted after load rather than behind
If the base price is what you are after and it is painted after load, not behind
a variant click, wait for the value to appear instead of guessing at a delay. Blind
`sleep` calls are the classic flake here, and [waiting for the page to actually finish
loading](how-to-wait-for-page-load-playwright.md) has the specific predicates.
@@ -112,7 +112,7 @@ Most storefronts also embed a `application/ld+json` block describing the product
search engines. It is a structured, documented format, and it is the cheapest
cross-check you have against the number you scraped from the offers XHR. When the two
agree you are confident; when they disagree you have learned something real about the
page rather than shipping a wrong number silently.
page instead of shipping a wrong number silently.
```python
import json
@@ -116,7 +116,7 @@ requires personal details and creates a real commercial transaction. That bounda
stating plainly: reading a quote is scraping, and submitting a switch is entering a
contract on behalf of a person.
Stay on the public side, keep runs to a handful of profiles rather than a sweep of every
Stay on the public side, keep runs to a handful of profiles instead of a sweep of every
postcode, and follow the pacing in
[rate limiting your own scraper](how-to-scrape-without-getting-blocked.md). A comparison
engine runs a real pricing computation per query, so each request costs the operator
@@ -1,6 +1,6 @@
---
title: "How to scrape EV charging availability with Playwright"
description: "Scrape EV charger availability with Playwright: capture the live status feed the map is drawing from, record a timestamp with every reading, and treat availability as a measurement rather than a fact."
description: "Scrape EV charger availability with Playwright: capture the live status feed the map is drawing from, record a timestamp with every reading, and treat availability as a measurement instead of a fact."
parent: "Scraping with Playwright"
grand_parent: "Guides"
nav_order: 151
@@ -9,8 +9,8 @@ nav_order: 151
# How to scrape EV charging availability with Playwright
To scrape charger availability, capture the **status feed** the map is drawing from
rather than the map, and stamp every reading with the time you took it. Availability is
To scrape charger availability, capture the **status feed** the map is drawing from,
not the map, and stamp every reading with the time you took it. Availability is
not an attribute of a charging point. It is a measurement that was true for a few
seconds, and a row without a timestamp is a claim you cannot check later.
@@ -97,7 +97,7 @@ row["reported_at"] = station.get("last_updated") # when the network last kne
Keep both. A connector reported as available with a `last_updated` from six hours ago is
a different fact from one updated forty seconds ago, and collapsing them into a single
"available" is how a dataset becomes confidently wrong. When the operator gives you no
`last_updated` at all, record that absence rather than substituting your own time.
`last_updated` at all, record that absence instead of substituting your own time.
## Poll on the data's clock, not on yours
@@ -117,7 +117,7 @@ def changed(row):
return True
```
Write the transitions rather than the polls. The result is a state history you can
Write the transitions in place of the polls. The result is a state history you can
replay, at a fraction of the rows, and it survives a gap in collection better than a
dense series with holes in it.
@@ -12,7 +12,7 @@ nav_order: 42
To scrape event and ticket listings with Playwright, wait for the availability request
instead of the initial HTML, attach each event's declared source timezone and store UTC
alongside it, step the calendar widget to reach future dates, and poll the state attribute
rather than the visible label. The one thing that decides whether any of it runs is that
instead of the visible label. The one thing that decides whether any of it runs is that
the browser's timezone matches the proxy's exit IP.
| What trips up an event scraper | The fix |
@@ -10,7 +10,7 @@ nav_order: 108
# How to scrape currency exchange rates with Playwright
**To scrape currency exchange rates with Playwright, capture the quote response the
widget already fetches rather than reading the number it paints, and write a row
widget already fetches instead of reading the number it paints, and write a row
carrying the base code, the quote code, the side, the amount and a UTC arrival
timestamp, because a bare "1.08" names one currency out of two, states no direction and
hides which side of the spread produced it.**
@@ -184,7 +184,7 @@ store because it is easiest to reach.
The three that matter are ordered. The feed's own `quoted_utc` is when the price was
made, and it is the only one that belongs on a time axis. The HTTP `Date` header is the
server clock at response time, at one second of resolution, so it brackets rather than
server clock at response time, at one second of resolution, so it brackets, not
measures. Your arrival stamp is when the bytes reached the browser, and it is the only
one you can always produce.
@@ -10,7 +10,7 @@ nav_order: 135
# How to scrape museum and gallery exhibition dates with Playwright
To scrape museum and gallery exhibition dates with Playwright, read the run as a range
rather than a point: pull `startDate` and `endDate` from the page's own Event node instead
instead of a point: pull `startDate` and `endDate` from the page's own Event node instead
of a single displayed date, key each run by the pair of exhibition and venue so a touring
show does not collapse into one row, store a last-checked timestamp so a moved close date
reads as an extension instead of an error, and keep a timed-entry booking widget's slot
@@ -1,6 +1,6 @@
---
title: "How to scrape ferry schedules with Playwright"
description: "Scrape ferry timetables with Playwright: query by date because sailings are seasonal, keep the route direction as part of the key, and record cancellations as data rather than as missing rows."
description: "Scrape ferry timetables with Playwright: query by date because sailings are seasonal, keep the route direction as part of the key, and record cancellations as data, not as missing rows."
parent: "Scraping with Playwright"
grand_parent: "Guides"
nav_order: 153
@@ -9,9 +9,9 @@ nav_order: 153
# How to scrape ferry schedules with Playwright
To scrape a ferry timetable, query it **date by date** rather than pulling a published
To scrape a ferry timetable, query it **date by date** instead of pulling a published
schedule page, keep the direction in the key, and treat a sailing that disappears as an
event rather than as an absence. Ferry schedules are seasonal, weather-dependent and
event, not as an absence. Ferry schedules are seasonal, weather-dependent and
frequently amended, which makes them one of the few timetable types where yesterday's
capture genuinely does not describe today.
@@ -9,8 +9,8 @@ nav_order: 30
# How to scrape flight prices with Playwright
To scrape flight prices with Playwright, wait for the search to report itself complete
rather than for the page to load or the network to go idle, then read the settled fare
To scrape flight prices with Playwright, wait for the search to report itself complete,
not for the page to load or the network to go idle, then read the settled fare
matrix in one pass. Because a fare scan is many searches, run every one of them as the
same seeded browser, so the endpoint feeding the fares sees one consistent device rather
than a new machine each time.
@@ -20,7 +20,7 @@ submit an origin, a destination and a pair of dates, the navigation settles, and
page is empty. Nothing you wanted is in the DOM yet. The fares are still arriving.
This page is about that gap: why the results stream in after the page has finished
loading, how to detect the moment they are actually complete rather than the moment the
loading, how to detect the moment they are actually complete, not the moment the
network went briefly quiet, and how to run a whole scan of dates without every search
looking like a different device to the endpoint that is feeding you the fares.
@@ -59,7 +59,7 @@ The reliable approach is to watch the responses the search itself produces and w
the one that says it is finished. Capturing those responses is the same technique used
for any streamed API, covered in
[how to capture XHR and API responses](how-to-capture-xhr-api-responses-playwright.md);
here you use it to find the terminal message rather than to read the data.
here you use it to find the terminal message, not to read the data.
```python
from invisible_playwright import InvisiblePlaywright
@@ -149,7 +149,7 @@ as waiting on load, one layer up.
## Running a whole fare scan without looking like a new device each time
Pin one seed for the entire scan and every search derives the same browser identity, so
the whole run looks like one consistent device rather than a new machine on each request.
the whole run looks like one consistent device in place of a new machine on each request.
A single search is rarely the goal: you want a fortnight of departure dates, or the same
route priced every morning, which is dozens or hundreds of searches. This is where the
browser you run the scan with starts to matter as much as the waits.
@@ -102,7 +102,7 @@ same number at the same airport. Service day belongs in the key because a flight
scheduled at 23:50 and departing at 00:40 exists on two calendar days, and the board will
show it under one of them in a way you do not control.
Store status transitions rather than the last value:
Store status transitions instead of the last value:
```python
if previous.get(key, {}).get("status") != row["status"]:
+4 -4
View File
@@ -20,7 +20,7 @@ and nothing in the captured row records which location produced it. The data loo
noisy. It is not noisy, it is unlabelled.
This page covers pinning the location, reading a price table that mixes grades and
units, and handling the fact that many of these prices are crowd-reported rather than
units, and handling the fact that many of these prices are crowd-reported, not
observed.
## Set the place before you read the price
@@ -41,7 +41,7 @@ with InvisiblePlaywright(seed=42) as browser:
page.wait_for_selector(".station-list .station")
```
Type into the field rather than setting its value. Location inputs are usually
Type into the field instead of setting its value. Location inputs are usually
autocomplete widgets that only commit on a real key sequence, and a value written
directly leaves the widget's internal state empty, so the search runs against nothing.
The same pattern applies to any
@@ -121,7 +121,7 @@ of source you are reading, per station, because a single site can carry both.
## Walking a region without hammering the search
To cover an area, iterate over places rather than paginating a single huge result set:
To cover an area, iterate over places instead of paginating a single huge result set:
```python
for place in ["Bristol", "Bath", "Weston-super-Mare"]:
@@ -136,7 +136,7 @@ indication that anything was dropped, so a national sweep with three requests re
confident subset. If you do use radius, look for a total count in the response and check
it against the number of rows you received.
Keep the pace conservative and the run scheduled rather than continuous. Prices move a
Keep the pace conservative and the run scheduled, not continuous. Prices move a
few times a day at most, so a poll loop buys nothing and costs the goodwill described in
[scraping without getting blocked](how-to-scrape-without-getting-blocked.md).
@@ -83,7 +83,7 @@ with InvisiblePlaywright(seed=42) as browser:
Two details matter more than they look. First, click the calendar days, do not type into
a read-only date input: many pickers ignore a value you set directly and only commit the
range on a real click, so a typed date produces a search that silently uses today. Second,
the mouse arriving at each day on a curved path rather than teleporting is not decoration
the mouse arriving at each day on a curved path instead of teleporting is not decoration
here. A rate scan fires the same occupancy widget dozens of times in a session, and a
control that is always clicked at the exact same pixel with zero travel between clicks is
one of the cheapest interaction signals a site can watch for.
@@ -117,7 +117,7 @@ Arming [`expect_response`](https://playwright.dev/python/docs/api/class-page#pag
you click first and wait second, the response can arrive in the gap and you wait forever.
Keying the predicate on both the URL fragment and `status == 200` matters too, because a
rate call that comes back empty or with a non-200 is exactly the failure mode the next
section is about, and you want to see it as a failure rather than silently read an empty
section is about, and you want to see it as a failure, not silently read an empty
body. For the general version of this timing problem, see [how to wait for the right
signal instead of a fixed delay](how-to-wait-for-page-load-playwright.md).
@@ -63,8 +63,8 @@ with InvisiblePlaywright(seed=42) as browser:
# `browser` is a real Playwright Browser; every documented method works.
```
The `seed=42` fixes the identity so a run that fails on one tile can be replayed exactly
rather than guessed at. See the [quickstart](quickstart.md) for what the seed pins.
The `seed=42` fixes the identity so a run that fails on one tile can be replayed exactly,
not guessed at. See the [quickstart](quickstart.md) for what the seed pins.
## Trigger the lazy-load by scrolling each tile into view
@@ -113,7 +113,7 @@ def promote_tile(page, handle):
## Resolve the highest-resolution srcset candidate
Once a tile is real, you often have a choice rather than a URL. A
Once a tile is real, you often have a choice, not a URL. A
[`srcset`](https://html.spec.whatwg.org/multipage/images.html) is a list of `url
widthDescriptor` pairs, and the browser picks one for its layout, which is not the one
you want. You want the largest. Parse the attribute yourself and take the widest
@@ -159,7 +159,7 @@ the asset behind the lightbox. That larger asset is the next step.
The grid rarely holds the full image. Clicking a tile opens a lightbox or detail view
that loads a bigger asset, and that is the one worth keeping. Click, wait for the larger
image to appear, and read its resolved URL from the live element rather than the markup:
image to appear, and read its resolved URL from the live element instead of the markup:
```python
def full_res_url(page, tile_selector):
@@ -15,7 +15,7 @@ on the next one, because a fixed sleep is a guess about a network and a render p
you do not control.
This page is the loop that does not guess: how to wait for content to actually arrive,
how to know when the page is really done rather than just slow, how to dedupe what you
how to know when the page is really done, not just slow, how to dedupe what you
collect, and the part generic scroll tutorials skip entirely - a perfectly mechanical
scroll loop is itself something a page can notice, and the block that shows up minutes
into a session is usually that, not your fingerprint.
@@ -119,7 +119,7 @@ exists.
## Deduplicating items across scrolls
Scroll-and-collect naturally re-reads items you already have, because the DOM keeps
everything loaded so far rather than replacing it. Track what you have already recorded
everything loaded so far instead of replacing it. Track what you have already recorded
by a stable identifier, not by position:
```python
@@ -142,7 +142,7 @@ def harvest(page):
})
```
Call `harvest(page)` after each successful growth round rather than only once at the end.
Call `harvest(page)` after each successful growth round, not only once at the end.
Two reasons: it lets you inspect progress while the loop still runs, and it means a crash
or a block partway through still leaves you with everything collected up to that point
instead of nothing.
@@ -163,7 +163,7 @@ read anything, and fires at a rate no human scrolling with a mouse or trackpad p
that is a behavioral signature, and it is a different layer entirely from the fingerprint.
[The checklist for one-site detection](playwright-detected-as-bot.md) puts behavior at
step five for a reason: blocks that arrive **after an interaction**, minutes into a
session rather than at the first request, are usually this rather than anything about the
session, not at the first request, are usually this, not anything about the
browser's reported GPU or fonts. A perfectly consistent fingerprint does not help if the
scrolling pattern on top of it is the part that stood out.
@@ -177,7 +177,7 @@ looked fine to a check that was only watching for an exception.
The fix is the same one this project applies to pointer movement: vary the motion instead
of repeating it, and derive the variation from a seed so a run that misbehaves can be
replayed rather than re-guessed.
replayed, not re-guessed.
```python
import random
@@ -197,14 +197,14 @@ with sf as browser:
That pause is not the thing telling you content arrived - `wait_for_function` still is,
exactly as before. It only changes how long the loop dwells between wheel events, so the
gaps look like a device scrolling rather than a timer firing at a fixed interval. Wire
gaps look like a device scrolling instead of a timer firing at a fixed interval. Wire
`human_scroll_step` in as the scroll action inside `scroll_until_stable` and the growth
check around it does not change at all.
The same idea already ships for clicks and hovers: [humanized mouse
movement](human-mouse-movement.md) is on by default in this project, driven from the same
per-session seed, so the arc to a button and the pacing of a scroll come from one
consistent identity rather than two unrelated randomizers. Bezier curves get the pointer
consistent identity, not two unrelated randomizers. Bezier curves get the pointer
path right; what actually gets read on a scroll loop is closer to timing than shape, since
a wheel event does not carry the same rich field set a pointer move does - but a constant
interval is exactly as loud as a teleporting cursor, and for the same reason.
@@ -238,7 +238,7 @@ a bug.
An infinite-scroll loop that works on every page you throw it at waits for the DOM to
actually grow and for the network to actually settle, stops on a streak of flat rounds
rather than one, and keys its dedup on an identifier rather than position. None of that
instead of one, and keys its dedup on an identifier, not position. None of that
is specific to this project; it is just Playwright used the way its own waiting primitives
are meant to be used.
@@ -10,7 +10,7 @@ nav_order: 26
# How to scrape job postings with Playwright
To scrape job postings with Playwright, drive the board's faceted search controls instead
of walking URLs, wait for the specific results XHR rather than for `networkidle`, and read
of walking URLs, wait for the specific results XHR, not for `networkidle`, and read
each posting from its `JobPosting` JSON-LD instead of brittle card selectors. Run the whole
sweep under one stable browser identity so the board sees a returning visitor, and pace it
so the request volume does not give you away.
@@ -151,7 +151,7 @@ The `complete && naturalWidth > 0` check is the important part. `scroll_into_vie
returns as soon as the element is positioned, which is before the observer has swapped the
URL and long before the image has decoded. Reading `src` on the line after the scroll gets
you the placeholder again. Waiting on `naturalWidth` asserts a positive fact, that a real
image with real dimensions is present, rather than the absence of an error.
image with real dimensions is present, not the absence of an error.
If the gallery itself grows as you scroll, this is really two problems stacked, and the
lazy-image read has to run inside the
@@ -1,6 +1,6 @@
---
title: "How to scrape library catalog availability with Playwright"
description: "Scrape library catalogue availability with Playwright: read holdings per branch rather than per title, keep the loan status vocabulary the catalogue uses, and handle the session the OPAC hands you."
description: "Scrape library catalogue availability with Playwright: read holdings per branch, not per title, keep the loan status vocabulary the catalogue uses, and handle the session the OPAC hands you."
parent: "Scraping with Playwright"
grand_parent: "Guides"
nav_order: 154
@@ -19,7 +19,7 @@ run creates server-side state, results are addressed by a token that expires, an
copied from one run frequently returns an empty result set in the next. Scraping them by
saving result URLs produces a script that works once.
This page covers driving the search rather than replaying URLs, reading holdings per
This page covers driving the search instead of replaying URLs, reading holdings per
copy, and keeping the catalogue's own status words instead of flattening them to a
boolean.
@@ -54,7 +54,7 @@ token is still the one the server issued you.
## Holdings are per copy, per branch
Open a record and read the holdings table rather than the availability badge:
Open a record and read the holdings table instead of the availability badge:
```python
def holdings(page):
@@ -10,7 +10,7 @@ nav_order: 139
# How to scrape live sports scores with Playwright
To scrape live sports scores with Playwright, treat the score as one field inside a
larger, time-stamped update rather than a number you read off the page: capture match
larger, time-stamped update instead of a number you read off the page: capture match
state alongside the score so a 0-0 reading means something, timestamp each update against
the feed's own clock instead of your scrape time, allow the score to decrease after a
video review instead of rejecting it as bad data, and match commentary events to the
@@ -23,7 +23,7 @@ This is a narrower problem than reading a scoreboard once or pulling post-match
covers reading the feed transport itself, switching parsers between live and finished
formats, and holding a long session without tripping a rate check. This page assumes you
have already solved that part and asks the harder question underneath it: once you are
receiving updates, what makes an in-play score reading correct rather than merely recent.
receiving updates, what makes an in-play score reading correct, not merely recent.
## Why a live score is a moving target, not a snapshot
@@ -184,7 +184,7 @@ it were a real overturned goal.
## Match commentary events to their own clock, not your scrape time
Goals, cards and substitutions usually arrive on a separate timestamped stream from the
scoreboard number itself, an event feed rather than the score endpoint. Each event
scoreboard number itself, an event feed instead of the score endpoint. Each event
carries its own minute, and that minute is what ties it to the score, not whatever time
your scraper happened to read either stream.
@@ -10,7 +10,7 @@ nav_order: 107
# How to scrape multi-select facet filters with Playwright
To scrape multi-select facet filters with Playwright, expand every "show more" control
before reading a group, wait for the facet response rather than for the URL to change,
before reading a group, wait for the facet response, not for the URL to change,
write the resulting URL into every row you store, and crawl one facet group at a time
against the unfiltered base instead of enumerating combinations, then reconcile each group
against the base total.
@@ -102,7 +102,7 @@ from "this site has no such value" from "it was behind a show-more you did not e
Absence is not evidence, and a coverage report built on it will claim gaps that are
artifacts of the read.
Read the flag explicitly rather than asking whether the row is clickable. A `disabled`
Read the flag explicitly instead of asking whether the row is clickable. A `disabled`
attribute on a `<li>` or an `<a>` is ignored by the browser, since only native controls
like `input` and `button` can be disabled that way, so such a row stays clickable. What
means something is `aria-disabled` on the row and the `disabled` property on the input
@@ -117,7 +117,7 @@ with the new state's URL: every row looks plausible and the whole table is shift
Wait on the response instead, and better still read it, since the payload usually carries
the new counts and skipping the DOM removes the repaint race completely. Capturing the
request rather than the repainted markup is a habit worth having generally, and
request instead of the repainted markup is a habit worth having generally, and
[capturing XHR and API responses](how-to-capture-xhr-api-responses-playwright.md) covers
the hooks.
@@ -247,7 +247,7 @@ def reconcile(rows, base_total):
Here is where the approach stops helping. One group at a time gives marginals, never the
joint distribution, so "how many blue and large" needs that exact state visited. Pairs are
quadratic and usually affordable, triples usually are not, so pick the pairs you need
rather than generating them. A capped result set forces the same targeted split, and the
instead of generating them. A capped result set forces the same targeted split, and the
[paginated pages](how-to-scrape-paginated-pages-playwright.md) mechanics apply to each
slice unchanged.
@@ -12,7 +12,7 @@ nav_order: 129
To scrape newsletter archives with Playwright, page through the archive index until a
page comes back empty or its first item repeats the item from the page before, since
these archives almost never print a total to stop at, read each issue from the hosted
rendering the archive actually serves rather than assuming it matches what a subscriber
rendering the archive actually serves instead of assuming it matches what a subscriber
got by email, and treat the date shown on the archive as the date the issue was added to
that archive, not the date it was sent, until you confirm the two agree.
@@ -49,7 +49,7 @@ with InvisiblePlaywright(seed=42) as browser:
```
In practice one of `alt`, `aria-label`, a `data-` attribute or a visually hidden span
carries the digits. Check all of them rather than the first, because which one is used
carries the digits. Check all of them instead of the first, because which one is used
varies by framework and sometimes within a single page.
## Then check whether it is a sprite, not an image of a number
@@ -70,16 +70,16 @@ OFFSETS = """
Each distinct offset maps to one digit. Calibrate once on a page where you know the value
from elsewhere, build the offset-to-digit map, and every other page on that site decodes
exactly. This is more reliable than recognition because it is a lookup, and it breaks
loudly rather than silently when the site changes the sprite.
loudly, not silently when the site changes the sprite.
Be aware that the mapping is often deliberately shuffled per session or per page load, and
in that case it is a defence rather than an artefact. That distinction matters for what you
in that case it is a defence instead of an artefact. That distinction matters for what you
do next.
## Custom fonts with remapped glyphs
A third variant ships a font where the glyph for "7" draws a 3. The DOM text is then
misleading rather than absent: you read a number and it is wrong, with no error anywhere.
misleading, not absent: you read a number and it is wrong, with no error anywhere.
The tell is a page-specific `@font-face` with an obfuscated family name applied to exactly
the elements carrying figures. If you find one, the DOM text cannot be trusted for those
@@ -13,7 +13,7 @@ To scrape nutrition labels with Playwright, attach a basis to every number befor
store it: map each column header to per 100 g, per serving or per package, split the
serving size into a household measure and a metric one, keep kilojoules and kilocalories
in separate fields, preserve the less-than qualifier instead of parsing it to zero, and
record an image-only panel as unextractable rather than writing empty rows.
record an image-only panel as unextractable instead of writing empty rows.
A nutrition panel is a small grid, and reading the grid is the easy part. The hard part is
that almost every number on it means nothing on its own. `12` is not a fact. Twelve grams
@@ -36,7 +36,7 @@ serving size, which a scraper that dropped the basis has almost always dropped t
On a product page the panel is usually collapsed behind a "Nutrition" accordion or a tab,
so it sits in the DOM unrendered, or it does not exist until the header is clicked.
[Scraping accordion and tab content](how-to-scrape-accordion-and-tab-content-playwright.md)
covers opening it and waiting for the panel rather than for the click.
covers opening it and waiting for the panel, not for the click.
The basis lives in the header row and never in the cell. Read the header first, classify
each column, and refuse the panel when nothing classifies. Refusing is the useful
@@ -1,6 +1,6 @@
---
title: "How to scrape package tracking status with Playwright"
description: "Scrape parcel tracking with Playwright: capture the event timeline rather than the headline status, keep the carrier's own wording, and poll on the shipment's clock instead of yours."
description: "Scrape parcel tracking with Playwright: capture the event timeline instead of the headline status, keep the carrier's own wording, and poll on the shipment's clock instead of yours."
parent: "Scraping with Playwright"
grand_parent: "Guides"
nav_order: 155
@@ -9,7 +9,7 @@ nav_order: 155
# How to scrape package tracking status with Playwright
To scrape tracking, capture the **event timeline** rather than the headline status. A
To scrape tracking, capture the **event timeline**, not the headline status. A
tracking page shows one summary word at the top, and that word is a carrier's
interpretation of a list of scans underneath it. The list is the data. The summary is a
derived field you can always recompute, and it is the field carriers change the wording
@@ -1,6 +1,6 @@
---
title: "How to scrape parking rates with Playwright"
description: "Scrape parking garage rates with Playwright: read the tariff table as duration bands rather than prices, resolve the band an arrival time falls into, and keep the rules that override the table."
description: "Scrape parking garage rates with Playwright: read the tariff table as duration bands, not prices, resolve the band an arrival time falls into, and keep the rules that override the table."
parent: "Scraping with Playwright"
grand_parent: "Guides"
nav_order: 150
@@ -9,7 +9,7 @@ nav_order: 150
# How to scrape parking rates with Playwright
To scrape parking rates, capture the tariff **table** rather than a price: a garage does
To scrape parking rates, capture the tariff **table**, not a price: a garage does
not have "a rate", it has duration bands whose boundaries move by day of week and time
of arrival. Read every row as a triple of lower bound, upper bound and amount, record
the day and time window each table applies to, and keep the override rules printed
@@ -92,7 +92,7 @@ Record the scope with the bands, and drive the control to collect the others:
tariffs.append({"scope": scope, "bands": read_bands(page)})
```
Click the control rather than fetching a variant URL you guessed. The tab often triggers
Click the control instead of fetching a variant URL you guessed. The tab often triggers
a request whose response the page merges into the table, and driving the real control is
also the version that behaves like a visitor. The same reasoning applies to any
[tabbed or accordion content](how-to-scrape-accordion-and-tab-content-playwright.md), where
@@ -125,7 +125,7 @@ minimum charge, a grace period, a different rate after midnight, an early-bird r
requires arriving before a cutoff. These are prose, not rows, and they routinely
contradict the table above them.
Capture them verbatim rather than trying to parse them:
Capture them verbatim instead of trying to parse them:
```python
notes = [n.inner_text().strip()
@@ -147,7 +147,7 @@ order, wait for the result region, then read.
**Rates are location-scoped even on the same site.** A chain publishes the same page
shell for every garage and fills the numbers per location, sometimes from your inferred
position rather than the URL. If the figures change when the exit IP changes, the page is
position instead of the URL. If the figures change when the exit IP changes, the page is
reading a location you did not set, and the fix is the one in
[scraping geotargeted content](how-to-scrape-geotargeted-content-playwright.md).
@@ -10,7 +10,7 @@ nav_order: 142
# How to scrape patent listings with Playwright
To scrape patent listings with Playwright, read every date, status, code, and
name from its explicit field label rather than its position on the row, keep
name from its explicit field label instead of its position on the row, keep
each family member and each claim's dependency structure intact instead of
collapsing them into one value, and attach the scrape's own timestamp to legal
status because the page itself rarely prints when "today" was.
@@ -1,6 +1,6 @@
---
title: "How to scrape pet adoption listings with Playwright"
description: "Scrape shelter adoption listings with Playwright: reconcile disappearances instead of deleting rows, key animals on the shelter's own identifier, and keep photos as references rather than copies."
description: "Scrape shelter adoption listings with Playwright: reconcile disappearances instead of deleting rows, key animals on the shelter's own identifier, and keep photos as references, not copies."
parent: "Scraping with Playwright"
grand_parent: "Guides"
nav_order: 158
@@ -45,7 +45,7 @@ def listing_rows(page):
```
When no identifier is available anywhere, fall back to a hash of the stable fields and say
so in the row, rather than pretending the key is authoritative. A key you invented behaves
so in the row, not pretending the key is authoritative. A key you invented behaves
differently from one the site issued, and the difference shows up as churn that looks like
animals arriving and leaving daily.
@@ -97,7 +97,7 @@ rows to reveal it.
Facet controls that repopulate the list without a navigation behave like the ones in
[multi-select facet filters](how-to-scrape-multi-select-facets-playwright.md): wait for
the list to settle rather than for a load event.
the list to settle, not for a load event.
## Photos: keep the URL, not the file
@@ -107,7 +107,7 @@ when there is no feed to fall back on, are in
The feed has no window. It carries every item the host publishes, oldest to newest, in
one document. The honest caveat is that some hosts cap a feed at the most recent N items
by a setting on the show, so compare the item count in the XML against any total the page
displays rather than assuming the archive is complete. A capped feed is still a longer
displays instead of assuming the archive is complete. A capped feed is still a longer
list than the player, and the cap is visible; the player's truncation is not.
## Parse the core fields and the podcast namespace together
@@ -78,7 +78,7 @@ with InvisiblePlaywright(seed=42) as browser:
The `wait_for_selector` on a real review row is the important line. A verdict-style
check ("no error thrown") would pass on a container that never filled. Assert that a
review is actually present, the same principle as
[testing for the signal you want rather than the absence of one you do not](how-to-test-bot-detection.md).
[testing for the signal you want instead of the absence of one you do not](how-to-test-bot-detection.md).
## Drive the widget's own pagination and sort
@@ -10,8 +10,8 @@ nav_order: 111
# How to scrape professional directories with Playwright
To scrape a professional directory with Playwright, make the row a person-at-location pair
keyed on the registration number rather than the name, read the credential badges out of
their `title` attributes rather than their text, sweep the letter and specialty partitions
keyed on the registration number instead of the name, read the credential badges out of
their `title` attributes, not their text, sweep the letter and specialty partitions
the site offers while expecting them to overlap, and keep the last-verified date the
response carries so a stale record is visibly stale instead of quietly wrong.
@@ -22,7 +22,7 @@ the appointment. Neither of those is the row you want, and picking either one as
throws away records on the first run.
Two things separate this from an ordinary listing crawl. The identifier is a licence number
rather than a product id, and it is the only field in the record that does not drift. And
instead of a product id, and it is the only field in the record that does not drift. And
the rows are people, which constrains what you should collect before you write the schema.
## The row is a person at a location
@@ -68,7 +68,7 @@ directory that simply does not publish the flag into a register where nobody has
Names collide and names change. The number does neither.
In a register with tens of thousands of entries, two people sharing a surname and an initial
in the same city is ordinary rather than rare. Names also move: a marriage, a transliteration
in the same city is ordinary, not rare. Names also move: a marriage, a transliteration
that gains or loses a letter, a middle initial the card prints on one page and omits on the
next, a title that is sometimes part of the name field and sometimes its own column. A crawl
keyed on the name silently merges two people, then silently splits one, and both failures
@@ -87,7 +87,7 @@ city, because both halves of it move.
## Credential badges hide in the title attribute, not in the text
The specialty, the qualification and the accepting-new-clients flag are often an icon, and
the meaning sits in an attribute rather than in a text node. `inner_text()` returns an empty
the meaning sits in an attribute, not in a text node. `inner_text()` returns an empty
string, the field looks absent, and you record a null for something the page displayed
plainly to a reader.
@@ -124,7 +124,7 @@ anything at all.
That fourth case is where this stops working, and it is worth being blunt about. If the
meaning is carried only by a background image in the stylesheet, the card cannot tell you
what the badge means. Resolve the class once against the page's own legend, keep the mapping
as data rather than as a guess, and if there is no legend, write the class and leave the
as data, not as a guess, and if there is no legend, write the class and leave the
field null. A null is recoverable. A `False` invented for an unreadable badge is a false
statement about a person that no later run will notice.
@@ -136,7 +136,7 @@ than by page number, and those partitions are not a clean cut of the set.
They overlap in both directions. A practitioner registered in two specialties appears under
both. A double-barrelled surname is filed under either half depending on how the record was
entered. A person practising in two regions comes back from each region filter. Treat a
partition as a query rather than as a slice, the same reframing that
partition as a query, not as a slice, the same reframing that
[store locator pages](how-to-scrape-store-locator-pages-playwright.md) need for radius search,
and the duplicates stop being a defect to design away.
@@ -180,7 +180,7 @@ A register keeps the record after the person moves. The registration is still va
nothing about the entry looks wrong; the address hanging off it is fourteen months old. The
card renders the address and not the date, because a date makes the directory look worse than
it is. The search response behind the card frequently carries that date anyway, as
`lastVerified`, `updatedAt` or `dataAsOf`, because the template dropped the field rather than
`lastVerified`, `updatedAt` or `dataAsOf`, because the template dropped the field in place of
the API.
```python
@@ -198,7 +198,7 @@ def on_response(resp):
page.on("response", on_response)
```
Read the date off `records`, not off the DOM, and keep it next to your crawl date rather than
Read the date off `records`, not off the DOM, and keep it next to your crawl date, not
instead of it. A row collected today from a record the register last checked two years ago is
a different fact from one checked last week, and only the pair says which you are holding.
Parse the date once at the edge, since it arrives in whatever format the page prefers:
@@ -209,7 +209,7 @@ alike is in
Where this stops: a directory that publishes no date leaves you unable to separate fresh from
stale at all. Re-crawling does not rescue you, because an unchanged record is exactly what a
stale record looks like. Record the absence of the field rather than inferring a freshness you
stale record looks like. Record the absence of the field instead of inferring a freshness you
cannot see.
## A second run reconciles, it does not overwrite
@@ -243,7 +243,7 @@ def reconcile(previous, current, partitions_completed, run_date):
time and this run completed `letter:m` without it, that is a real signal about the person. If
this run never finished `letter:m`, the absence says nothing about the person and everything
about the crawl, and an empty `absent_from` list is what tells the two apart. Retire a pair
only after several runs of absence from partitions you completed, and flag it rather than
only after several runs of absence from partitions you completed, and flag it instead of
deleting it, because a practitioner on leave comes back. The incremental run this sits inside
is in [scraping only new items](how-to-scrape-only-new-items-incremental-playwright.md).
@@ -33,7 +33,7 @@ group is a walk across a set somebody else defined, which is the job in
A slider hands you two numbers and the space between them. There is no vocabulary to
enumerate, so the buckets are not discovered, they are invented by you. Every boundary in your
output is an artifact of your crawl rather than a property of the site.
output is an artifact of your crawl instead of a property of the site.
So a range row carries five things, not two: the lower bound, the upper bound, whether each
end is open or closed, the count, and the state URL that produced it.
@@ -25,7 +25,7 @@ count of reviews in the DOM is almost never the count on the page.
This is a working order for getting all three right: read the rating from where it
really lives, expand each review before you extract it, and page the "load more"
button until there is genuinely nothing left. The examples use stock Playwright driven
through this project, so the browser looks like a returning visitor rather than a fresh
through this project, so the browser looks like a returning visitor instead of a fresh
automated session on every request.
## Why the two fields you want are not in the text
@@ -151,7 +151,7 @@ a click worked is the text getting longer, not a navigation or a network respons
`wait_for_function` on the block's own text length is the honest wait. Waiting a fixed
number of milliseconds instead will sometimes read the block mid-expansion and capture a
half-grown body. Second, clicking mutates the DOM, so re-query the buttons each pass
rather than iterating a list captured once, and stop only when a whole pass expands
instead of iterating a list captured once, and stop only when a whole pass expands
nothing.
## Page the 'load more' XHR to a natural end
@@ -210,7 +210,7 @@ throttle is built to catch.
A seed-stable fingerprint is the right first half of the answer. Because every surface
this browser exposes is derived from one seed, every request in a run carries the same
GPU, the same fonts, the same audio device and the same canvas hash, so the session
reads as one returning visitor rather than a rotating swarm of strangers. Reuse the seed
reads as one returning visitor instead of a rotating swarm of strangers. Reuse the seed
and you are the same person across the whole crawl; that consistency is what a
per-identity limiter measures you against, and here it measures a coherent visitor.
@@ -93,7 +93,7 @@ The browser is a real browser: a Firefox patched at the C++ level, driven by sto
Playwright, presenting a consistent TLS handshake and fingerprint that a stripped-down
client cannot. The feed comes back because the request that asked for it is
indistinguishable from the request that asked for the page. If you want to keep the
raw response bytes exactly as served rather than the serialized DOM,
raw response bytes exactly as served instead of the serialized DOM,
[capturing the response body directly](how-to-capture-xhr-api-responses-playwright.md)
with `page.on("response")` is the companion technique, and it avoids any question of
what the browser did to the document on the way in.
@@ -101,7 +101,7 @@ what the browser did to the document on the way in.
One caveat worth stating plainly, because it is the honest one: whether the feed
loads at all is downstream of whether the session looks real. If the HTML site is
challenging you, the feed will challenge you too, and the fix is the same fix as for
any blocked page rather than anything feed-specific. That whole order of operations is
any blocked page, not anything feed-specific. That whole order of operations is
[the checklist for scraping without getting blocked](how-to-scrape-without-getting-blocked.md),
and it applies here unchanged.
@@ -117,7 +117,7 @@ other. The differences that matter:
- **Atom** has no channel, each item is `<entry>`, the date is `<updated>` in
ISO 8601 format per [RFC 4287](https://datatracker.ietf.org/doc/html/rfc4287), the
body is `<content>` or `<summary>`, and the link is an
attribute (`<link href="...">`) rather than element text.
attribute (`<link href="...">`), not element text.
So the first thing to do after parsing is look at the root element and decide which
world you are in. Do not sniff the URL or the content type, read the tag. This is the
@@ -189,7 +189,7 @@ string you may still want to strip of tags depending on what you are storing.
## Handle media, dates and the fields that are not always there
Feeds are permissive, and every field above can be absent on a given item. The parser
above uses `findtext`, which returns `None` rather than raising, and guards
above uses `findtext`, which returns `None` instead of raising, and guards
`enclosure` and `content` before touching them, because a podcast item has an
`<enclosure>` and a text-only post does not.
+4 -4
View File
@@ -11,7 +11,7 @@ nav_order: 138
To scrape salary and pay scale data with Playwright, expand any tooltip or collapsed row
before you read a figure, keep the period, currency, and base-versus-total flag attached
to every value, store a range as two numbers rather than a collapsed midpoint, and tag
to every value, store a range as two numbers instead of a collapsed midpoint, and tag
each record with what kind of evidence it is: a figure typed by a job poster, one
submitted by a site visitor, or a line from a government wage survey. Each of those needs
its own sample size and collection date carried along with it, not folded into the
@@ -78,7 +78,7 @@ The number you see before that click is a sum. The numbers you want are the adde
Drive the toggle the same way that page describes: read `aria-expanded` before clicking
so you never re-close a panel the page already opened, and wait for text to land in the
specific panel rather than trusting that the click alone was enough.
specific panel instead of trusting that the click alone was enough.
```python
def read_pay_breakdown(page, toggle_selector, panel_id):
@@ -103,7 +103,7 @@ def read_pay_breakdown(page, toggle_selector, panel_id):
```
If the panel never appears, that is a real answer too: the page is not disclosing a
breakdown, and `components` on that record stays `None` rather than an assumed split. A
breakdown, and `components` on that record stays `None` instead of an assumed split. A
figure with no visible breakdown is a blended total, and a blended total stored as if it
were base pay will overstate every comparison against a job that lists base pay alone.
@@ -154,7 +154,7 @@ def parse_range(raw):
```
A `(None, None)` result is the parser telling you the text was a single point value, not
a failure. Route that case to `min_value == max_value` rather than discarding the row.
a failure. Route that case to `min_value == max_value` instead of discarding the row.
## Self-reported figures and wage statistics are not the same evidence
@@ -17,7 +17,7 @@ decision value, and both are routinely written in ways that defeat a naive parse
There is a second structural point. Most scholarship data lives on aggregators that
summarise a provider's own page, and the summary is often stale or subtly wrong. If your
use is helping someone decide where to apply, capture the provider link and treat the
aggregator row as an index entry rather than as the truth.
aggregator row as an index entry, not as the truth.
This page covers deadlines that are not dates, eligibility that resists structuring, and
following through to the source.
@@ -43,7 +43,7 @@ with InvisiblePlaywright(seed=42) as browser:
ics_text = page.inner_text("pre") or page.content()
```
Fetch the feed inside the same browser rather than with a separate client. It is usually
Fetch the feed inside the same browser, not with a separate client. It is usually
served from the same host with the same protection, and the reasoning is the one that
applies to any secondary document: a side request is a fresh visitor with none of the
context the page accumulated.
@@ -68,7 +68,7 @@ as "14 October to 18 October" is five days, and an exclusive loop returns four,
sending a child to school on the Friday.
Weekends inside a term-time range are also not closures in the useful sense, so decide once
whether your expansion emits them and record the choice, rather than leaving each consumer
whether your expansion emits them and record the choice, not leaving each consumer
to guess.
## Keep the category, because not all closures are the same
Loaded 100 of 141 files, more files were not shown because too many files have changed in this diff. Show more