Metadata-Version: 2.4
Name: wayback-archive
Version: 1.6.0
Summary: Download archived websites from the Wayback Machine for offline viewing
Author: GeiserX
License-Expression: GPL-3.0-or-later
Project-URL: Homepage, https://github.com/GeiserX/Wayback-Archive
Project-URL: Documentation, https://geiserx.github.io/Wayback-Archive/
Project-URL: Changelog, https://github.com/GeiserX/Wayback-Archive/blob/main/CHANGELOG.md
Project-URL: Issues, https://github.com/GeiserX/Wayback-Archive/issues
Keywords: wayback-machine,internet-archive,web-archive,offline,website-downloader,archiving
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: System :: Archiving
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.32.0
Requires-Dist: beautifulsoup4>=4.12.0
Requires-Dist: minify-html>=0.15.0
Requires-Dist: rcssmin>=1.1.0
Requires-Dist: rjsmin>=1.2.0
Requires-Dist: Pillow>=10.0.0
Requires-Dist: lxml>=5.0.0
Requires-Dist: urllib3>=2.0.0
Requires-Dist: python-dotenv>=1.0.0
Dynamic: license-file

<p align="center">
  <img src="https://raw.githubusercontent.com/GeiserX/Wayback-Archive/main/docs/images/banner.svg" alt="Wayback-Archive banner" width="900"/>
</p>

<p align="center">
  <strong>Rescue whole websites from the Wayback Machine.</strong>
</p>

<p align="center">
  <a href="https://pypi.org/project/wayback-archive/"><img src="https://img.shields.io/pypi/v/wayback-archive?style=flat-square&logo=pypi&logoColor=white" alt="PyPI version"></a>
  <a href="https://github.com/GeiserX/Wayback-Archive/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/GeiserX/Wayback-Archive/ci.yml?style=flat-square&logo=github&label=build" alt="Build"></a>
  <a href="https://github.com/GeiserX/Wayback-Archive/blob/main/LICENSE"><img src="https://img.shields.io/github/license/GeiserX/Wayback-Archive?style=flat-square" alt="License"></a>
  <a href="https://pypi.org/project/wayback-archive/"><img src="https://img.shields.io/pypi/dm/wayback-archive?style=flat-square" alt="PyPI downloads per month"></a>
  <a href="https://github.com/GeiserX/Wayback-Archive/stargazers"><img src="https://img.shields.io/github/stars/GeiserX/Wayback-Archive?style=flat-square" alt="GitHub stars"></a>
</p>

---

Wayback-Archive is a command-line tool that downloads an archived website from the [Wayback Machine](https://web.archive.org/) and rebuilds it as a folder you can open offline. It fetches every page and asset it can find in the snapshot, rewrites the links to local paths and removes the Wayback Machine's own toolbar, scripts and URL prefixes, so the copy looks like the site did on that day. `wget --mirror` and `httrack` do not understand Wayback Machine URLs; this does.

<p align="center">
  <img src="https://raw.githubusercontent.com/GeiserX/Wayback-Archive/main/docs/images/screenshots/restored.png" alt="The python.org homepage of 31 December 2005, rescued and opened from the local copy: original layout, stylesheet and images, no Wayback Machine toolbar" width="900"/>
</p>

## Features

- Saves HTML, CSS, JavaScript, images and fonts, following links in HTML, CSS and JavaScript until nothing is left to fetch.
- Every link in the copy points at the local file, so pages open and lead to each other without the Wayback toolbar or its URL prefixes.
- A page or file missing from the snapshot is looked up at up to three other Wayback timestamps (a day either side and a week earlier) before it is given up on.
- A capture that is an archived error or a Cloudflare challenge page is replaced with the nearest good capture.
- Google Fonts are saved locally, and a font the archive returns as an HTML error page is dropped instead of breaking the page.
- Pages still work when the archive lost jQuery: a copy is fetched from `code.jquery.com` instead.
- Social icon groups, button links and cookie banners keep working in the copy.
- Analytics and ads are stripped by default; external iframes too, with `REMOVE_EXTERNAL_IFRAMES=true`.
- Optional HTML, CSS, JavaScript and image minification for a smaller folder.

## Quick start

```bash
pipx install wayback-archive
wayback-archive "https://web.archive.org/web/20051231235226/http://www.python.org/" --max-files 50
open output/index.html                     # Linux: xdg-open output/index.html
```

Every option is also an environment variable, so the same run can be written as:

```bash
WAYBACK_URL="https://web.archive.org/web/20051231235226/http://www.python.org/" MAX_FILES=50 wayback-archive
```

Use 1.5.0 or later: in 1.4.6 and earlier an archived page can make the tool fetch any host directly and save the response ([#55](https://github.com/GeiserX/Wayback-Archive/pull/55)), and `pipx upgrade wayback-archive` moves an existing install (one made with Python 3.9 needs `pipx reinstall --python python3.10 wayback-archive` instead). Needs Python 3.10 or newer (pip on 3.9 finds no release it can install); `pip install` works too, and the other install paths are in [Getting started](https://geiserx.github.io/Wayback-Archive/getting-started/). That run takes about a minute, ends with a `Download Complete!` block counting the files downloaded, failed and skipped, and opens from disk as the page above: the homepage, its stylesheet and its images are all within the first 50 files. Drop `--max-files` to fetch the whole site. On another site a short run can stop before a stylesheet that is only reached through `@import`, because the crawl fetches files in the order it finds them. Every setting is a flag, an environment variable or a line in a `.env` file, in that order of precedence; `wayback-archive --help` lists them and [Configuration](https://geiserx.github.io/Wayback-Archive/configuration/) explains each one.

## Documentation

The full documentation is at https://geiserx.github.io/Wayback-Archive/.

- [Getting started](https://geiserx.github.io/Wayback-Archive/getting-started/): pipx, pip or a checkout, and the first run
- [Configuration](https://geiserx.github.io/Wayback-Archive/configuration/): every environment variable and its default
- [Usage](https://geiserx.github.io/Wayback-Archive/usage/): macOS, Linux and Windows shells, the quick test, opening the copy
- [Features](https://geiserx.github.io/Wayback-Archive/features/): the full list and the comparison with wget and httrack
- [How it works](https://geiserx.github.io/Wayback-Archive/how-it-works/): the crawl steps, the fallbacks and the project layout
- [Troubleshooting](https://geiserx.github.io/Wayback-Archive/troubleshooting/): fonts, missing icons, libraries that do not load
- [Development](https://geiserx.github.io/Wayback-Archive/development/): tests and contributing
- [Related projects](https://geiserx.github.io/Wayback-Archive/related/): the other Wayback tools

## Related projects

[Wayback-Diff](https://github.com/GeiserX/Wayback-Diff), [Way-CMS](https://github.com/GeiserX/Way-CMS), [web-mirror](https://github.com/GeiserX/web-mirror), [media-download](https://github.com/GeiserX/media-download), [n8n-nodes-way-cms](https://github.com/GeiserX/n8n-nodes-way-cms) (archived).

## License

[GPL-3.0-or-later](https://github.com/GeiserX/Wayback-Archive/blob/main/LICENSE)
