waybackmachine

Envelope for archive.org API.


Keywords
waybackmachine, archive, web, html, webscraping
License
Other
Install
pip install waybackmachine==0.5.0

Documentation

PyPI version PyPI downloads Stars Contributors Wheel Status PyPi license Last commit

Wayback Machine

This project is an envelope for simple fetching of historical versions of page from archive.org API.

The page can be used for subsequent webscraping

Setup and usage

Install from pip with

pip install waybackmachine

To fetch the latest version from archive, simply use fetch() function.

import waybackmachine as wm

url = "https://en.wikipedia.org/wiki/COVID-19"
latest = wm.fetch(url)
latest.response  # requests.Response
latest.date  # capture time
latest.url  # url

Optionally you can specify date. The first version after this date is chosen.

may2020 = wm.fetch(url, date="2020-05-01")

Browsing

You can also iterate archived versions backwards in time.

for version in wm.browse(url):
    version.response  # requests.Response
    version.date  # capture time
    version.url  # url

This will iterate the screenshots from archive.org.

You can specify a custom date range as follows.

for version in wm.browse(url, start='2020-06-30', end='2020-03-01'):
    pass

Contribution

Developed by Martin Benes.

Join on GitHub.