Last active
December 29, 2020 06:55
-
-
Save wcaleb/218d210687546c8efd0a to your computer and use it in GitHub Desktop.
Quick script to save URL to Wayback Machine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
import sys, requests | |
# Usage: Pass URL to script, get back URL to Wayback Machine snapshot | |
base_url = 'http://web.archive.org' | |
r = requests.get(base_url + '/save/' + sys.argv[1]) | |
if r.status_code == requests.codes.ok: | |
print base_url + r.headers['content-location'] | |
else: | |
print 'Error in response: ' + str(r.status_code) | |
# or you could just return the original url | |
# print sys.argv[1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment