During a 110-URL run, the collector was stopped after it had written the first 100 responses. Restarting it fetched the remaining ten in 5.54 seconds. Those responses had stayed in storage while the collector was offline.

A scheduled job does not always need a public HTTP receiver running whenever a page finishes crawling. The Enterprise Crawler handles background acquisition, and its Storage delivery mode sends completed responses to Cloud Storage. The consumer retrieves them when it runs.

The consumer in this post submits URLs with a local checkpoint, discovers available request identifiers (RIDs), retrieves stored responses in batches, and writes Apache Parquet files. DuckDB queries those files and compares their RIDs with the submission checkpoint.

The companion repository holds seven standalone walkthroughs in steps/ and the complete pipeline in final/. The recorded live checks cover a 110-URL crawl across three public domains, a five-URL incremental smoke test, and separate submission and collection restarts.

The short version
  • Create the crawler without callback_url and it delivers to Cloud Storage. Push with crawler=NAME and callback=true. No public endpoint is involved.
  • Storage lists every stored result on the account, so the drainer intersects the listing with its own checkpoint, pulls 100 RIDs per bulk call, and deletes a batch only after its Parquet file is in place.
  • A RID is acceptance, not completion. The recorded run pushed 110, drained 110, and kept two deliberate 404 responses that still billed.
Push to a Storage-mode crawler queue, pull 100 RIDs per bulk call into Parquet, and query locally. The public webhook receiver is the path this project does not run.

Configure a workload with persistent local state

Use Python 3.11 or newer; the recorded runs used Python 3.13. Create a virtual environment at the repository root and install final/requirements.txt into it. The README calls that root code/.

Resuming a workload requires both its submission database and its Parquet output. The database maps accepted URLs to RIDs; the committed files identify responses already written. Keep both together when moving or resuming the job.

From the repository root, create the configuration from the supplied template:

bash
cp final/.env.example final/.env

The template contains:

dotenv
CRAWLBASE_TOKEN=YOUR_NORMAL_TOKEN
CRAWLBASE_JS_TOKEN=YOUR_JS_TOKEN
CRAWLER_NAME=storage-duckdb-demo
PUSH_RATE_PER_SEC=30
QUEUE_CAP=100000
OUTPUT_DIR=out
SQLITE_PATH=crawl_state.sqlite

Set CRAWLBASE_TOKEN to your Normal token for the sample workload. The JavaScript token is optional for that run. For a browser-rendered workload, configure the JavaScript token and pass --js consistently to the pusher, drainer and verification commands.

Run the complete pipeline from final/ so its relative database and output paths resolve consistently, and give each workload its own database and output directory. The checkpoint uses the URL as its primary key and replaces an existing mapping for that URL, so a shared database would mix crawler workloads or overwrite earlier capture mappings.

Finish submitting a batch before starting the drainer, which reads its expected RID set at startup. Keep the configured SQLite file in place: if it is missing, the current CLI collects across the whole storage area without the workload's RID filter.

Create a crawler with Storage delivery

The Enterprise Crawler configuration determines where completed responses go. Creating a crawler without callback_url selects Storage delivery. Providing your own callback URL selects webhook delivery.

Submission still goes through the endpoint shared with the Crawling API, but crawler=NAME and callback=true route the request into the managed crawler queue. This project uses that Enterprise Crawler path. It does not submit independent jobs with async=true.

Storage delivery belongs to the crawler, so the pushes do not need store=true. The callback=true parameter selects queued delivery even though the consumer is not a public webhook.

The first walkthrough creates the queue and reads back its configuration and statistics:

python
def create_or_get_storage_crawler(token: str, name: str) -> dict:
    with httpx.Client(timeout=30.0) as client:
        # Omit callback_url to create a crawler in Cloud Storage delivery mode.
        resp = client.post(f"{BASE_URL}/crawler/{token}", json={"name": name})
        if resp.status_code in (200, 201):
            created = resp.json()
            action = "created"
        elif resp.status_code == 422:
            created = resp.json()
            action = "already_exists"
        else:
            resp.raise_for_status()
            created = resp.json()
            action = "created"

        details = client.get(f"{BASE_URL}/crawler/{token}/{name}")
        details.raise_for_status()
        stats = client.get(f"{BASE_URL}/crawler/{token}/stats")
        stats.raise_for_status()
        return {
            "action": action,
            "create_response": created,
            "crawler": details.json(),
            "queue_stats": [
                c for c in stats.json().get("crawlers", []) if c.get("name") == name
            ],
        }

The recorded REST creation returned 201 Created; an existing name returned 422. The returned crawler record showed a Crawlbase-managed callback_url rather than one of ours, and the helper redacts it before printing. The Normal-token crawler reported "token_type": "tcp" and the JavaScript-token configuration reported "token_type": "js".

Use a new crawler name, or inspect an existing crawler's delivery configuration before reusing it. The helper accepts an existing crawler, but it does not convert a webhook crawler into a Storage crawler.

Separate queue capacity from submission speed

The documented defaults are 30 submitted URLs per second per token, 100,000 waiting URLs per crawler, and a combined account limit of 1,000,000 queued URLs. Crossing the account-wide limit pauses pushes until queue depth falls or queued work is purged. Default crawler concurrency is 20 workers, with increases available through Crawlbase support.

The pusher's worker count controls concurrent HTTP submission calls. Crawler concurrency controls the background workers that fetch target pages. In the recorded /stats responses the per-crawler concurrency value was 0 while idle, so it reports active work rather than the configured ceiling, and the drainer reads the per-crawler waiting field as queue depth.

Pickup is not instantaneous. In the live checks the first six-URL probe stayed at "waiting": 6 for several minutes before workers picked up the queue and cleared it in three seconds; the later five-URL and 110-URL runs cleared in about 60 seconds. A returned RID therefore establishes acceptance, not completion or immediate retrievability.

Documented bounds beside the live observations from November 30, 2026. The measured cursor lifetimes and submission rates describe those checks, not guarantees.

Submit URL waves and checkpoint accepted RIDs

The pusher uses HTTPX's asynchronous client with a worker pool. A shared token bucket decides when those workers may submit a request:

python
class AsyncTokenBucket:
    def __init__(self, rate: float = 30.0, capacity: float = 1.0) -> None:
        self.rate = rate
        self.capacity = capacity
        # Start empty so even the first 1.0s window never exceeds `rate` calls.
        self.tokens = 0.0
        self.updated_at = time.monotonic()
        self._lock = asyncio.Lock()

    async def acquire(self) -> None:
        while True:
            async with self._lock:
                now = time.monotonic()
                elapsed = now - self.updated_at
                self.tokens = min(self.capacity, self.tokens + elapsed * self.rate)
                self.updated_at = now
                if self.tokens >= 1.0:
                    self.tokens -= 1.0
                    return
                wait_for = (1.0 - self.tokens) / self.rate
            await asyncio.sleep(wait_for)

The bucket has a capacity of one token and starts empty. Each acquisition consumes one token, and elapsed time refills the bucket at the configured rate. That spaces submissions while other workers wait for their HTTP responses.

The walkthrough's push function sends the crawler name, the delivery flag, the representation format and the target URL:

python
async def push_one(
    client: httpx.AsyncClient,
    limiter: AsyncTokenBucket,
    token: str,
    crawler: str,
    url: str,
    fmt: str = "json",
    queue_timeout: int | None = None,
) -> str:
    params: dict[str, str] = {
        "token": token,
        "crawler": crawler,
        "callback": "true",
        "format": fmt,
        "url": url,
    }
    if queue_timeout:
        params["queue_timeout"] = str(queue_timeout)

    for attempt in range(5):
        await limiter.acquire()
        resp = await client.get(f"{BASE_URL}/", params=params)
        if resp.status_code == 200:
            return str(resp.json()["rid"])
        if resp.status_code in (429, 500, 502, 503, 504):
            retry_after = float(resp.headers.get("Retry-After", 1.0 * (2**attempt)))
            await asyncio.sleep(min(retry_after, 15.0))
            continue
        resp.raise_for_status()
    raise RuntimeError(f"Failed to push {url} after retries")

A 200 OK response supplies the RID that the caller records. Responses with 429, 500, 502, 503 or 504 enter the retry loop, and each retry acquires another limiter token. The complete client falls back to exponential backoff when Retry-After is not numeric and caps delays at 30 seconds; the walkthrough caps its delay at 15.

After each accepted push, the application commits a URL-to-RID row in SQLite with write-ahead logging. The complete checkpoint also records the crawler, wave, format and submission timestamp. On restart, the pusher subtracts already checkpointed URLs from the input.

In the recorded kill-and-resume check, the pusher was stopped after four checkpointed URLs out of ten. Restarting reported already_checkpointed=4 | remaining=6 and completed all ten with zero duplicate pushes. Acceptance can still precede the local commit: an interruption in that interval leaves a server-side job without a checkpoint row. The checkpoint preserves committed acknowledgments; it does not make submission and local persistence one atomic operation.

Keep submission throughput distinct from crawl throughput

With concurrency=15, the 110-URL run submitted every URL in 9.31 seconds, a reported 11.81 URLs per second. Round trips of roughly 1.2 seconds kept that pool below the 30 per second ceiling.

Submission shape Rate Time for 100,000 URLs
Sequential, 800 ms per call about 1.25 URLs/s about 22.2 hours
Recorded run, 15 workers, 1.2 s round trips 11.81 URLs/s about 2.4 hours
Sustained documented ceiling 30 URLs/s about 55.6 minutes

These estimates cover submission only. They exclude the time the crawler needs to fetch the pages and the time the consumer needs to collect the results.

For a larger input, --concurrency 40 keeps more submission calls in flight while the same limiter controls their rate. The complete pusher divides pending URLs into waves of 10,000 and checks /crawler/<TOKEN>/stats for queue headroom, splitting a wave when the available capacity is smaller than the wave.

Discover stored results for this workload

The Cloud Storage listing is an inventory of stored results. It is not a list of all accepted jobs, and it is not isolated by crawler name.

Before the live run, the test account already held 91 unrelated pages, reported as {"totalCount": 91}. The Normal and JavaScript tokens saw the same count and the same RIDs. Selecting a different token type on that account did not create a separate storage pool.

The complete drainer therefore intersects the listed RIDs with the selected crawler's checkpointed RIDs, then excludes those already present in Parquet. Keep that scoping active on shared storage. --drain-all deliberately removes the checkpoint restriction and belongs on a storage area dedicated to the collection task.

The Storage API RID listing supports scroll pagination. The first request supplies limit and scroll=true; later requests replay the returned scroll_id. The page limit can be as high as 10,000.

The listing walkthrough keeps a set so it never returns the same RID twice if a scroll has to reopen:

python
def scroll_rids(token: str, limit: int = 1000, max_pages: int = 5, page_delay: float = 1.2) -> list[str]:
    seen: list[str] = []
    seen_set: set[str] = set()
    scroll_id: str | None = None
    pages = 0

    with httpx.Client(timeout=30.0) as client:
        while pages < max_pages:
            params: dict[str, str | int] = {"token": token}
            if scroll_id is None:
                params["limit"] = limit
                params["scroll"] = "true"
            else:
                params["scroll_id"] = scroll_id

            resp = client.get(f"{BASE_URL}/storage/rids", params=params)
            if resp.status_code == 429:
                # /storage/rids returns plain-text 429 on rapid polling.
                time.sleep(2.0)
                continue
            if resp.status_code in (400, 404, 500) or "scroll" in resp.text.lower() and resp.status_code >= 400:
                print(f"Scroll cursor invalid/expired (HTTP {resp.status_code}); reopening fresh scroll.")
                scroll_id = None
                time.sleep(1.0)
                continue

            resp.raise_for_status()
            payload = resp.json()
            batch = payload.get("rids", [])
            if not batch:
                break

            for rid in batch:
                if rid not in seen_set:
                    seen_set.add(rid)
                    seen.append(rid)

            pages += 1
            scroll_id = payload.get("scroll_id")
            if not scroll_id:
                break
            time.sleep(page_delay)

    return seen

Three rapid calls in the live checks returned a plain-text 429 Rate limit exceeded.. The code checks the status before parsing JSON, and the complete drainer waits 1.1 seconds between scroll pages.

The documented inactivity window is about 15 seconds. The measured cursor survived 25 and 65 seconds idle, then returned HTTP 400 at 130 seconds with Scroll session has expired or is invalid. Please initiate a new scroll request. A bogus cursor returned HTTP 500.

The complete client raises ScrollExpiredError for those failures during an active scroll. The drainer reopens the listing and uses its persisted RID set to skip responses it has already written.

An empty listing ends a scan pass. The complete drainer can start another pass after polling, because an accepted RID may not yet have a stored result.

Retrieve bulk responses and normalize their representation

"Bulk" here is a server-side operation: POST /storage/bulk accepts up to 100 RIDs in one request. The application chunks discovered candidates to that size and processes the returned items.

In the live checks, RIDs beyond the first 100 were dropped, and RIDs with no stored result were simply absent from the returned array, the case the documentation describes as "RID not found". A response can therefore hold fewer items than requested. The complete client rejects a caller-supplied batch larger than 100, and the drainer only marks returned, persisted RIDs as processed.

Each returned body is base64 over gzip-compressed content. The decoder removes those layers and turns the bytes into text:

python
def decode_item(item: dict) -> dict:
    raw_b64 = item.get("body", "")
    raw_bytes = base64.b64decode(raw_b64) if raw_b64 else b""
    if raw_bytes[:2] == b"\x1f\x8b":
        raw_bytes = gzip.decompress(raw_bytes)
    text = raw_bytes.decode("utf-8", errors="replace")

    # Live POST /storage/bulk returns pc_status; docs show cb_status.
    cb_status = item.get("cb_status") if "cb_status" in item else item.get("pc_status")
    domain_complexity = None
    cb_headers = str(item.get("callback_headers") or "")
    for part in cb_headers.split("|"):
        if part.lower().startswith("x-domain-complexity:"):
            domain_complexity = part.split(":", 1)[1].strip()

    # If pushed with format=json, Storage stores the JSON envelope inside body.
    if text.lstrip().startswith("{") and '"body"' in text and '"original_status"' in text:
        try:
            inner = json.loads(text)
            if isinstance(inner, dict) and "body" in inner:
                domain_complexity = inner.get("domain_complexity") or domain_complexity
                text = str(inner["body"])
        except json.JSONDecodeError:
            pass

    return {
        "rid": item["rid"],
        "url": item["url"],
        "stored_at": item.get("stored_at"),
        "original_status": item.get("original_status"),
        "cb_status": cb_status,
        "domain_complexity": domain_complexity,
        "body": text,
    }

The live bulk responses exposed the legacy pc_status field where current documentation shows cb_status. Both the walkthrough and the complete client normalize it into the application's cb_status field. Stored items also carried original_status, stored_at, rid, url, and an undocumented callback_headers string observed as X-Domain-Complexity:standard.

Requests pushed with format=json stored a JSON response envelope inside the encoded body. The decoder unwraps it to keep the body and the domain complexity. In the separate scraper=generic-extractor check, the decoded body was scraper JSON directly and stayed JSON text. The complete decoder checks for an envelope's status and body fields before unwrapping it, and can recover missing outer status values from that envelope.

The application keeps the decoded body and the acquisition metadata, including target 404 responses. It runs no business-field extraction over the HTML; downstream parsers consume the saved bodies later.

Write decoded responses into dated Parquet parts

A Parquet file stores typed columns separately. The application uses PyArrow to turn decoded items into a fixed schema:

Column Arrow type Application value
rid String Stored response identifier
url String URL returned with the stored item
domain String Network location from urlparse(url).netloc
stored_at String Original storage timestamp
original_status Int64 Target HTTP status
cb_status Int64 Normalized response status
domain_complexity String Available complexity metadata
body_len Int64 Number of Python characters in the decoded body
body String Decoded response text

The schema permits nulls. Missing storage timestamps, statuses or complexity values do not reject an item in the complete implementation. Both statuses are converted to integers when present.

The sink groups records by date and writes paths such as out/dt=2026-11-30/part-00000.parquet. This is Hive-style partitioning: dt=2026-11-30 puts a column name and value in a directory name. dt is not written into the nine-column schema; DuckDB reconstructs it when reading with hive_partitioning=true.

The partition helper takes the first ten characters of stored_at. If the timestamp is absent or too short, it uses the current UTC date. It does not otherwise convert timestamps, and stored_at itself stays a string, so an offset-bearing timestamp is partitioned by its displayed date.

The writing walkthrough writes a temporary file and moves the completed Parquet file into place with os.replace:

python
written: list[Path] = []
for dt, rows in grouped.items():
    part_dir = out_dir / f"dt={dt}"
    part_dir.mkdir(parents=True, exist_ok=True)
    existing = sorted(part_dir.glob("part-*.parquet"))
    next_idx = len(existing)
    target = part_dir / f"part-{next_idx:05d}.parquet"
    tmp = part_dir / f".part-{next_idx:05d}.parquet.tmp"

    table = pa.Table.from_pylist(rows, schema=SCHEMA)
    pq.write_table(table, tmp, compression="zstd")
    os.replace(tmp, target)
    written.append(target)
return written

The writer uses Zstandard compression, which PyArrow's Parquet interface supports. The temporary filename ends in .tmp, so a reader's *.parquet pattern never picks up an unfinished write.

The walkthrough chooses the next filename from the number of existing parts in an append-only directory. The complete ParquetSink instead finds the highest existing numeric suffix and adds one, which tolerates gaps in the numbering. Run one drainer against an output tree: filename allocation does not coordinate overlapping writers.

Although the complete sink's default buffer threshold is 5,000 rows, the drainer calls flush_all() after every returned bulk batch. That commits each batch before cleanup and normally produces parts of at most 100 rows, split further when timestamps span dates.

Delete source copies after the local commit

In this project, draining means retrieving stored results, saving them locally, and deleting the remote copies. The default mode finishes the local write before it asks for cleanup.

The default two-phase mode orders the work as follows:

  1. Retrieve a batch with auto_delete=false.
  2. Decode its returned items and write their Parquet parts.
  3. Publish the completed files with os.replace.
  4. Submit the returned RIDs to POST /storage/bulk_delete.

The two-phase label describes that sequence of retrieval, file writing and deletion. No transaction spans the storage service and the local filesystem.

With --delete-mode auto, the bulk request sends auto_delete=true. The service removes the returned entries during retrieval, before the application has committed its Parquet files. An interruption in that interval can lose the stored copies of up to 100 returned items from that call.

The default mode adds a separate delete request per returned batch. Auto mode removes that call. Listing, statistics, polling and retry requests still contribute to the total.

Every step is restartable. SQLite skips pushed URLs, Parquet skips drained RIDs, and DuckDB catches lost rows. Write-before-delete is the default; auto mode deletes during retrieval.

If the process stops after writing Parquet but before deletion, the remote copies remain. On restart the drainer skips RIDs already found in the files; it does not retry those deletions through a separate cleanup queue. Its deleted_count statistic grows by the number of persisted RIDs without inspecting each returned deletion status, so check the storage inventory separately when confirming cleanup.

The recorded 110-URL run did check the service inventory separately: after collection completed, totalCount returned to the original 91 pages, leaving none from that run.

Resume collection and reconcile the expected results

On startup, the drainer reads the distinct RIDs from the existing Parquet files. It combines that persisted set with the checkpoint's expected RIDs to decide which newly listed items still need retrieval.

With checkpoint scoping enabled, a normal run finishes when every expected RID has a persisted row and the crawler's waiting count is zero. A zero waiting count on its own is not enough, because workers may already be processing those jobs.

If returned items are missing from a partial batch, those RIDs stay pending. The outer loop scans again and sleeps for the default ten-second polling interval when a pass finds nothing new, within a default 900-second wait budget between passes. --once stops after one pass, and --max-batches supports a deliberate partial run.

A separate completeness check compares the SQLite expectation with the files. The gap walkthrough uses a DuckDB left join:

python
db = duckdb.connect()
db.register("pushed", pushed_table)
glob_expr = str(out_dir / "**" / "*.parquet").replace("\\", "/")
missing = db.execute(
    f"""
    SELECT p.url, p.rid
    FROM pushed p
    LEFT JOIN read_parquet('{glob_expr}', hive_partitioning=true) d
      ON p.rid = d.rid
    WHERE d.rid IS NULL
    ORDER BY p.url
    """
).fetchall()
db.close()
return [(r[0], r[1]) for r in missing]

In the recorded checks, find_by_rid and delete_job returned 400 for the Storage-mode crawler while crawler details and /stats returned 200, so the verification step relies on the local checkpoint and the Parquet files.

verify.py performs the checkpoint-to-Parquet comparison; it does not itself inspect queue or storage readiness. A missing row means an accepted RID has no local record yet. It may still be awaiting crawl completion or collection.

Recover the final ten responses without re-submission

The live restart demonstration stopped drainer.py after one 100-item batch with --max-batches 1. Verification then printed:

text
pushed=110 drained=100 missing=10
  MISSING cc38a88016ed072cff10f794 -> https://books.toscrape.com/catalogue/page-1.html
  MISSING 0f1a3c414bf1eb88226d3fd5 -> https://books.toscrape.com/catalogue/page-11.html
...

Restarting the drainer collected the remaining ten responses in 5.54 seconds and brought missing to zero. It reused the existing checkpoint and files, fetching only the responses still missing locally.

If a result has expired or been deleted, verify.py --repush removes its old RID mapping and submits the URL again. That produces a new crawl and a new RID. Confirm that a missing result is not simply awaiting completion or collection before replacing it.

Keep the original input URL file available during recovery. The current re-push function removes old checkpoint entries before the replacement submissions are accepted, so an interrupted re-push can leave entries absent from the next completeness check. Re-running the pusher with the retained input restores those URLs to the submission workflow.

Query the files directly with DuckDB

Once Parquet parts exist, the query walkthrough registers the checkpoint rows from an Arrow table and creates a view over the output files:

python
glob_expr = str(out_dir / "**" / "*.parquet").replace("\\", "/")
con = duckdb.connect()
con.register("pushed", pushed_table)
con.execute(f"CREATE VIEW drained AS SELECT * FROM read_parquet('{glob_expr}', hive_partitioning=true)")

print("=== Per-domain counts and average body length ===")
print(
    con.sql(
        """
        SELECT domain,
               COUNT(*) AS pages,
               ROUND(AVG(body_len), 1) AS avg_body_chars,
               MIN(body_len) AS min_body_chars,
               MAX(body_len) AS max_body_chars
        FROM drained
        GROUP BY domain
        ORDER BY pages DESC
        """
    )
)

duckdb.connect() creates an in-memory connection here. The drained view reads the physical Parquet files; it does not import them into a persistent DuckDB database.

With Hive partition interpretation, the path supplies dt, and date-shaped values are inferred as dates. A filter on dt can skip other partition directories. Column projection lets summary queries read the metadata and length columns without materializing every full body. Filtering data columns such as domain or original_status is separate from directory pruning and can benefit from Parquet statistics.

The supplied queries summarize all partitions. Every part uses the same fixed application schema, and the readers do not enable schema unification for differently shaped files.

The complete analyze.py executes queries.sql and also builds a Polars summary from a DuckDB Arrow result. Its recorded crawl contained 50 catalogue pages and two deliberate 404 URLs on books.toscrape.com, 48 URLs on example.com, and ten on quotes.toscrape.com:

text
│ example.com         │    48 │          577.0 │            577 │            577 │           48 │
│ quotes.toscrape.com │    10 │        10823.8 │           9901 │          13699 │           10 │
└─────────────────────┴───────┴────────────────┴────────────────┴────────────────┴──────────────┘

=== Target HTTP status vs Crawlbase status distribution ===
┌─────────────────┬───────────┬───────┬────────┐
│ original_status │ cb_status │ pages │  pct   │
│      int64      │   int64   │ int64 │ double │
├─────────────────┼───────────┼───────┼────────┤
│             200 │       200 │   108 │  98.18 │
│             404 │       200 │     2 │   1.82 │
└─────────────────┴───────────┴───────┴────────┘

=== Pushed vs drained completeness check ===
┌─────────────┬──────────────┬──────────────┬──────────────┐
│ pushed_rids │ drained_rids │ missing_rids │ coverage_pct │
│    int64    │    int64     │    int64     │    double    │
├─────────────┼──────────────┼──────────────┼──────────────┤
│         110 │          110 │            0 │        100.0 │
└─────────────┴──────────────┴──────────────┴──────────────┘

=== Partition and domain complexity tier summary ===
┌────────────┬─────────────────┬───────┬─────────────┐
│     dt     │ complexity_tier │ pages │ decoded_kib │
│    date    │     varchar     │ int64 │   double    │
├────────────┼─────────────────┼───────┼─────────────┤
│ 2026-11-30 │ standard        │   110 │     2614.58 │
└────────────┴─────────────────┴───────┴─────────────┘

Read RID coverage and HTTP status separately

All 110 expected RIDs had local records, which is 100.0% RID coverage. Of those responses, 108 had original_status=200 and cb_status=200, or 98.18%. The two deliberately missing targets returned original_status=404 with cb_status=200, the remaining 1.82%.

The two 404 records show why both statuses matter. Crawlbase fetched the target's 404 response, and those calls were billable. A downstream parser can require both statuses to be 200 before it treats a response as a usable page.

The query reports decoded_kib=2614.58 by calculating SUM(body_len) / 1024.0. Despite the label, it divides a character count by 1024. It measures neither UTF-8 bytes nor compressed Parquet size.

The sample averaged about 24,339 decoded characters per response. Applying that average to 100,000 responses gives roughly 2.43 billion characters; the byte size depends on the content's encoding, and compressed file size has to be measured from the files themselves.

At 100 returned items per call, 100,000 responses would take 1,000 bulk retrieval calls. Partial returns and page boundaries can raise that count, and the default mode also issues separate cleanup requests. These are planning estimates; the recorded timings come from the 110-URL run.

Run the complete pipeline and its offline checks

After configuring final/.env, run these commands from the repository root:

bash
cd final
python pusher.py --url-file urls_sample.txt --crawler storage-duckdb-demo
python drainer.py --crawler storage-duckdb-demo
python verify.py --crawler storage-duckdb-demo
python analyze.py --crawler storage-duckdb-demo

pusher.py submits the sample and commits the accepted RIDs. drainer.py retrieves ready results, writes Parquet, and cleans up in the default two-phase mode. verify.py reports expected RIDs missing from the local files, and analyze.py runs the SQL summaries.

Use --limit 5 on the pusher for a smaller first batch. To reproduce the deliberate collection boundary, pass --max-batches 1 to the drainer, run verification, then restart the drainer with the same database and output directory.

Keep walkthrough state separate from the complete pipeline's database. The standalone pusher's smaller SQLite schema is not migrated into the complete checkpoint schema.

From final/, run the included pytest suite:

bash
python -m pytest -v

The ten test cases use mocked HTTP responses and local temporary data. They exercise submission retries and checkpoint reuse, queue-cap waiting, bulk decoding and batching, scroll reopening, writing files before deletion, both deletion modes, the limiter's one-second window, Hive partitions, gap reconciliation, analytics, and the walkthrough command interfaces. Those checks are separate from the recorded live delivery results.

Manage the queue and storage retention

The management API provides pause, unpause, purge and deletion independently of the local files. The recorded pause and unpause requests returned 200. Pausing halts worker pickup while still allowing new pushes.

Purging removes waiting work while keeping the crawler definition. Deleting removes the crawler itself; the recorded cleanup call returned 200. Both remove queued work irreversibly.

The push parameter queue_timeout controls how long a request may wait for a worker. Its documented range is one to 10,080 minutes, with zero or omission disabling it. Once a worker starts crawling, that waiting-time limit no longer applies. The documented expiry outcome is HTTP 504 with cb_status=699, which is separate from an HTTP client's request timeout.

Cloud Storage retention is 30 days by default, with extensions on enterprise plans. Retrieval is documented as free. Schedule collection soon after submission so the retained responses move into the dataset you control before they expire.

The resulting directory can serve as the file layer of a web data lakehouse, but this project implements Parquet files, a submission checkpoint and SQL queries over them. It adds no transactional table metadata, coordinated multi-writer commits, or persistent analytical database. When the job does need event-driven handling, Incremental RAG Indexing shows the same crawler on webhook delivery.

Conclusion

Storage delivery separates the managed crawl from the consumer's schedule. In the recorded run, the collector stopped after writing 100 responses and later retrieved the remaining ten without re-submitting their URLs.

With Crawlbase managing the queue, the crawl execution and the stored responses, the local job tracks accepted RIDs and committed Parquet files. The default write-before-delete order keeps the source until after a local commit, and the RID join identifies expected responses that still need collection.

Start with a small batch in the complete implementation, keep its database and output directory, and check RID coverage before querying the files in DuckDB. Then use your own URL list with the same rate controls, persistence order and reconciliation step.

Crawlbase Enterprise Crawler and Cloud Storage

Queue bulk crawls without a public receiver: create the crawler without a callback URL, push up to 30 URLs per second, and pull the stored responses 100 RIDs at a time whenever your collector runs. Start with up to 5,000 free requests, no card.

Frequently Asked Questions (FAQs)

When should I use webhook delivery instead of Storage delivery?

Use a webhook when results need immediate event-driven handling and you already operate a reliable public receiver. The Enterprise Crawler documentation requires an acknowledgment within 200 ms and describes endpoint monitoring and delivery retries. Storage delivery suits scheduled collection and machines without public ingress. Create a crawler with the delivery mode you need and confirm its configuration before sending the workload.

Does 100% RID coverage mean every target page succeeded?

No. It means every expected RID in the submission checkpoint has a matching local record. The live run reached 100.0% coverage while keeping two intentional 404 responses. Check original_status and cb_status separately, then apply whatever content validation the downstream extraction needs.

Can re-pushing a missing URL recover an expired or deleted capture?

It performs a new crawl with a new RID. The page may have changed since the original request, so a replacement capture is not a recovery of the old response. Resume ordinary draining first while the original stored result is still available; use re-push for work that has to be fetched again.

Can I keep pushing new URLs while this drainer runs?

The current drainer reads its expected checkpoint RIDs once at startup, and new checkpoint entries are not added to that in-memory set. Finish a submission batch before starting its drainer, or restart collection after adding a batch. Keep one drainer per output directory and retain the matching checkpoint.

Start Building

Crawl any site at scale, without fighting infrastructure.

Crawlbase handles proxies, fingerprints, and CAPTCHAs so your team ships data pipelines instead of maintaining crawl plumbing. Up to 5,000 requests free, no card required.

Self-serve · No sales call required · Enterprise crawl volumes available