Install savepagenow
mainYou can install savepagenow from PyPI using pip or pipenv.
To install using pipenv:
pipenv install savepagenowrepository·main·Indexed 42 days ago
https://github.com/palewire/savepagenowA Python library and CLI tool for saving web pages to the Internet Archive. It provides the capture() and capture_or_cache() methods to request archives of URLs, supports authentication via SAVEPAGENOW_ACCESS_KEY and SAVEPAGENOW_SECRET_KEY to increase capture limits, and allows customization of the User-Agent header.
You can install savepagenow from PyPI using pip or pipenv.
To install using pipenv:
pipenv install savepagenowTo install the package in editable mode for local CLI development within a virtual environment, use:
pip install --editable .By default, savepagenow uses the user agent "savepagenow (https://github.com/pastpages/savepagenow)". You can override this in both the Python API and the CLI.
Python:
savepagenow.capture("http://www.example.com/", user_agent="my user agent here")CLI:
savepagenow http://www.example.com/ --user-agent "my user agent here"By default, anonymous requests are limited to 3 captures per minute. Authenticated requests allow 6 captures per minute.
To authenticate:
SAVEPAGENOW_ACCESS_KEYSAVEPAGENOW_SECRET_KEYcapture() with authenticate=True.savepagenow.capture(url, authenticate=True)If archive.org returns an existing snapshot instead of performing a new capture, the capture() method raises a savepagenow.exceptions.CachedPage exception.
To avoid handling exceptions, use capture_or_cache(). This method returns a tuple containing the archive URL and a boolean: True if it was a fresh capture, or False if it was retrieved from the cache.
# Using capture_or_cache to avoid exceptions
url, captured = savepagenow.capture_or_cache("http://www.example.com/")
# url: the archive URL
# captured: True if fresh, False if from cacheImport the library and use the capture() method to request a new archive of a URL. The method returns the URL of the archived page on archive.org.
import savepagenow
# Capture a URL
archive_url = savepagenow.capture("http://www.example.com/")
print(archive_url)The following options are available for the savepagenow command:
-ua, --user-agent TEXT: User-Agent header for the web request.-c, --accept-cache: Accept and return cached URL.-a, --authenticate: Allows you to run saves with authentication.--help: Show this message and exit.Usage: savepagenow [OPTIONS] URL
Archive the provided URL using archive.org's Wayback Machine.
Raises a CachedPage exception if archive.org declines to conduct a new
capture and returns a previous snapshot instead.
Options:
-ua, --user-agent TEXT User-Agent header for the web request
-c, --accept-cache Accept and return cached URL
-a, --authenticate Allows you to run saves with authentication
--help Show this message and exit.The package provides a command-line interface to archive URLs directly from the terminal.
savepagenow https://example.com/