nemo_curator.stages.text.download.common_crawl.download
nemo_curator.stages.text.download.common_crawl.download
Module Contents
Classes
Data
API
Bases: DocumentDownloader
Downloads WARC files from the Common Crawl to a local directory
Download a file to a temporary file.
Parameters:
URL to download
Local path to save file
Returns: bool
Tuple of (success, error_message). If success is True, error_message is None.
Generate output filename from URL.
Bases: ProcessingStage[DocumentBatch, DocumentBatch]
Reads WARC records directly from Common Crawl using HTTPS or S3 range requests.
This stage fetches raw HTML content from Common Crawl’s public servers using byte-range requests.
Get or create a boto3 S3 client with double-checked locking.
Credentials, region, and endpoint are resolved entirely by boto3’s
standard chain (AWS_* env vars, ~/.aws/config, instance
profiles). Only connection-pool and retry settings are overridden.
Get or create a requests session for connection pooling.
Fetch a single WARC record using HTTPS range request.
This method:
- Fetches gzip-compressed WARC record bytes via HTTP range request
- Decompresses the gzip content
- Parses the WARC record format using warcio
- Extracts and returns the HTTP response body (the actual content)
Fetch a single WARC record using S3 range request (boto3).
Fetch multiple records in parallel using ThreadPoolExecutor.
Derive S3 object key from the warc_filename column value.
Strips s3_key_prefix from the front of filename when present.
E.g. prefix "crawl-data/" + filename "crawl-data/CC-MAIN-…"
→ key "CC-MAIN-…". With an empty prefix the filename is used
as-is (the default for the AWS commoncrawl bucket).