Skip to main content

scrapper-tool

A reusable Python web-scraping toolkit — production-grade primitives, anti-bot ladder, fixture-replay testing.

Built from the scraping core behind PartsPilot, extracted as an open-source library so other projects (and LLM agents) can pick up the same patterns without redoing the reverse-engineering work.


CI PyPI version Python versions Downloads License: MIT Code style: ruff Type-checked: mypy PRs Welcome GitHub Stars GitHub Forks

Quickstart · All docs · Settings · MCP · Docker · Changelog


Status (2026-08-27): stable (v3.0.0). The public Python API and MCP tool surface are SemVer-stable.

v3.0.0 adds a target URL guard that vets every URL before a request is issued — private, loopback and cloud-metadata targets are refused, and that is on by default, which is the breaking part. It also gives the captcha grid tier its own vision model, blocks page-initiated SSRF in the render tier, promotes the impersonation ladder to chrome150, and stops overriding the impersonated User-Agent (which had been advertising scrapper-tool/0.1 beside a Chrome TLS handshake — a self-identifying mismatch).

Read the breaking-change table before upgrading. Every number in the docs is measured, including the ones that did not work; see docs/TESTING.md.

What it does

Web scraping is mostly the same work every time: pick the extraction method the site actually needs, survive the TLS fingerprint, retry sanely, and write tests that do not break the moment the vendor ships CSS. scrapper-tool packages the parts that do not change per vendor.

One call does the escalation for you — cheapest method first, climbing only when the site forces it:

from scrapper_tool import scrape

data = await scrape("https://vendor.example/product/123")

Behind that call: a TLS-impersonation ladder, a stealth browser, a local LLM, and a captcha cascade — in that order, and only as far as the site makes necessary.

Install

uv pip install "scrapper-tool[full,agent]"    # all five patterns + MCP server
camoufox fetch                                # ~300 MB, best-stealth browser

pip works too, but [full] needs uv — Scrapling and Crawl4AI pin incompatible lxml ranges and only uv honours the override that reconciles them. Lighter installs and the pip escape hatch: Install guide.

Check what actually works on your machine:

scrapper-tool doctor

It reports every tier as ok / degraded / missing with the exact command to fix each one, and exits non-zero so it works as a CI or container healthcheck.

The five patterns

Pick the one DevTools points at, or let scrape() choose.

Pattern When Cost
A — JSON API An XHR returns the data Lowest
B — Embedded JSON ld+json, __NEXT_DATA__, __NUXT__ Low
C — CSS / microdata Price is in the HTML, no JSON Medium
D — Hostile Cloudflare Turnstile, Akamai, DataDome High — real browser
E — LLM agent D is still blocked, or the page needs interaction Highest — local LLM

Full guides: patterns A–E.

Security: targets are vetted before they are fetched

Every surface checks a URL before issuing a request. Private, loopback, link-local and cloud-metadata targets are refused, along with non-http(s) schemes and hostnames that resolve into private space.

This is on by default, and it matters most if you run the REST sidecar: without it, anything that can reach the sidecar can make it fetch 169.254.169.254 and read your cloud credentials back.

To reach a legitimate internal target, allowlist it rather than turning the guard off:

SCRAPPER_TOOL_URL_GUARD_ALLOW=127.0.0.1,10.0.0.0/8

What is covered, what is not, and the fully-closed ..._STRICT mode: Target URL guard.

Run it as a service

Mode Command Docs
MCP server (Claude, Cursor, any MCP client) scrapper-tool-mcp docs/mcp.md
REST sidecar (any language, plain HTTP) scrapper-tool-serve docs/http-sidecar.md
Docker (all five patterns in one image) docker compose up docs/docker.md

Settings

Every knob is an env var, a constructor argument, or a per-call keyword — in that order of precedence. docs/SETTINGS.md is the canonical reference: if a setting is not there, it is not a public knob. .env.example is a drop-in starter with every variable annotated.

Architecture

flowchart TD
    A[Your scraper code or LLM agent] --> B[vendor_client / request_with_retry]
    B --> C{TLS-sensitive?}
    C -- no --> D[httpx]
    C -- yes --> E[curl_cffi ladder]
    E --> E1[chrome150] --> E2[chrome146] --> E3[safari2601] --> E4[firefox147]
    D --> F[Response]
    E4 --> F
    F --> G{Pattern}
    G -- A --> H[JSON API model]
    G -- B --> I[extruct: ld+json / next_data / nuxt]
    G -- C --> J[selectolax: microdata / CSS]
    G -- D --> K["Scrapling (Playwright + Turnstile)"]
    G -- "BlockedError + interactive" --> M["Pattern E: agent_extract / agent_browse"]
    M --> M1["Stealth browser (Camoufox / Patchright / Obscura)"]
    M1 --> M2["Local LLM (Ollama, qwen3-vl:8b)"]
    M2 --> M3["Captcha cascade (Camoufox auto → Theyka → paid)"]
    M3 --> L[Validated product data]
    H --> L
    I --> L
    J --> L
    K --> L

Documentation

Quickstart 5-minute on-ramp.
Settings reference Every env var, default, choice list. (v1.0.0+)
.env.example Drop-in starter file with every variable annotated.
E2E test plan Operator-runnable end-to-end suite — library / Docker / MCP modes against LM Studio. (v1.0.0+)
scripts/e2e/ Runnable test scripts referenced by the E2E plan.
Recon playbook DevTools-driven reverse-engineering of a new vendor site.
Pattern A — JSON API Vendor exposes an XHR / JSON endpoint.
Pattern B — Embedded JSON ld+json, __NEXT_DATA__, __NUXT__, RSC payloads.
Pattern C — CSS / microdata itemprop="price", fallback selectors.
Pattern D — Hostile Cloudflare Turnstile, Akamai EVA.
Pattern E — LLM agent Local-LLM-driven scraping for any protected site. (v1.0.0+)
Anti-bot ladder reference How the ladder walks, when to bump the primary profile.
Test helpers FakeCurlSession, replay_fixture, golden-snapshot pattern.
Agent integration MCP wiring for Claude, OpenClaw, Hermes Agent, AutoGen, LangChain. (v0.2.0+)
2026-04-30 landscape research Why these tools, sourced.

Why this exists

Most scrapers are written from scratch every time, even though 90% of the work is the same: pick the right extraction pattern, survive the TLS fingerprint, retry/backoff sanely, and write tests that don't drift the moment a site updates.

scrapper-tool packages the parts that don't change per vendor, so you only write the parts that do.

  • Pattern-first design. Five named, documented extraction patterns (A–E) — pick the one DevTools points at, skip the rest.
  • Anti-bot ladder built in. Auto-walks chrome150 → chrome146 → safari2601 → firefox147 → chrome133a when a profile gets fingerprinted.
  • Deterministic tests. Fixture-replay (FakeCurlSession, replay_fixture, golden snapshots) — no live HTTP in CI.
  • Optional hostile mode. Cloudflare Turnstile / Akamai EVA defeat path via Scrapling — opt-in extra, no Playwright bloat by default.
  • LLM-agent ready. v0.2.0+ ships an MCP server so Claude, AutoGen, LangChain, etc. can drive the scraper directly.
  • Local-LLM scraping for any protected site (v1.0.0+). Pattern E adds Camoufox + browser-use + Crawl4AI + Ollama — zero API cost, two modes (agent_extract for fast 1-call extraction, agent_browse for interactive multi-step tasks). Humanlike-behavior layer defeats DataDome.
  • Captchas solved on the way past (v2.2.0+). Five tiers, cheapest first: settle → click the checkbox → align the slider (pure geometry, no model) → read the image grid with a local VLM → paid solver. Measured live: reCAPTCHA v2 grids 3/4–4/5 with a ~27B VLM, GeeTest sliders ~20% with no model at all. reCAPTCHA v3 and AWS WAF are not solvable — they are risk scores, not puzzles, and the docs say so.
  • Clearance cookies are kept, not thrown away (v2.2.0+). A solve costs ~70 s of local inference or a paid API call; the cf_clearance it buys now survives to the next tier, and to the next run via a persisted browser profile.
  • Boring stack. httpx, curl_cffi, selectolax, extruct. No managed SaaS bundled — your code, your egress.

Roadmap

  • v0.1.0 — Core HTTP client, retry/backoff, anti-bot ladder, patterns A–D, fixture-replay test helpers.
  • v0.2.0 — MCP server for LLM agents; canary CLI for nightly fingerprint-health probes.
  • v1.0.0 — Pattern E: local-LLM-driven scraping (Camoufox + browser-use + Crawl4AI + Ollama), captcha cascade, humanlike-behavior layer, full Docker stack. Public API + MCP tool surface stable under SemVer.
  • v1.1.0 — Pluggable rate-limit / robots.txt policies; per-vendor profile presets; agent_session() warm-browser pooling; broader Pattern E backends.

See CHANGELOG.md for landed changes and open issues for what's in flight.

Contributing

PRs and issues are welcome. Every PR that meaningfully changes how we scrape lands a CHANGELOG.md row.

Contributors

Contributors

Want to see your avatar here? Check CONTRIBUTING.md and open a PR.

Acknowledgements

scrapper-tool stands on the shoulders of these projects:

  • httpx — async HTTP client
  • curl_cffi — TLS / JA3 impersonation
  • selectolax — fast HTML parsing
  • extructld+json, microdata, RDFa extraction
  • Scrapling — Playwright-based hostile-site backend

License

MIT © scrapper-tool contributors.

If scrapper-tool saves you time, consider starring the repo — it helps others find it.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scrapper_tool-3.0.0.tar.gz (732.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scrapper_tool-3.0.0-py3-none-any.whl (287.4 kB view details)

Uploaded Python 3

File details

Details for the file scrapper_tool-3.0.0.tar.gz.

File metadata

  • Download URL: scrapper_tool-3.0.0.tar.gz
  • Upload date:
  • Size: 732.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for scrapper_tool-3.0.0.tar.gz
Algorithm Hash digest
SHA256 3cb75ba685638fb4c9c609261fe9474e6d3b6f70b21fec8c717d998da04fd430
MD5 66bb6aade97216d49f21473a60d429bb
BLAKE2b-256 0d08c40baa0a300a8f6b6026a24e70b78ba9abc3bfb0aa11d99088547ef2d2c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for scrapper_tool-3.0.0.tar.gz:

Publisher: release.yml on ValeroK/scrapper-tool

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scrapper_tool-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: scrapper_tool-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 287.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for scrapper_tool-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c4f268a30832a9048fed4530217b1800a5a90a4b5d4a9470a156c8208fed951b
MD5 d0745a3da1cb19df858d12a38167c6c7
BLAKE2b-256 2b9a373c4a140b76aa5fade89e751a2520e69c8b07ecd1cd840a78ece515d4a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for scrapper_tool-3.0.0-py3-none-any.whl:

Publisher: release.yml on ValeroK/scrapper-tool

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

4.3.1

2 files

4.3.0

2 files

4.2.0

2 files

4.1.0

2 files

4.0.0

2 files

3.2.0

2 files

3.1.1

2 files

3.1.0

2 files

This release

3.0.0 This release

2 files

2.2.0

2 files

2.1.0

2 files

2.0.0

2 files

1.4.2

2 files

1.1.2

2 files

1.1.1

2 files

1.1.0

2 files

1.0.0

2 files

0.2.0

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page