gildas-lormeau/SingleFile

GitHub: gildas-lormeau/SingleFile

SingleFile 是一款浏览器扩展与 CLI 工具,用于将完整的网页连同所有资源保存为单个自包含的 HTML 文件,实现离线归档与忠实还原。

Stars: 21979 | Forks: 1380

# SingleFile SingleFile 可以帮助您将完整的网页保存为单个 HTML 文件。SingleFile 是一个 Web Extension(也是一个 CLI 工具),兼容 Chrome、Firefox(桌面版和移动版)、Microsoft Edge、Safari、Vivaldi、Brave、Waterfox、Yandex 浏览器和 Opera。 ## 目录 - [SingleFile](#singlefile) - [目录](#table-of-contents) - [演示](#demo) - [安装](#install) - [快速入门](#getting-started) - [补充说明](#additional-notes) - [常见问题解答](#faq) - [发行说明](#release-notes) - [已知问题与故障排除](#known-issues-and-troubleshooting) - [命令行界面 (SingleFile CLI)](#command-line-interface-singlefile-cli) - [与用户脚本集成](#integration-with-user-scripts) - [文件格式对比](#file-format-comparison) - [使用/兼容 SingleFile 的项目](#projects-usingcompatible-with-singlefile) - [隐私政策](#privacy-policy) - [贡献者](#contributors) - [衍生自第三方项目的代码](#code-derived-from-third-party-projects) - [图标](#icons) - [许可证](#license) ## 演示 https://user-images.githubusercontent.com/396787/156664907-cc458e35-f41b-45ca-91eb-372213812b44.mp4 ## 安装 SingleFile 可以从以下应用商店安装: - Firefox: https://addons.mozilla.org/firefox/addon/single-file - Android 版 Firefox: https://addons.mozilla.org/android/addon/single-file - Chrome: https://chromewebstore.google.com/detail/singlefile/mpiodijhokgodhhofbcjdecpffjipkle - Safari (macOS 和 iOS): https://apps.apple.com/us/app/singlefile-for-safari/id6444322545 - Microsoft Edge: https://microsoftedge.microsoft.com/addons/detail/efnbkdcfmcmnhlkaijjjmhjjgladedno 您也可以下载项目的 zip 文件 (https://github.com/gildas-lormeau/SingleFile/archive/master.zip), 将其解压到磁盘上的某个位置,并按照 以下说明进行手动安装: - Firefox: https://extensionworkshop.com/documentation/develop/temporary-installation-in-firefox - Chrome 和 Microsoft Edge: https://github.com/gildas-lormeau/SingleFile-MV3 - Safari: https://github.com/gildas-lormeau/SingleFile-Safari-Extension ## 快速入门 - 点击扩展工具栏中的 SingleFile 按钮以保存页面。 - 在处理页面时,您可以再次点击该按钮来取消操作。 ## 补充说明 - 右键点击扩展工具栏或网页上的 SingleFile 按钮,打开上下文菜单。它允许您保存: - 当前标签页, - 选中的内容, - 选中的 frame。 - 您也可以一键处理多个标签页并保存: - 选中的标签页, - 未固定的标签页, - 所有标签页。 - 在上下文菜单中选择“Annotate and save the page...”来: - 高亮文本, - 添加笔记, - 移除内容。 - 上下文菜单还允许您激活以下内容的自动保存: - 当前标签页, - 未固定的标签页, - 所有标签页。 - 启用自动保存后,页面每次加载后(或卸载前)都会自动保存。 - 右键点击 SingleFile 按钮,选择“Manage extension”(Firefox) 或“Options”(Chrome) 以打开选项页面。 - 启用“Destination > save to Google Drive”或“Destination > upload to GitHub”选项,分别将页面上传到 Google Drive 或 GitHub。 - 启用“Misc. > add proof of existence”选项,通过将页面的 SHA256 链接到区块链来证明已保存页面的存在。 - 您可以使用自定义快捷键 Ctrl+Shift+Y 保存当前标签页或选中的标签页。在 Firefox 中,转到 about:addons 并在齿轮菜单中选择“Manage extension shortcuts”来更改它。在 Chrome 中,转到 chrome://extensions/shortcuts 进行更改。 - 默认保存文件夹是在浏览器中配置的下载文件夹,参见 Firefox 中的 about:addons 和 Chrome 中的 chrome://settings。 - 有关选项和技术说明的更多详细信息,请参阅选项页面中的扩展帮助。 ## 常见问题解答 参见 https://github.com/gildas-lormeau/SingleFile/blob/master/faq.md ## 发行说明 参见 https://addons.mozilla.org/firefox/addon/single-file/versions/ ## 已知问题与故障排除 参见 https://github.com/gildas-lormeau/SingleFile/blob/master/known-issues.md ## 命令行界面 (SingleFile CLI) 您可以通过命令行界面将网页保存为 HTML。获取更多 信息,请访问:https://github.com/gildas-lormeau/single-file-cli。 ## 与用户脚本集成 您可以在 SingleFile 保存页面之前(和之后)执行用户脚本。 获取更多信息,请访问 https://github.com/gildas-lormeau/SingleFile/wiki/How-to-execute-a-user-script-before-a-page-is-saved。 ## 文件格式对比 | | HTML | Self-extracting ZIP | MHTML | Webarchive (Safari) | HTML+folder | | --- | :---: | :---: | :---: | :---: | :---: | | 页面被保存为单个文件 | ✓ | ✓ | ✓ | ✓ | | | HTML 和样式被压缩 | ✓ | ✓ | | | | | 未使用的 HTML 和样式从文件中移除 | ✓ | ✓ | | | | | 二进制资源未进行 base 64 编码 | | ✓ | | ✓ | ✓ | | 文件被压缩 | | ✓ | | | | | 无需安装任何扩展即可查看文件 | ✓ | ✓¹ | ✓² | ✓³ | ✓ | | 无需运行 JavaScript 即可查看文件 | ✓ | | ✓ | ✓ | ✓ | | 可以解压文件以提取页面资源 | | ✓ | | | n/a | | 文件包含页面文本(纯文本或格式化文本),可被索引 | ✓ | ✓⁴ | ✓ | ✓ | ✓ | 脚注: ¹ 使用“universal”自解压文件格式时 ² 仅限于基于 Chromium 的浏览器和 Internet Explorer ³ 仅限于 Safari ⁴ 必须在扩展中启用某个选项 ## 使用/兼容 SingleFile 的项目 - ArchiveBox - 开源自托管网页归档工具: https://github.com/ArchiveBox/ArchiveBox - htmls-to-datasette - 将 HTML 文件索引到 Sqlite 数据库的工具: https://github.com/pjamar/htmls-to-datasette - Karakeep - 带有 AI 元素的自托管全能书签应用: https://karakeep.app - KOReader - 主要面向电子墨水屏阅读器的文档查看器: https://github.com/koreader/koreader - linkding - 您可以自行托管的书签管理器。它旨在使用 Docker 实现极简、快速且易于设置: https://github.com/sissbruecker/linkding - Linkwarden - 自托管协作书签管理器,可在一个地方收集、阅读、 注释并完全保留重要内容: https://github.com/linkwarden/linkwarden - obsidian-html-plugin - 在 Obsidian 中阅读 HTML 页面的插件: https://github.com/nuthrash/obsidian-html-plugin - Org-Dex.el - 旨在通过集成 SingleFile CLI 来增强 Org-mode 的 Emacs 包: https://github.com/nitincodery/org-dex.el - Petal Cite Web Importer - 用于保存 PDF 并在 Petal Cite 中捕获网页的浏览器扩展: https://github.com/ks-collab/cite-extension - Pocket Search Engine - 完全离线工作的 Android 语义搜索应用: https://play.google.com/store/apps/details?id=com.pocketsearchengine.app - Readeck - 书签管理器和稍后阅读工具:https://codeberg.org/readeck/readeck - singlefile2trilium - 使用 SingleFile 将网页忠实副本保存为 Trilium 笔记的工具: https://github.com/nil0x42/singlefile2trilium - SingleFile MV3 CDP Patched - SingleFile 的分支,经过补丁修改允许使用 Chrome DevTools Protocol 进行编程控制: https://github.com/Cosmologist/SingleFile-MV3-CDP-Patched - SingleFile MCP - Model Context Protocol (MCP) 服务器,使用 single-file 和 trafilatura 提供智能网页内容提取: https://github.com/kwinsch/singlefile-mcp - Trilium-SingleFile - Trilium Notes 的插件,用于轻松导入 SingleFile html 页面:https://github.com/rauenzi/Trilium-SingleFile - Trilium Simple SingleFile Renderer - 用于为 Trilium 添加新模板笔记以渲染 SingleFile 所创建文件的插件: https://github.com/xnohat/trilium-simple-singlefile-renderer - web document - 用于本地保存网页文档的浏览器扩展,允许您离线访问并快速搜索网页: https://github.com/wvit/web-document - Zotero Connector - Zotero 的浏览器扩展,Zotero 是一个帮助您收集、 组织、引用和分享研究资料的工具: https://github.com/zotero/zotero-connectors ## 隐私政策 参见 https://github.com/gildas-lormeau/SingleFile/blob/master/privacy.md ## 衍生自第三方项目的代码 - csstree: https://github.com/csstree/csstree - postcss-media-query-parser: https://github.com/dryoma/postcss-media-query-parser - postcss-selector-parser: https://github.com/postcss/postcss-selector-parser - UglifyCSS: https://github.com/fmarcia/UglifyCSS - parse-srcset: https://github.com/albell/parse-srcset - parse-css-font: https://github.com/jedmao/parse-css-font - Readability: https://github.com/mozilla/readability - whatwg-mimetype: https://github.com/jsdom/whatwg-mimetype ## 图标 - 由 [Kiranshastry](https://www.flaticon.com/authors/kiranshastry) 制作、来自 [Flaticon](https://www.flaticon.com/) 的图标基于 [CC 3.0 BY](http://creativecommons.org/licenses/by/3.0/) 获得许可 ## 许可证 SingleFile 基于 AGPL 获得许可。衍生自第三方项目的代码 基于 MIT 获得许可。如果您 有兴趣为商业服务或 产品授权 SingleFile 代码,请通过 gildas.lormeau <at> gmail.com 与我联系。 欢迎提出建议 :)
标签:MITM代理, VS Code插件, Web开发工具, 多模态安全, 效率工具, 数据可视化, 数据备份, 浏览器扩展, 网页保存, 自定义脚本