Archiving web sites
lwn.net
lwn.net
https://github.com/fake-name/ReadableWebProxy is a project of mine that started out as a simple rewriting proxy, but at this point is basically a self-contained archival system for entire websites, complete with preserved historical versions of scraped content. It has a distributed fetching frontend[1], uses chromium[2] to optionally deal with internet breaking bullshit (Helloooo cloudflare! Fuuuuucccckkkkk yyyyooouuuuuuu), supports multiple archival modes (raw, e.g. not rewritten and destyled, and a rewritten format which makes reading internet text content actually nice), and a bunch of other stuff. The links in fetched content are rewritten to point within the archiver, and if content is not already retreived, it's fetched on-the-fly as you browse.
It also has plugin-based content rewriting features, allowing the complete reformatting of content on-the-fly, and functions as a backend to a bunch of other projects (I run a translated light-novel/web-novel tracker site, and it also does the RSS parsing for that).
I've been occatonally meaning to add WARC forwarding to the frontend, and feed that into the internet archive, but the fetching frontend is old, creaky and brittle (it's some old code), and does a lot of esoteric stuff that would be hard to replicate.
[1]: https://github.com/fake-name/AutoTriever [2]: https://github.com/fake-name/ChromeController
Instead, archivists should try to record the exact data sent between the server and a real browser, and then save that in a cache. Then, when viewing the archive, use the same browser and replay the same data, and you should see the exact same thing! With small tweaks to make everything deterministic (disallow true randomness in javascript, set the date and time back to the archiving date so SSL certs are still valid), this method can never 'bit rot'.
When technology moves on, and you can no longer run the browser and proxy, you wrap it all up in a virtual machine, and run it like that. Virtual machines have successfully preserved games consoles data nearly perfectly for ~40 years now, which is far better than pretty much any other approach.
There are tools like WebRecorder[0] that do this to some extent by recording and replaying all requests. It's certainly a step in the right direction and demonstrates that the approach is viable. This was the only approach I tried that worked for archiving stuff like three.js demos. Worth mentioning there's also an Awesome list[1] that covers various web archival technologies.
I also plan on saving an x86 VM image of the browser used to make the archive every couple months so that sites can be replayed many decades into the future.
but while it's true that some sites require some serious javascript stuff to be archived properly, my feeling is that if you design your site to be uncrawlable, you are going to have other problems to deal with anyways. there will be accessibility problems, and those affect not only "people with disabilities" but also search engines, mobile users, voice interfaces, etc.
if you design your site for failure, it will fail and disappear from history. after all, it's not always the archivist's fault sites die - sometimes the authors should be blamed and held to a higher standard than "look ma, i just discovered Javascript and made a single page app, isn't that great?" :p
wget -E -H -k -K -nd -N -p -P pageslug URL
for some time now and never had any issues with it.
I created a .bash_aliases entry so that now I only have to type war pageslug URL
to archive some website.I haven’t archived to many websites (I focus more on media files like videos, ebooks and such) that’s probably why I haven’t run into any issues yet but I’d be interested if somebody has a link that doesn’t work with this method just so that I can see what the result would be like.
Here’s an explanation of the method I use for anyone interested: https://gist.github.com/dannguyen/03a10e850656577cfb57
But as the submitted article points out, archiving the Web is much trickier these days, and wget is no longer sufficient for anything relatively modern. I've been impressed with what Internet Archive has seemingly been able to do, and I've been interested whether it's the result of improved techniques on their side, or of certain sites following a standard that happens to make them more archivable.
For example, 538's 2018 election trackers are very JS dependent, yet IA has managed to capture them in a way that not only preserves the look and content, but keeps their widgets and visualizations almost entirely fully functional:
https://web.archive.org/web/20181102125134/https://projects....
However, even the excellent archive of 538's site shows a huge weakness in IA's efforts: IA (quite understandably) aggressively caches a site's dependencies, such as external JS and JSON data files. If you scroll down the 538 example posted above, you'll see that despite being a snapshot on Nov. 2, 2018, many of its widgets only contain data from the last time IA fetched its external dependencies, which appears to be August 16, 2018.
For those willing to set up a docker container, check out Warcworker[2].
Teyit.org[0], the biggest fact-checking organization in Turkey, has their own archiving site called teyit.link[1].
It's a non-profit organization and they automatically archive any link that's sent to them via their site, Twitter, Facebook etc.. It's also usable by the public.
It's open source on GitHub[2] and we've actually been developing a new version[3] and have a plan to add `youtube-dl` along with WARC.
Somewhere on my to-do list is archiving everything I visit on the internet. It's frustrating to know that I've seen something, but be unable to find it again.
You could take this and post process your internet history on a rolling basis to accomplish your goal.
[1] https://blog.chromium.org/2018/10/trustworthy-chrome-extensi...
I simply use the browser's (Firefox) save page feature (ctl-s). Then every now and then, I convert the folder with these pages to a squashfs image (which de-duplicates all the CSS, JS, image files that are saved multiple times). I then use shell tools to search (ls grep locate etc.). This doesn't save the URL, but I also maintain a private "bookmarks" Git repository for more interesting bits where each bookmarked resource gets its own file (in a descriptive hierarchy), along with thoughts and notes.
What works well is that I am somewhat selective, complete trash doesn't end up being archived, it's pretty space efficient. It's also simple to wade through (in the shell), each saving action is just a file and folder pair. Also often I use the reader mode Firefox feature, and then save that (i.e. I save what I saw, not what was delivered). What doesn't work so well is that saving the page is often a bit of a hassle, often Firefox reports save errors then I just ctl-s again to see if the previous attempt succeeded, if not, hit the reload icon in the download task list which apparently forces it. Also, that it saves embedded videos, haven't figured out yet how to disable that, so periodically I remove videos again. Also, when saving multiple pages from the same site, links to other pages don't go to the local mirror. (In cases where it's important, I use wget -m -k.)
- You wouldn't have to bother with JS files, they are removed from saved pages by default.
- You couldn't (easily) de-duplicate resources because they are embedded in base64 into the page. However, SingleFile can detect all the hidden elements and unused CSS rules/declarations (by computing the cascade). So the HTML and CSS are optimized. It is also able to group duplicate images (by using CSS custom properties). There are other options to make the document size as small as possible. Most of the time, pages saved with SingleFile are smaller than Chrome MHTML files.
- The saving process would be much more simple, reliable and could be automatic.
- Videos wouldn't be saved (by default), a snapshot of the video would replace each video.
- Maybe the "filename template" in SingleFile would help you to organize things.
[1]https://chrome.google.com/webstore/detail/save-as-mht/hfmodl...
EDIT: it could be related to the fact that SingleFile is maybe more strict regarding the HTTP header "Content-Type". For example, it will discard images with "text/html" as content type value.
If you happen to stumble upon a solution (obviously self-hosted/local, due to the unfiltered access to page content), I might be willing to contribute with configuration scripting or client/server splitting so that the bulk doesn't have to stay on e.g. a laptop.
1. it's a security liability. some content i load in a web browser is private and I don't want to archive or duplicate it anywhere
2. it means a lot of crap. part of archiving content is curating what gets archived and what doesn't. i didn't touch on this in the article, but it's a key idea archivists need to address. for example, archiving the page I'm typing in right now (news.y.com/reply) makes no sense at all because it's solely dynamic content and would mean nothing when browsed later.
So instead I send specific links I want to keep in my bookmarks system, as I mentioned in the article. It's far from ideal, but it's a much better compromised than archiving every time I visit my weather service page. ;)
It's basically an offline browser where you can capture full HTML pages locally including the iframes, and tag and annotate the content.
I should have cloud sync support in the next release (1-2 weeks) which will allow you to keep your data in the cloud and sync it between machines. Initially it will just support Firebase but I have plans to support other cloud providers via plugins.
I'd also like to support end to end encryption so that you don't have to worry about people reading your data.
There's a huge Hacker News about Polar here:
https://news.ycombinator.com/item?id=18219960
A semi-requested feature is full recursive archival of content but I don't think we're going to go in that direction. Instead I think we're going to support pasting or importing a list of URLs.
Many documentation sites have an 'index' of Table of Contents and this way I can just fetch and store all those URLs without over-fetching.
My background is search and I built a petabyte scale search service named Datastreamer (http://www.datastreamer.io/). I'm also one of the inventors of RSS - so I have a lot of ideas on the roadmap here.
It also supports PDFs, text and area highlights, comments, flashcards and sync with Anki.
The initial response after our release has been amazing. The user base is really engaged with thousands of monthly active users and contributors.
Anyway. Take it for a spin. It's free and Open Source.
https://www.cyotek.com/cyotek-webcopy
Background: We couldn't keep the existing platform running, so had to transition to static html files.
I used the WebCopy scan log to create the apache rewrite rules to preserve the existing link structure.
Where I say WebCopy was better, it was this simple log, but also the file structure it was producing was much cleaner with less junk pages and duplicates. (the site was an absolute inconsistent mess to begin with)
I know there would be a tonne of edge cases and obviously it would need to be targeted to a particular platform, but I think we came pretty close with this simple technique.
I use Pocket a lot, and "share" into it from different devices.
But sometimes just do "wget --mirror -np -k --limit-rate=10k https://interesting.stuff.here.org/" on a PC.
I'd actually like a self-hosted variant of Pocket, but have not really researched if those even exist. Anyone with a suggestion?
Also, the author, Antoine Beaupré is also an engineer living in Montreal who works on mesh networking stuff, are we the same person?! I just sent him an email to make sure it doesn't land in my own inbox...
since I wrote this, i started experimenting with grab-site:
https://github.com/ludios/grab-site
it's a wrapper around (and a fork of) wpull but the main advantage over it is it can do on-the-fly reconfiguration of delay, concurrency, ignore patterns and so on. it also provides a nice web interface. if you're only crawling one site every once in a while, wpull and crawl are fine, but for larger projects, grab-site is a must.
It would recursively convert a page into a single URI. Chrome seems to have a limit for URLs, but Firefox doesn't, so far as I can tell.
Copy the contents of [0] into your URL bar, and you'll see not just the page, but the Python script is embedded in it too. (It's a bit long to dump onto a forum page).
(Disclaimer: I am the maker of PageDash)