Python WayBack Machine for web archive replay
pywb is a new Python implementation of the Wayback Machine software and tools.
At its core, it provides a web app which ‘replays’ archived web data stored in ARC and WARC files and provides metadata about the archived captures.
The basic feature set of web replay is nearly complete in this version.
pywb now features new domain-specific rules which are applied to certain difficult and dynamic content in order to make web replay work.
This rules set will be under constant iteration to deal with new challenges as the web evoles.
pywb is compatible with the standard Wayback Machine url format:
Some examples of this url from other wayback machines (not implemented via pywb):
A listing of archived content, often in calendar form, is available when a * is used instead of timestamp.
pywb provides these features as a starting point.
pywb has tested in python 2.6, 2.7 and pypy.
It runs best in python 2.7 currently.
pywb tool suite provides several WSGI applications, which have been tested under wsgiref and uWSGI.
For best results, the uWSGI container is recommended.
Support for Python 3 is planned.
pywb comes with a a set of sample archived content, also used by the test suite.
The data can be found in sample_archive and contains warc and cdx files.
The sample archive contains recent captures from http://example.com and http://iana.org
The pywb tool suite currently includes two runnable applications, installed as command-line scripts via setuptools
- wayback or python -m pywb.apps.wayback – start the full wayback on port 8080
- cdx-server or python -m pywb.apps.cdx_server – start standalone cdx server on port 8090
To start a pywb with sample data:
- Clone this repo
- Install with python setup.py install
- Run wayback (shorthand for python -m pywb.apps.wayback) to start the pywb wayback server with reference WSGI implementation.
OR run run-uwsgi.sh to start with uWSGI (see below for more info).
- Test pywb in your browser! (pywb is set to run on port 8080 by default).
If everything worked, the following pages should be loading (served from sample_archive dir):
|Original Url||Latest Capture||List of All Captures|
uWSGI startup script
A sample uWSGI start up script, run-uwsgi.sh which assumes a default uWSGI installation is provided as well.
Currently, uWSGI is not installed automatically with this distribution, but it is recommended for production environments.
Please see uWSGI Installation for more details on installing uWSGI.
pywb comes with a Vagrantfile to help you set up a VM quickly for testing and deploy pywb with uWSGI.
git clone https://github.com/ikreymer/pywb.git cd pywb vagrant up
After pywb and all its dependencies are installed, the uWSGI server will startup
spawned uWSGI worker 1 (and the only) (pid: 123, cores: 1)
At this point, you can open a web browser and navigate to the examples above for testing.
Currently pywb includes a full (and growing) suite of unit doctest and integration tests.
Top level integration tests can be found in the tests/ directory, and each subpackage also contains doctests and unit tests.
The full set of tests can be run by executing:
python setup.py test
which will run the tests using py.test.
The py.test coverage plugin is used to keep track of test coverage.
pywb is configurable via yaml.
The simplest config.yaml is roughly as follows:
collections: pywb: ./sample_archive/cdx/ archive_paths: ./sample_archive/warcs/
This sets up pywb with a single route for collection /pywb
(The the latest version of config.yaml contains additional documentation and specifies all the optional properties, such as ui filenames for Jinja2/html template files.)
For more advanced use, the pywb init path can be customized further:
Configuring PyWb With Archived Data
Please see the PyWb Configuration for latest instructions on how to setup pywb to run with your existing WARC/ARC collections.
You are encouraged to fork and contribute to this project to improve web archiving replay
Please take a look at list of current issues and feel free to open new ones