EN
返回档案库

档案库 · 开发与企业工具 · 产品决策 · 2026

Kage 2026:将任意网站冻结为离线、无 JavaScript 的镜像

Duc-Tam Nguyen 的 Go CLI 在无头 Chrome 中渲染页面,剥离所有 JavaScript,然后将站点打包为 ZIM 文件或单个二进制文件;Show HN:712 分。

Kage

它在赌什么用户想要的是整个站点,而不只是单个页面:用无头 Chrome 渲染、抓取用户看到的 DOM 快照、去掉所有脚本,并让结果可以离线浏览。已上线

做的是什么生意

kage (影, 'shadow') is an open-source (MIT), pure-Go command-line tool that clones an entire website into a plain folder of .html files with every script removed. It drives headless Chrome per page, waits for the page to settle, snapshots the rendered DOM, deletes all script tags, event handlers, and javascript: URLs, and downloads CSS, images, and fonts rewritten to relative local paths. Commands cover clone, serve, pack, and open; a mirror can be collapsed into a ZIM archive (the open format behind Kiwix) or into a self-contained binary of about 13 MiB plus content that serves the site offline with nothing installed, with an optional --app desktop build and a webview build that opens in a native window. It ships as a ghcr container with Chromium bundled, plus Homebrew, Scoop, apt, and dnf packages.

起因

Duc-Tam Nguyen (tamnd) built kage out of the familiar failure of 'Save As': months later a saved page opens blank, shows an endless spinner, or still phones home to a dead analytics server. He described the page as never really yours - a thin client for someone else's JavaScript - and released the tool as a Show HN on 2026-06-14 with the tagline 'Shadow any website to a single binary for offline viewing'.

经过

The thread took off with 712 points and 141 comments. Commenters compared kage to SingleFile and asked how it differed from Save As; Nguyen clarified that kage mirrors an entire website with all its subpages - his example was all of Paul Graham's essays for offline reading - while SingleFile packs a single page. He also mentioned a larger umbrella ambition: building an open-source 'Google from scratch' with crawler, indexer, storage, and serving layers. Gigazine covered kage in English on 2026-07-25, walking through a Docker clone of gigazine.biz, ZIM packing, and a 24.4 MiB single-binary Windows viewer built from the 0.3.10 release.

结果

As of 2026-09-02 kage remains an independent, MIT-licensed open-source project with no company or funding; the repository documents package-manager installs, a Chrome-bundled container, and a full test suite including Chrome-driven end-to-end tests, and the docs site kage.tamnd.com continues to grow.

背景

kage(影,“shadow”)是 Duc-Tam Nguyen 开发的一个 Go 命令行工具,可将整个网站镜像到一个静态 HTML 文件文件夹中,并移除所有脚本。每个页面先经过真实的无头 Chrome,等待页面稳定,并抓取人眼可见的 DOM 快照;然后 kage 会剥离所有 script 标签、事件处理程序和 javascript: URL,下载 CSS、图片和字体,并重写为相对本地路径,因此保存的页面不会执行任何代码,也不会发起任何网络调用。

其思路是,用户希望保留整个网站,而不只是单个页面。kage 通过 robots.txt 和 sitemap.xml 进行爬取,支持恢复和刷新,然后将镜像打包为 ZIM 存档(Kiwix 背后的开放格式)或打包为约 13 MiB 加内容的独立二进制文件,可离线提供服务,并可选的 --app 桌面构建。分发涵盖 GitHub 发布、Homebrew、Scoop、apt、dnf 以及包含 Chrome 的容器镜像。

Nguyen 于 2026-06-14 在 Show HN 上发布了 kage;该条目获得了 712 分和 141 条评论,将其与 SingleFile、wget --mirror 和 HTTrack 进行比较,作者实时回答了关于全站与单页保存的问题。Gigazine 的英文网站于 2026-07-25 报道了它,演示了在 Docker 中克隆 gigazine.biz、打包 ZIM,并生成一个 24.4 MiB 的 Windows 查看器二进制文件。截至 2026-09-02,kage 仍是一个独立的 MIT 项目,没有公司或资金支持。

这件事要成立,得有什么

  • “另存为”生成的副本仍会回传数据,或当标记由 JavaScript 在运行时构建时显示为空白。
  • SingleFile 解决了单个页面的问题,但留下了整个站点镜像——真正的存档用例——给那些保真度较低的工具。
  • 无头 Chrome 使镜像能在移除任何 JavaScript 之前捕获人看到的内容。
  • 像 ZIM 这样的开放格式使存档可由其他工具(如 Kiwix)读取,而不是将用户锁定在项目中。
  • 一个独立的二进制文件意味着接收者无需安装任何东西即可阅读镜像。

可借鉴之处

先渲染,后剥离:先抓取人看到的内容,然后移除运行时,这样“另存为”副本就成了任何人都能离线打开的持久制品。

后续进展

截至 2026-09-02,kage 仍是一个独立的 MIT 项目,没有公司或资金支持。开发活跃:爬虫读取 robots.txt,从 sitemap.xml 获取种子,恢复中断的运行,并且每个 URL 只获取一次;打包是确定性的,镜像相对路径映射到存档中。发布自动化构建多平台二进制文件、包、含 Chrome 的容器、SBOM 和签名。作者将 kage 与更大的开源搜索栈联系起来。已知权衡:爬取需要 Chrome/Chromium,ZIM 打包省略了 Kiwix 的全文索引,而二进制文件在内容之前增加约 13 MiB。

资料来源

发现哪里写错了?告诉我们。

轮到你了

你刚读完一家。说说你在做什么,看看谁在赌同一件事。

免费账号 · 3 次免费提问 · 不用绑卡

相关案例