I want to get all the files for a given website at archive.org. Reasons might include:
- the original author did not archived his own website and it is now offline, I want to make a public cache from it
- I am the original author of some website and lost some content. I want to recover it
- ...
How do I do that ?
Taking into consideration that the archive.org wayback machine is very special: webpage links are not pointing to the archive itself, but to a web page that might no longer be there. JavaScript is used client-side to update the links, but a trick like a recursive wget won't work.
45 Answers
I tried different ways to download a site and finally I found the wayback machine downloader - which was built by Hartator (so all credits go to him, please), but I simply did not notice his comment to the question. To save you time, I decided to add the wayback_machine_downloader gem as a separate answer here.
The site at lists these ways to download from archive.org:
- Wayback Machine Downloader, small tool in Ruby to download any website from the Wayback Machine. Free and open-source. My choice!
- Warrick - Main site seems down.
- Wayback downloaders - a service that will download your site from the Wayback Machine and even add a plugin for WordPress. Not free.
This can be done using a bash shell script combined with wget.
The idea is to use some of the URL features of the wayback machine:
- will list all saved pages from recursively. It can be used to construct an index of pages to download and avoid heuristics to detect links in webpages. For each link, there is also the date of the first version and the last version.
- will list all version of for year YYYY. Within that page, specific links to versions can be found (with exact timestamp)
- will return the unmodified page at the given timestamp. Notice the id_ token.
These are the basics to build a script to download everything from a given domain.
6You can do this easily with wget.
wget -rc --accept-regex '.*ROOT.*' STARTWhere ROOT is the root URL of the website and START is the starting URL. For example:
wget -rc --accept-regex '.* Note that you should bypass the Web archive's wrapping frame for START URL. In most browsers, you can right-click on the page and select "Show Only This Frame".
There is a tool specifically designed for this purpose, Warrick:
It's based on the Memento protocol.
1I was able to do this using Windows Powershell.
- go to wayback machine and type your domain
- click URLS
- copy/paste all the urls into a text file (like VS CODE). you might repeat this because wayback only shows 50 at a time
- using search and replace in VS CODE change all the lines to look like this
Invoke-RestMethod -uri "" -outfile "images/foobar.jpg"- using REGEX search/repl is helpful, for instance change pattern
(.*)to" -outfile "$1"
The number 20200918112956 is DateTime. It doesn't matter very much what you put here, because WayBack will automatically redirect to a valid entry.
- Save the text file as
GETIT.ps1in a directory like c:\stuff - create all the directories you need such as c:\stuff\images
- open powershell,
cd c:\stuffand execute the script. - you might need to disable security, see link