Skip to main content

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

Simple usage of the WaybackMachine class is as

from waybackmachine import WaybackMachine

url = "https://www.gov.pl/web/koronawirus/wykaz-zarazen-koronawirusem-sars-cov-2"
for response,version_time in WaybackMachine(url):
    # process response
    pass

The iterated version goes from newest to the older and older version all the way to end date at given step of date axis for querying the archive.

Returned are

  • response = string response
  • version_time = datetime of the version

Update of package is done with

pip install --upgrade waybackmachine

Start, end and step configuration

Library enables setting of start date, end date and step size as timedelta.

Since iterating is done backwards in time, end date precedes start date!

Setting the querying for weekly from 1st May back to 1st February 2020 is done with

from datetime import datetime,timedelta
from waybackmachine import WaybackMachine

url = "https://www.liu.se/"
for response,version_time in WaybackMachine(url, start = datetime(2020,5,1), end = datetime(2020,2,1), step = timedelta(days = 7)):
    # process response
    pass

The date can be also specified one of following string formats:

  • %Y-%m-%d
  • %Y-%m-%d %H:%M
  • %Y-%m-%d %H:%M:%S
for response,version_time in WaybackMachine(url, start = "2020-05-01", end = "2020-02-01", step = timedelta(days = 7)):
    # process response
    pass

String representation of timedelta will be added.

Configurations

On frequent use-cases, custom configurations of parameters are added to the packages.

These consist of default parameter values.

So far following configurations are available:

  • default - start is now(), end is beginning of year of start (hence length can be 0 - 365 days), 1 day step
  • covid - start is now() (might be changed, if covid disappears), end is 2020-01-01, COVID-19 spread into the world after. In China the COVID-19 has already occurred before!. Step is 12 h.

Contribution

Developed by Martin Benes.

Join on GitHub.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

waybackmachine-0.1.4.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

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

waybackmachine-0.1.4-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file waybackmachine-0.1.4.tar.gz.

File metadata

  • Download URL: waybackmachine-0.1.4.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3rc1

File hashes

Hashes for waybackmachine-0.1.4.tar.gz
Algorithm Hash digest
SHA256 7241e499dee2aa2c0af4998f88cd037dea55fdcde7a16cc33d7f476b095e031a
MD5 489d6d551c0f01cf3771baa2fed8772b
BLAKE2b-256 cd92716908344995924f0cb0440e30790ebf7f2c999df43609554e64e1b92840

See more details on using hashes here.

File details

Details for the file waybackmachine-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: waybackmachine-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3rc1

File hashes

Hashes for waybackmachine-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9a4617c76236e623b11fab3f55bee9985221764dc8f2a8132dbfc541aa51d7b5
MD5 5da038b3dba2a96a830b2043e0a3eaac
BLAKE2b-256 3af5565595dcdee1e8482aff31fa0791d8bbda4585009e6c336bbac9f78747eb

See more details on using hashes here.

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