Docs/Build a dataset

Dataset jobs

The bulk API for fetching, validating, deduplicating and exporting records without collecting the entire dataset in memory.

Download .md
Developers2 min read4 sections
Source reference · Match your SDK version. Availability and known issues
In this guide

A shared configuration

Rust, Python, Node.js and the CLI use the same JSON keys. Unknown configuration keys are rejected. Define at least one field and use a job-owned output directory.

{
  "urls_file": "urls.txt",
  "output_dir": "datasets/pages",
  "fields": [
    {
      "name": "title",
      "selector": "h1",
      "required": true
    }
  ],
  "concurrency": 16,
  "format": "jsonl"
}
json13 lines · copy-ready

Multiple rows per page

Set row_selector to the CSS container for one record. Field matches are assigned to that container, so a missing price cannot shift the price of the next product into the wrong row. Without a row selector, the page produces one record.

{
  "urls_file": "urls.txt",
  "output_dir": "datasets/products",
  "row_selector": "article.product",
  "fields": [
    {
      "name": "name",
      "selector": "h2",
      "required": true
    },
    {
      "name": "sku",
      "selector": "article.product",
      "extract_type": "attr:data-sku",
      "required": true
    },
    {
      "name": "price",
      "selector": ".price",
      "extract_type": "price",
      "data_type": "float"
    }
  ],
  "dedup_fields": [
    "sku"
  ],
  "format": "jsonl"
}
json28 lines · copy-ready

Configuration reference

The default HTTP transport caps bodies while reading at 16 MiB; the smaller job limit is checked before parsing. Custom transports must enforce their own streaming cap. Limits bound specific buffers, not total process memory.

SettingDefaultMeaning
urls_file / output_dirRequiredInput file and exclusive job directory.
fieldsRequiredNamed field extraction definitions.
row_selectorNoneCSS container for one row.
concurrency16In-flight page limit; range 1–1024.
checkpoint_pages256Input lines in one checkpoint batch; range 1–10000.
max_response_bytes2097152Body limit before parsing.
max_records_per_page1000Maximum row containers per page.
max_record_bytes262144Maximum serialized extracted field bytes.
checkpoint_bytes33554432Pending exact-dedup key/value byte budget.
deduplicatetrueExact record deduplication.
dedup_fields[]Identity fields; empty means all extracted fields.
respect_robotstrueCheck robots rules and crawl delay.
formatjsonljsonl or csv.

Run a job

import json
from crawlingo import DatasetJob

with open("job.json", encoding="utf-8") as source:
    config = json.load(source)

report = DatasetJob(config).run()
print(report["records_written"])
print(report["pages_failed"], report["records_rejected"])
python9 lines · copy-ready