Skip to main content

WARC exporter for the Wayback Machine

Project description

wayback2warc

A CLI tool that exports captures from the Wayback Machine and packs them into WARC files.

usage: wayback2warc [-h] [-c COLLAPSE] [-f FILTER] [-m] [-p PROXY] [-t THREADS] [-w WARC_SIZE] url [prefix]

positional arguments:
  url                   *.example.org or example.org/*
  prefix                output path prefix

options:
  -h, --help            show this help message and exit
  -c, --collapse COLLAPSE
                        dedupe records based on returned key
  -f, --filter FILTER   filter records based on returned boolean
  -m, --meta            dump cdx metadata into jsonl file
  -p, --proxy PROXY     url formatted proxy, can be a single value or a file
  -t, --threads THREADS
                        concurrent downloads (default: 2)
  -w, --warc-size WARC_SIZE
                        max size of produced warc files in MB (default: 1024)

Install

pip install wayback2warc

Usage

Download all subdomains, all pages, and all captures for a domain:

wayback2warc '*.example.org'

Download all pages and all captures for a prefix:

wayback2warc 'example.org/*'

Download all captures for a single page:

wayback2warc 'example.org'

Download all pages but only a yearly capture of each:

wayback2warc 'example.org/*' --collapse 'lambda m: (m.urlkey, m.timestamp[:4])'

Filtering and collapsing

This tool implements filtering/collapsing functionality on the client-side rather than relying on the CDX server to do so. This is a necessity due to the way CDX paging works, but on the bright side it allows for much more granular queries.

Instead of a query language, lambda functions are used to narrow down captures for downloading. A CaptureMetadata instance is passed to both functions, and the returned value is used as a key for collapsing, or as a boolean for filtering.

Collapse captures by URL excluding query: --collapse 'lambda m: m.urlkey.split("?")[0]'

Filter captures before 2020 and exclude images: --filter 'lambda m: m.timestamp < "2020" and "image/" not in m.mimetype'

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

wayback2warc-0.1.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

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

wayback2warc-0.1.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file wayback2warc-0.1.0.tar.gz.

File metadata

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

File hashes

Hashes for wayback2warc-0.1.0.tar.gz
Algorithm Hash digest
SHA256 744b5c16965cb31f8c12ebd6a87005d7c6e3edff1252fdda49bc0545bee13c1d
MD5 5ff7fa45210c6a85127f966065f2ed79
BLAKE2b-256 550033a5ae685b5ca20c48cad3f1410c49cff10cf0a059e7cabff81b10b90a9e

See more details on using hashes here.

Provenance

The following attestation bundles were made for wayback2warc-0.1.0.tar.gz:

Publisher: publish.yml on tmctmt/wayback2warc

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

File details

Details for the file wayback2warc-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: wayback2warc-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for wayback2warc-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 22319a23a69530c93b492e4b48872bded79dff30ea6c94afd77a13fb7e9c7151
MD5 7f40b31a4f1b03a57833e4d7c7b00306
BLAKE2b-256 b03c7fac64c022c0b1f8a13ed35ab24dafe389defdf7a50bde0d51e77f07984b

See more details on using hashes here.

Provenance

The following attestation bundles were made for wayback2warc-0.1.0-py3-none-any.whl:

Publisher: publish.yml on tmctmt/wayback2warc

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