HN
Today

Show HN: Kage – Shadow any website to a single binary for offline viewing

Kage is an innovative tool that addresses the fragility of modern web pages by creating robust, offline-viewable copies. It uses headless Chrome to render websites, strips all JavaScript, and localizes assets, ensuring content remains accessible even if the original site disappears. This project appeals to HN's appreciation for practical utilities that solve real-world technical problems with elegant, open-source solutions.

5
Score
0
Comments
#1
Highest Rank
26h
on Front Page
First Seen
Jun 14, 5:00 PM
Last Seen
Jun 15, 6:00 PM
Rank Over Time
411112123333345666911121415182130

The Lowdown

Kage, meaning "shadow" in Japanese, is a command-line utility designed to permanently archive dynamic websites for offline consumption. It tackles the common issue where simply using "Save As" on a modern web page results in a broken or non-functional file, as much of the content relies on live JavaScript and external network calls. Kage's approach is to capture the fully rendered state of a page and then sever its dynamic ties, making it truly independent. Here's how it achieves this:

  • Comprehensive Cloning: Kage drives a real, headless Chrome browser to visit pages, allowing all JavaScript to execute and the page to fully render. It then captures the final Document Object Model (DOM) that a human would see.
  • JavaScript Stripping: After rendering, all scripts, event handlers, and javascript: URLs are meticulously removed, eliminating tracking, network calls, and any potential future dependencies.
  • Asset Localization: It downloads all associated CSS, images, and fonts, then rewrites internal links to point to these local copies, creating a self-contained mirror of the site.
  • Flexible Output Formats: Cloned sites can be stored as browsable folders or packed into two portable formats: a single ZIM archive (compatible with Kiwix for broad offline use) or a self-contained executable binary that serves the site directly.
  • Idempotent and Resumable: The cloning process is designed to be deterministic and can be interrupted and resumed, ensuring efficient and reliable preservation of large sites.
  • Native Window Option: For a more application-like experience, Kage can be built to open packed sites in a native WebView window instead of a standard browser tab.

By providing a method to reliably 'freeze' web content, Kage offers a powerful solution for digital preservation, allowing users to ensure long-term access to information regardless of its original online status.