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

Uploaded Python 3

File details

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

File metadata

  • Download URL: wayback2warc-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 f8451a1a5e8cfc7b16da5c9362643334e17f1023fe257e3ae9e76c32a51605c0
MD5 a7cfcd1bd71191748d022025043dca35
BLAKE2b-256 789f4fbc9ee9f1f64eaccd57e15d4cb9f8d19de17dbdecfaa5fd1c3aaa7035e0

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: wayback2warc-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fd07b4bcdb4fcdf8b09ec0fa3a14b20e432b44c82867d0d34270d48ae3e97bc6
MD5 a7c9dead4ecce393b1f5bc026ea783a4
BLAKE2b-256 ef894a2697d4f781749558c38a47b70289ad6bf8f80c148f664f217aec011357

See more details on using hashes here.

Provenance

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