有人在 Hacker News 上发帖推荐将网页文件保存为单个HTML的命令行工具 monolith,引起了广大读者的热议。

Chrome/Firefox浏览器缺省的“另存页面为”功能在保存网页文件时候会将网页资源保存为:一个保存图片、Javscript、CSS等资源文件的文件夹和对应的网页文件。由于有一个文件夹,本地管理较为凌乱,要作为保存的网页作为附件存储到笔记本、网盘时候,很不方便。

而MHTML以及EPUB类似格式支持将网页资源文件打包到一个页面文件中(更多类似MTHML的格式请参考:The decades long quagmire of encapsulated HTML)。对需要收藏网页资料以便离线浏览、归档的人,将网页保存为单个文件具有携带方便、可离线浏览、管理方便等优势。

汇总一下常用的将保存网页资源为单个HTML文件的工具。

使用Chrome命令行参数 –save-page-as-mhtml
Chrome在Chrome 75之前,可以通过设置chrome://flags -> save as mhtml来保存网页为mhtml。
75之后版本可以通过Chrome的启动命令行参数”–save-page-as-mhtml”
更多 Chromium 命令行参数可以参考:
https://peter.sh/experiments/chromium-c … -switches/

浏览器扩展
SingleFile:
https://github.com/gildas-lormeau/SingleFile

SingleFileZ:
https://github.com/gildas-lormeau/SingleFileZ 
SingleFile 开发者的作品,增加了压缩功能

Save Page WE:
Chrome:https://www.crxsoso.com/webstore/detail/dhhpefjklgkmgeafimnjhojgjamoafof
Firefox:https://www.crxsoso.com/firefox/detail/save-page-we

Save Webpages Offline As MHTML:
https://browsernative.com/save-webpage-offline-mhtml/

Save as MHTML:
https://mybrowseraddon.com/save-as-mhtml.html

SaveAsMHT:
https://github.com/vsDizzy/SaveAsMHT

命令行工具
monolith:
https://github.com/Y2Z/monolith

SingleFile CLI :
https://github.com/gildas-lormeau/single-file-cli   
SingleFile 开发者的作品

Archive.org的命令行工具

internetarchive:
https://github.com/jjjake/internetarchive

savepagenow:
https://github.com/palewire/savepagenow

wget下载网页所有资源

wget –mirror –convert-links –adjust-extension –page-requisites –no-parent
http://example.org

专业归档工具
ArchiveBox:
https://archivebox.io/

Kiwix:
https://www.kiwix.org

Webrecorder:
https://webrecorder.net/

Conifer:
https://conifer.rhizome.org/

HTTrack:
https://www.httrack.com/

参看:
保存网页为单个HTML文件工具汇总
https://1fuli.one/33801/