Skip to main content

Python bindings for the Common Crawl downloader

Project description

cc-downloader

Python bindings for cc-downloader, a polite and user-friendly client for downloading Common Crawl data.

The library is implemented in Rust and exposes a synchronous Python API. All downloads run inside a multi-threaded Tokio runtime, so concurrent file fetching works exactly as in the CLI — the threads parameter controls how many files are downloaded in parallel.

Requirements

  • Python ≥ 3.12

Installation

pip install cc-downloader
uv add cc-downloader

Quick start

The workflow has two steps: fetch a paths index for a crawl snapshot, then download every file it lists.

import cc_downloader

# Step 1: download the paths index for WET files.
cc_downloader.download_paths(
    snapshot="CC-MAIN-2024-46",
    data_type="wet",
    dst="./output",
)

# Step 2: download every file listed in the index.
cc_downloader.download(
    paths="./output/wet.paths.gz",
    dst="./output",
    threads=10,
    progress=True,
)

API reference

download_paths

cc_downloader.download_paths(
    snapshot: str,
    data_type: str,
    dst: str,
    subsets: list[str] | None = None,
    max_retries: int = 1000,
) -> None

Downloads the gzip-compressed paths index file for a given crawl snapshot and data type to dst.

Parameter Description
snapshot Crawl identifier, e.g. "CC-MAIN-2024-46" or "CC-NEWS-2025-01"
data_type Data type: "warc", "wet", "wat", "robotstxt", "non200responses", "cc-index", "cc-index-table"
dst Destination directory
subsets For cc-index-table only: list of subsets to keep. Valid values: "crawldiagnostics", "robotstxt", "warc". Defaults to all three.
max_retries Maximum retry attempts per request (default 1000)

Example — cc-index-table with subset filtering:

cc_downloader.download_paths(
    snapshot="CC-MAIN-2024-46",
    data_type="cc-index-table",
    dst="./output",
    subsets=["warc", "robotstxt"],
)

download_contrib_paths

cc_downloader.download_contrib_paths(
    url: str,
    dst: str,
    max_retries: int = 1000,
) -> None

Downloads a paths index file directly from a contributor dataset URL.

Parameter Description
url Direct URL to the paths file. Must start with https://data.commoncrawl.org/contrib/
dst Destination directory
max_retries Maximum retry attempts per request (default 1000)

Example:

cc_downloader.download_contrib_paths(
    url="https://data.commoncrawl.org/contrib/my-dataset/paths.gz",
    dst="./output",
)

download

cc_downloader.download(
    paths: str,
    dst: str,
    threads: int = 10,
    max_retries: int = 1000,
    numbered: bool = False,
    files_only: bool = False,
    progress: bool = False,
) -> None

Downloads every file listed in a .paths.gz index. Files are fetched concurrently up to threads at a time, with exponential-backoff retries on transient failures.

Parameter Description
paths Path to a .paths.gz index file
dst Destination directory
threads Maximum concurrent downloads (default 10)
max_retries Maximum retry attempts per file (default 1000)
numbered Rename output files sequentially (0.txt.gz, 1.txt.gz, …). Only for WET files. Mutually exclusive with files_only.
files_only Write files flat into dst with no subdirectory structure. Only for WARC/WET/WAT files. Mutually exclusive with numbered.
progress Show a per-file progress bar

Example:

cc_downloader.download(
    paths="./output/wet.paths.gz",
    dst="./output",
    threads=10,
    progress=True,
)

Politeness and retries

Every HTTP request uses an exponential-backoff retry policy (bounds: 1 s – 1 h, bounded jitter, base 2). The default of 1 000 retries is intentionally high: Common Crawl is a shared public resource and transient failures are common under load. This tool is intended for use outside of AWS. You can monitor Common Crawl infrastructure traffic on the Infrastructure Status Webpage.

Avoid setting threads much higher than the default of 10. Too many concurrent requests in a short period can trigger 403 errors, which are unrecoverable and cannot be retried.

Contributing

Contributions are welcome. Please see CONTRIBUTING.md for guidelines.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Project details


Download files

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

Source Distribution

cc_downloader-1.0.0.tar.gz (49.8 kB view details)

Uploaded Source

Built Distributions

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

cc_downloader-1.0.0-cp312-abi3-win_amd64.whl (3.2 MB view details)

Uploaded CPython 3.12+Windows x86-64

cc_downloader-1.0.0-cp312-abi3-manylinux_2_28_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.28+ x86-64

cc_downloader-1.0.0-cp312-abi3-manylinux_2_28_aarch64.whl (3.9 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.28+ ARM64

cc_downloader-1.0.0-cp312-abi3-macosx_11_0_arm64.whl (3.6 MB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

cc_downloader-1.0.0-cp312-abi3-macosx_10_12_x86_64.whl (3.8 MB view details)

Uploaded CPython 3.12+macOS 10.12+ x86-64

File details

Details for the file cc_downloader-1.0.0.tar.gz.

File metadata

  • Download URL: cc_downloader-1.0.0.tar.gz
  • Upload date:
  • Size: 49.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cc_downloader-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f785ffb49a8d326d6d787be974f61f43b7f43c95a0d4254d2712a38a99004159
MD5 d4e261d95161744e54d36dae09c7361c
BLAKE2b-256 957dc1aefb59a164fd1d01633a08e7fbd06926a8b6bd8f54d23621a7b12d33d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for cc_downloader-1.0.0.tar.gz:

Publisher: release.yml on commoncrawl/cc-downloader

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

File details

Details for the file cc_downloader-1.0.0-cp312-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for cc_downloader-1.0.0-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 4ab266b4596f7e8b83caf8ca44627e4113c3e45ca9432f9718c1caae836d9d0d
MD5 584cf37d2249b68c363f1e06a36fa3cb
BLAKE2b-256 01e464866da2ff72114458cbe50ab425d04a7525b615f779eff2a380336be20b

See more details on using hashes here.

Provenance

The following attestation bundles were made for cc_downloader-1.0.0-cp312-abi3-win_amd64.whl:

Publisher: release.yml on commoncrawl/cc-downloader

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

File details

Details for the file cc_downloader-1.0.0-cp312-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cc_downloader-1.0.0-cp312-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 46936699f99fc8f107470e6ada6f17f9bfb4beeda1af85d2e2a228be0c12a6c8
MD5 d1a80f87e675f40072b690226e78f417
BLAKE2b-256 4fcebf15225251a77cf2f471ddc0f3f71b41450a79a9cbbbe616a900e7853e06

See more details on using hashes here.

Provenance

The following attestation bundles were made for cc_downloader-1.0.0-cp312-abi3-manylinux_2_28_x86_64.whl:

Publisher: release.yml on commoncrawl/cc-downloader

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

File details

Details for the file cc_downloader-1.0.0-cp312-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cc_downloader-1.0.0-cp312-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 dc3bbf7accc3043d7ff2119451ad239a6c7e0cb5a952cbbcf0630c89bf2f1580
MD5 22da3165f9632bb79c65d307024b130d
BLAKE2b-256 f45703bdd25df58068a975bafe5609d0b8ac2e0a261344507f9b8e608cd8402f

See more details on using hashes here.

Provenance

The following attestation bundles were made for cc_downloader-1.0.0-cp312-abi3-manylinux_2_28_aarch64.whl:

Publisher: release.yml on commoncrawl/cc-downloader

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

File details

Details for the file cc_downloader-1.0.0-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cc_downloader-1.0.0-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9da316db83bed6621f6317cd3c9513fb929b09e20182de4ff09f1e297a810b86
MD5 2f311535791d6315f06faf410ac4fd8e
BLAKE2b-256 b4b9bddfe9a438307992838da2798b2cef075d09ec85251df672cd1ba14cfa18

See more details on using hashes here.

Provenance

The following attestation bundles were made for cc_downloader-1.0.0-cp312-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on commoncrawl/cc-downloader

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

File details

Details for the file cc_downloader-1.0.0-cp312-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for cc_downloader-1.0.0-cp312-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 be2824dc4532ac1f46685b4ba4d5b8e29d09cdd16f4949c55c2b307cb6759f38
MD5 11b6ce32c92c11c062506f9fa2e5f27f
BLAKE2b-256 7ef0d47c20028cd5b7ea71875e6089514f659ca3bbb6fb3e85621e5cb02dea13

See more details on using hashes here.

Provenance

The following attestation bundles were made for cc_downloader-1.0.0-cp312-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on commoncrawl/cc-downloader

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

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page