Skip to main content

A Python script to submit web pages to the Wayback Machine for archiving.

Project description

Wayback Machine Archiver

Wayback Machine Archiver (Archiver for short) is a commandline utility writen in Python to backup Github Pages using the Internet Archive.

Installation

The best way to install Archiver is with pip:

pip install wayback-machine-archiver

This will give you access to the script simply by calling:

archiver --help

You can also clone this repository:

git clone https://github.com/agude/wayback-machine-archiver.git
cd wayback-machine-archiver
python ./wayback_machine_archiver/archiver.py --help

If you clone the repository, Archiver can be installed as a local application using the setup.py script:

git clone https://github.com/agude/wayback-machine-archiver.git
cd wayback-machine-archiver
./setup.py install

Which, like using pip, will give you access to the script by calling archiver.

Archiver requires the requests library by Kenneth Reitz. Archiver supports Python 2.7, and Python 3.4+.

Usage

The simplest way to schedule a backup is by specifying the URL of a web page, like so:

archiver https://alexgude.com

This will submit the main page of my blog, alexgude.com, to the Wayback Machine for archiving.

You can also archive all the URLs specified in a sitemap.xml as follows:

archiver --sitemaps https://alexgude.com/sitemap.xml

This will backup every page listed in the sitemap of my website, alexgude.com.

You can also pass a sitemap.xml file (requires the file:// prefix) to the archiver:

archiver --sitemaps file://sitemap.xml

You can backup multiple pages by specifying multiple URLs or sitemaps:

archiver https://radiokeysmusic.com --sitemaps https://charles.uno/sitemap.xml https://alexgude.com/sitemaps.xml

You can also backup multiple URLs by writing them to a file (for example, urls.txt), one URL per line, and passing that file to archiver:

archiver --file urls.txt

Sitemaps often exclude themselves, so you can request that the sitemap itself be backed up using the flag --archive-sitemap-also:

archiver --sitemaps https://alexgude.com/sitemaps.xml --archive-sitemap-also

Help

For a full list of commandline flags, Archiver has a built-in help displayed with archiver --help:

usage: archiver [-h] [--version] [--file FILE]
                [--sitemaps SITEMAPS [SITEMAPS ...]]
                [--log {DEBUG,INFO,WARNING,ERROR,CRITICAL}]
                [--log-to-file LOG_FILE] [--archive-sitemap-also]
                [--jobs JOBS] [--rate-limit-wait RATE_LIMIT_IN_SEC]
                [--random-order]
                [urls ...]

A script to backup a web pages with Internet Archive

positional arguments:
  urls                  the URLs of the pages to archive

options:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  --file FILE           path to a file containing urls to save (one url per line)
  --sitemaps SITEMAPS [SITEMAPS ...]
                        one or more URIs to sitemaps listing pages to archive; local paths must be prefixed with 'file://'
  --log {DEBUG,INFO,WARNING,ERROR,CRITICAL}
                        set the logging level, defaults to WARNING
  --log-to-file LOG_FILE
                        redirect logs to a file
  --archive-sitemap-also
                        also submit the URL of the sitemap to be archived
  --jobs JOBS, -j JOBS  run this many concurrent URL submissions, defaults to 1
  --rate-limit-wait RATE_LIMIT_IN_SEC
                        number of seconds to wait between page requests to
                        number of seconds to wait between page requests to avoid flooding the archive site, defaults to 5; also used as the backoff factor for retries
  --random-order        randomize the order of pages before archiving

Setting Up a Sitemap.xml for Github Pages

It is easy to automatically generate a sitemap for a Github Pages Jekyll site. Simply use jekyll/jekyll-sitemap.

Setup instructions can be found on the above site; they require changing just a single line of your site's _config.yml.

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

wayback_machine_archiver-1.10.0.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

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

wayback_machine_archiver-1.10.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file wayback_machine_archiver-1.10.0.tar.gz.

File metadata

File hashes

Hashes for wayback_machine_archiver-1.10.0.tar.gz
Algorithm Hash digest
SHA256 1b8241c565069ddbc6afc75245e40fe3a6c577d0a39e65752cc7c2ca378304ce
MD5 250946546478964ad9ca045cd65b9d30
BLAKE2b-256 54376f2476a5cfd01a3e34214ba994c6ffcae0627c6f940971d490fae08d325f

See more details on using hashes here.

Provenance

The following attestation bundles were made for wayback_machine_archiver-1.10.0.tar.gz:

Publisher: release.yml on agude/wayback-machine-archiver

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

File details

Details for the file wayback_machine_archiver-1.10.0-py3-none-any.whl.

File metadata

File hashes

Hashes for wayback_machine_archiver-1.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 185b5b8b00711f804fa07698a1b34a69aea957485aa76273422a38b4d7afa85b
MD5 a57ec5cf54bd31796ab2ecc1871b3f32
BLAKE2b-256 67c47f3ea74627e59e3127e68c0c700cb07e27074334fde1ad5f3b1c59901555

See more details on using hashes here.

Provenance

The following attestation bundles were made for wayback_machine_archiver-1.10.0-py3-none-any.whl:

Publisher: release.yml on agude/wayback-machine-archiver

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