Docs/API reference

JobConfig

The shared configuration contract for Python, Node.js, Rust and the CLI. JSON keys use snake_case in every binding.

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

Minimal configuration

Save this as job.json and create urls.txt with one HTTP(S) URL per line. Paths are relative to the process working directory. Unknown keys are rejected.

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

Input and extraction

PropertyTypeDefaultBehavior
urls_filestring / Rust PathBufRequiredUTF-8 input, one URL per line; maximum line size 8192 bytes.
output_dirstring / Rust PathBufRequiredJob-owned state, data, errors and report directory. One active writer.
fieldsJobField[] / Vec<JobField>RequiredAt least one field. Names must be unique, nonempty and cannot begin with _.
row_selectorstring / Option<String>OmittedCSS container for each record. Omit for one record per page.

Concurrency and resource limits

These limits apply to separate buffers; their sum is not a total memory guarantee. The default HTTP transport also bounds bodies while streaming at 16 MiB. A custom transport needs its own streaming limit.

PropertyTypeDefaultConstraint / scope
concurrencyinteger161–1024 concurrent pages; actual active work is also limited by the checkpoint batch size.
checkpoint_pagesinteger2561–10000 input lines per batch. The unfinished batch can replay after interruption.
checkpoint_bytesinteger33554432 (32 MiB)Positive byte budget for pending exact dedup keys and values.
max_response_bytesinteger2097152 (2 MiB)Positive per-page body limit checked before parsing.
max_records_per_pageinteger1000Positive maximum row containers per page.
max_record_bytesinteger262144 (256 KiB)Positive maximum serialized extracted field bytes per record.

Identity, source policy and output

Changing any serialized configuration or the URL-file content makes it a different job. Use a fresh output directory. JSONL values remain strings after numeric or boolean validation. Checkpointed Parquet output is not part of this API.

PropertyTypeDefaultBehavior
deduplicatebooleantrueCompare exact record identity against the on-disk index. URL deduplication is separate.
dedup_fieldsstring[][]Empty means all extracted fields; otherwise every name must be declared in fields. Metadata is excluded.
respect_robotsbooleantrueApply robots rules and crawl delay using the session User-Agent.
format"jsonl" | "csv""jsonl"Fixed-schema shards. CSV includes a header in every data shard.

TypeScript contract

Import JobConfig from crawlingo in your application. This declaration shows the current exported type; the Rust engine still validates constraints at runtime. Python accepts a dictionary, while Rust can deserialize the same JSON into JobConfig.

import type { JobField } from 'crawlingo';

interface JobConfig {
  urls_file: string;
  output_dir: string;
  fields: JobField[];
  row_selector?: string;
  concurrency?: number;
  checkpoint_pages?: number;
  checkpoint_bytes?: number;
  max_response_bytes?: number;
  max_records_per_page?: number;
  max_record_bytes?: number;
  deduplicate?: boolean;
  dedup_fields?: string[];
  respect_robots?: boolean;
  format?: 'jsonl' | 'csv';
}
typescript18 lines · copy-ready