Skip to main content

WARC exporter for the Wayback Machine

Project description

wayback2warc

PyPI - Version

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.1.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.1-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: wayback2warc-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 f19eb1ffed8c0ab9bd7aadbbbbddf3e333599c027afe48c6e0c5fd0c585b9b6f
MD5 a6156f61d46b85a83fb8989728c1d3b5
BLAKE2b-256 9fcce781858c5732e40b363f5b5b81e91dd81b24a6e6f037a37b0b08a808d4b5

See more details on using hashes here.

Provenance

The following attestation bundles were made for wayback2warc-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: wayback2warc-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c8aa02a564e5bee271bcd72d7b9a013523ceb59e88713e0d705b889694466e1a
MD5 529af613462cc7f933f782a4b1562dcf
BLAKE2b-256 4b72389d8b87c5d75a0014cda77c209d5937d0f4101bc7cabf959b48c2dc6eda

See more details on using hashes here.

Provenance

The following attestation bundles were made for wayback2warc-0.1.1-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