我添加这个是因为我最近需要完成确切的任务,但这个解决方案似乎更容易设置......
您可以安装 python 然后运行pip install htmlark[http,parsers]
以安装HTMLArk。
usage: htmlark [-h] [-o OUTPUT] [-E] [-I] [-C] [-J]
[-p {html.parser,lxml,html5lib,auto}] [-v] [--version]
[webpage]
Converts a webpage including external resources into a single HTML file. Note
that resources loaded with JavaScript will not be handled by this program, it
will only work properly with static pages.
positional arguments:
webpage URL or path of webpage to convert. If not specified,
read from STDIN.
optional arguments:
-h, --help show this help message and exit
-o OUTPUT, --output OUTPUT
File to write output. Defaults to STDOUT.
-E, --ignore-errors Ignores unreadable resources
-I, --ignore-images Ignores images during conversion
-C, --ignore-css Ignores stylesheets during conversion
-J, --ignore-js Ignores external JavaScript during conversion
-p {html.parser,lxml,html5lib,auto}, --parser {html.parser,lxml,html5lib,auto}
Select HTML parser. If not specifed, htmlark tries to
use lxml, html5lib, and html.parser in that order (the
'auto' option). See documentation for more
information.
-v, --verbose Prints information during conversion
--version Displays version information
生成的 html 将打印到标准输出,因此您需要使用输出重定向将其保存到如下文件:htmlark http://example.com/ > inlined.html