Skip to main content

Bitscrape

Bitscrape

Bitscrape

A modular, async Python web scraping framework — simple for a first spider, capable of distributed crawling, storage, search-ranking, and observability for everything after that.

It provides fast async networking, powerful HTML parsing, configurable pipelines, distributed crawling support, and optional browser rendering with Playwright.

Install

pip install bitscrape

or

uv add bitscrape

Documentation

import bitscrape

@bitscrape.spider(name="quotes", start_urls=["https://example.com"])
async def parse(response):
    for quote in response.css("div.quote"):
        yield {
            "text": quote.css("span.text::text").get(),
            "author": quote.css("small.author::text").get(),
        }

bitscrape.run(parse, output="quotes.jsonl")

That same call scales to a Redis-backed, multi-worker distributed crawl by changing one argument — the spider code doesn't change:

bitscrape.run(parse, settings=bitscrape.Settings(
    scheduler_use_redis=True,
    distributed_throttle_enabled=True,
))

Why Bitscrape

  • One function call to run a spider, whether it's a plain decorated function or a full class with multiple callbacks.
  • One Settings object controls everything else — proxy rotation, session pooling, JS rendering, distributed crawling, live monitoring, Prometheus metrics — all opt-in toggles, nothing extra loads unless you ask for it.
  • Respects robots.txt and meta-robots by default -- Disallow/Allow (with wildcards), Crawl-delay, Request-rate (time-windowed), TTL-cached per domain with stale-while-revalidate -- and fails safe (blocks) rather than open (allows) if robots.txt can't be fetched (see docs/robots.md).
  • Every documented feature has a real test behind it — a real local Redis, a real local HTTP server, a real on-disk SQLite database, a real S3 API emulation, real Prometheus/OpenTelemetry libraries. Where something couldn't be verified for real (a live PostgreSQL/MongoDB server, a Kubernetes cluster), that's stated explicitly rather than implied — see CHANGELOG.md and docs/ for exactly what's verified vs. documented.

What's included

Area What you get
Crawling Async fetching (aiohttp), retries with Retry-After support, conditional GET, robots.txt (Disallow/Allow/Crawl-delay/Request-rate, cached) + meta-robots compliance, redirect-loop detection, adaptive autothrottle (latency-tuned per-domain delay, doubles on blocks, honours Retry-After, recovers on its own), proxy rotation, dev-mode response caching/replay, blocked-request detection + retry
JS rendering Playwright integration, pooled browser reuse, infinite-scroll helper, CDP remote-browser connect, persistent profiles, background XHR/fetch capture, record_requests network history (searchable, bounded, HAR export), saved login state (save_state/load_state), shadow-DOM piercing, ad/domain/resource-type blocking with a bundled ~3,900-domain list (bitscrape blocklist update for ~100k) — see docs/network-and-state.md, docs/blocking-and-dns.md
Spider templates CrawlSpider + Rule + LinkExtractor (rule-based link following, allowed_domains enforced by OffsiteMiddleware), SitemapSpider (sitemap or robots.txt-driven, gzip + sitemap indexes, hreflang alternates), XMLFeedSpider (namespace-safe, RSS/Atom), CSVFeedSpider, ShopifySpider (paginated /products.json, one item per variant, deduped), SiteToMarkdownSpider / ContentSpider (whole site → LLM-ready Markdown) — see docs/spider-templates.md
Export formats 17 built-in formats — JSON, JSONL, CSV, XML, YAML, TOML, INI, Markdown, MessagePack, BSON, Protobuf, Parquet, ORC, Avro, WARC, PDF, Word (.docx) — through one get_exporter(), the CLI's --format, or in-memory as result.items.to_json() / .to_parquet() / ... via ItemList (Settings.collect_items=True) — see docs/exporters.md
AI / RAG integration RagPipeline (markdown → chunking → BM25/hybrid search, one object), MCP server (bitscrape mcp: 14 tools incl. persistent browser sessions, saved logins, network-history search, SSRF guard, bearer-auth HTTP transport — docs/mcp.md), a bundled Agent Skill for coding agents
Developer experience bitscrape get <url> (one-shot fetch, no spider needed), bitscrape shell <url> (IPython REPL with fetch()/view()/from_curl()), Fetcher/AsyncFetcher/FetcherSession for direct HTTP requests (optional real HTTP/2 via httpx, no fingerprint impersonation — see docs/fetchers.md), DynamicFetcher/DynamicSession for JavaScript-driven pages through a real browser (Playwright Chromium, installed Chrome, or a running browser over CDP; hooks, waits, scrolling, XHR capture, authenticated proxies, no stealth patching — see docs/dynamic-fetcher.md), sync bitscrape.fetch_url() / bitscrape.run(), orjson-accelerated JSON everywhere (bitscrape.jsonx), text helpers (bitscrape.textutil, el.clean_text(), el.price()), DNS-over-HTTPS resolver (dns_over_https=True), browser-ready Docker image (--target browsers)
Distributed crawling Redis-backed queue + dedup filter, cross-worker-process politeness throttle, a Mercator-style priority Frontier, named multi-session routing with per-session cookies, proxies and persistent browser contexts, follow() session inheritance and block escalation (docs/sessions.md)
Extraction CSS/XPath selectors, URL canonicalization, SimHash near-duplicate detection, heuristic entity resolution
Search infrastructure PageRank/HITS link analysis, incremental recrawl scheduling, BM25 + vector hybrid search with Reciprocal Rank Fusion, a knowledge-graph builder
Storage Pluggable backends — SQLite and S3 fully tested, PostgreSQL implemented, MongoDB/Elasticsearch as documented stubs
Extensibility A plugin/hook system (PluginManager), example auth-helper and storage-connector plugins
Observability Real Prometheus metrics, real OpenTelemetry tracing, structured JSON logging, threshold-based alerting, a live local stats dashboard
Deployment Dockerfile, Docker Compose, Kubernetes manifests (Deployment/HPA/Service/PDB)

Explicitly not included, by design: CAPTCHA-solving, browser/TLS fingerprint spoofing, or any other bot-detection evasion tooling. See docs/security/ for why.

Install

python3 -m venv venv
source venv/bin/activate          # Windows: venv\Scripts\Activate.ps1
pip install -e ".[all,dev,cli]"
bitscrape --version

See docs/installation/ for extras, system requirements, and troubleshooting.

Quickstart

bitscrape genspider quotes example.com
bitscrape crawl spiders/quotes.py -o quotes.jsonl

Full walkthrough: docs/quickstart/.

Documentation

Full documentation lives in docs/:

Also at the repository root: ARCHITECTURE.md (condensed system design), API_REFERENCE.md (flat single-page API reference), ROADMAP.md, CHANGELOG.md.

Running the test suite

pytest -q

Expect 659 passed. A handful of tests need a local Redis on port 6390 and a local PostgreSQL server (database bitscrape_test, user/password postgres/postgres) — if it's not running, only those specific tests fail, everything else still passes. See docs/developer-guide/.

Contributing

See CONTRIBUTING.md. Security issues: see SECURITY.md rather than a public issue. Community standards: CODE_OF_CONDUCT.md.

License

MIT — see LICENSE.

Metadata

Release files for bitscrape 0.8.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bitscrape 0.8.1
File Size Uploaded Provenance Actions
bitscrape-0.8.1.tar.gz 299.0 kB With provenance Details for bitscrape-0.8.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bitscrape 0.8.1
File Interpreter ABI Platform Actions
bitscrape-0.8.1-py3-none-any.whl Python 3 none any Details for bitscrape-0.8.1-py3-none-any.whl

Total release size: 595.0 kB

Release files / bitscrape-0.8.1.tar.gz

Download URL bitscrape-0.8.1.tar.gz
Size 299.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a4a0be9c849d83af405684fa998a197cd419826c2710ec0481fc363ac0074091
BLAKE2b-256 checksum
How to use checksums
f1ff2fed59a069aacabdd83e5f00c31c9f56773fcaced870e39e2c0e8f6278a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Release files / bitscrape-0.8.1-py3-none-any.whl

Download URL bitscrape-0.8.1-py3-none-any.whl
Size 296.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
939724c51ac146ec14a3757415359dea0c5a227298bbd167429cfbc0bd353c9d
BLAKE2b-256 checksum
How to use checksums
671cce74774db191c91480d4773e3e14303b581d4bee1ea70913fe3546f48983
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Security for bitscrape 0.8.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for bitscrape-0.8.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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