TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Monolith – CLI tool for saving complete web pages as a single HTML file

772 pointsby iscream26about 1 year ago

28 comments

simonwabout 1 year ago
Well this is fun... from the README here I learned I can do this on macOS:<p><pre><code> &#x2F;Applications&#x2F;Google\ Chrome.app&#x2F;Contents&#x2F;MacOS&#x2F;Google\ Chrome \ --headless --incognito --dump-dom https:&#x2F;&#x2F;github.com &gt; &#x2F;tmp&#x2F;github.html </code></pre> And get an HTML file for a page after the JavaScript has been executed.<p>Wrote up a TIL about this with more details: <a href="https:&#x2F;&#x2F;til.simonwillison.net&#x2F;chrome&#x2F;headless" rel="nofollow">https:&#x2F;&#x2F;til.simonwillison.net&#x2F;chrome&#x2F;headless</a><p>My own <a href="https:&#x2F;&#x2F;shot-scraper.datasette.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;shot-scraper.datasette.io&#x2F;</a> tool (which uses headless Playwright Chromium under the hood) has a command for this too:<p><pre><code> shot-scraper html https:&#x2F;&#x2F;github.com&#x2F; &gt; &#x2F;tmp&#x2F;github.html </code></pre> But it&#x27;s neat that you can do it with just Google Chrome installed and nothing else.
评论 #39814032 未加载
评论 #39812396 未加载
评论 #39818229 未加载
评论 #39812923 未加载
评论 #39812566 未加载
评论 #39823531 未加载
评论 #39818478 未加载
评论 #39813889 未加载
评论 #39812699 未加载
评论 #39811700 未加载
评论 #39821741 未加载
russellbeattieabout 1 year ago
If anyone is interested, I wrote a long blog post where I analyzed all the various ways of saving HTML pages into a single file, starting back in the 90s. It&#x27;ll answer a lot of questions asked in this thread (MHTML, SingleFile, web archive, etc.)<p><a href="https:&#x2F;&#x2F;www.russellbeattie.com&#x2F;notes&#x2F;posts&#x2F;the-decades-long-html-bundle-quagmire.html" rel="nofollow">https:&#x2F;&#x2F;www.russellbeattie.com&#x2F;notes&#x2F;posts&#x2F;the-decades-long-...</a>
评论 #39812553 未加载
andaiabout 1 year ago
I always ship single file pages whenever possible. My original reasoning for this was that you should be able to press view source and see everything. (It follows that pages should be reasonably small and readable.)<p>An unexpected side effect is that they are self contained. You can download pages, drag them onto a browser to use them offline, or reupload them.<p>I used to author the whole HTML file at once, but lately I am fond of TypeScript, and made a simple build system to let me write games in TS and have them built to one HTML file. (The sprites are base64 encoded.)<p>On that note, it seems (there is a proposal) that browsers will eventually get support for TypeScript syntax, at which point I won&#x27;t need a compiler &#x2F; build step anymore. (Sadly they won&#x27;t do type checking, but hey... baby steps!)
评论 #39812170 未加载
评论 #39814098 未加载
评论 #39811987 未加载
评论 #39812186 未加载
评论 #39848318 未加载
评论 #39811944 未加载
评论 #39812367 未加载
lopkeny12koabout 1 year ago
How does this compare to SingleFile?<p><a href="https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;single-file-cli" rel="nofollow">https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;single-file-cli</a>
评论 #39811468 未加载
jchookabout 1 year ago
Hm, very interesting, especially for bookmarking&#x2F;archiving.<p>I&#x27;m curious, why not use the MHTML standard for this?<p>- AFAIK data URIs have practical length limits that vary per browser. MHTML would enable bundling larger files such as video.<p>- MHTML would avoid transforming meaningful relative URLs into opaque data URIs in the HTML attributes.<p>- MHTML is supported by most major browsers in some way (either natively in Chrome or with an extension in Safari, etc).<p>- MIME defines a standard for putting pure binary data into document parts, so it could avoid the 33% size inflation from base64 encoding. That said, I do not know if the `binary` Content-Transfer-Encoding is widely supported.
评论 #39814571 未加载
评论 #39813969 未加载
keyleabout 1 year ago
I am really loving these &#x27;new&#x27; pure rust tools that are super fast and efficient, with lovely API&#x2F;doco. Ah, it feels like the 90s again... Minus 50% bugs probably.
评论 #39816171 未加载
al_borlandabout 1 year ago
I use read-it-later type services a lot, and save more than I read. On many occasions I&#x27;ve gone back to finally read things and find that the pages no longer exist. I&#x27;m thinking moving to some kind of offline archival version would be a better option.
评论 #39811661 未加载
评论 #39811789 未加载
评论 #39811755 未加载
评论 #39812380 未加载
评论 #39811553 未加载
andaiabout 1 year ago
Does anyone know how an entire website can be restored from Wayback Machine? A beloved website of mine had its database deleted. Everything&#x27;s on Internet Archive, but I think I&#x27;d have to<p>(1) scrape it manually (they don&#x27;t seem to let you download an entire site?),<p>(2) write some python magic to fix the css URLs etc so the site can be reuploaded (and maybe add .html to the URLs? Or just make everything a folder with index.html...)<p>It seems like a fairly common use case but I barely found functional scrapers, let alone anything designed to restore the original content in a useful form.
评论 #39811917 未加载
评论 #39811912 未加载
joeyhageabout 1 year ago
It would be awesome to see support for following links to a specified depth, similar to [Httrack](<a href="https:&#x2F;&#x2F;www.httrack.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.httrack.com&#x2F;</a>)
评论 #39811263 未加载
评论 #39811826 未加载
arp242about 1 year ago
I wrote something very similar a few years ago – <a href="https:&#x2F;&#x2F;github.com&#x2F;arp242&#x2F;singlepage">https:&#x2F;&#x2F;github.com&#x2F;arp242&#x2F;singlepage</a><p>I mostly use it for a few Go programs where I generate HTML; I can &quot;just&quot; use links to external stylesheets and JavaScript because that&#x27;s more convenient to work with, and then process it to produce a single HTML file.
fagrobotabout 1 year ago
<a href="https:&#x2F;&#x2F;github.com&#x2F;gildas-lormeau&#x2F;SingleFile">https:&#x2F;&#x2F;github.com&#x2F;gildas-lormeau&#x2F;SingleFile</a>
pbnjehabout 1 year ago
Does anyone remember the Firefox extension Scrapbook, from &quot;back in the day&quot;? I used to use it a lot.<p>Look &quot;back&quot; 5 - 10 years, or more, and it&#x27;s striking how many web resources are no longer available. A local copy is your only insurance. And even then, having it in an open, standards compliant format is important (e.g. a file you can load into a browser -- I guess either a current browser or a containerized&#x2F;emulated one from the era of the archived resource).<p>Something that concerns me about JavaScript-ed resources and the like. Potentially unlimited complexity making local copies more challenging and perhaps untenable.
toomuchtodoabout 1 year ago
Related:<p><i>Show HN: CLI tool for saving web pages as a single file</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=20774322">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=20774322</a> - August 2019 (209 comments)
lagt_tabout 1 year ago
I remember IE5 was able to do this lol. It fell out of vogue for some reason, glad to see the concept is still alive.
评论 #39811232 未加载
评论 #39811018 未加载
max_about 1 year ago
It still blows my mind that browsers don&#x27;t provide features this out of the box.
评论 #39815090 未加载
评论 #39815514 未加载
评论 #39814077 未加载
评论 #39814609 未加载
publius_0xf3about 1 year ago
Awesome tool. A note to the devs: the latest version on winget is v2.7.0, which is several months behind the latest version.
k1ck4ssabout 1 year ago
How would I archive an on-prem hosted redmine solution (<a href="https:&#x2F;&#x2F;www.redmine.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.redmine.org&#x2F;</a>)? It is many, many years old and I want to abandon it for good but save everything and archive it. Is that possible with monolith?
评论 #39814422 未加载
farzadmfabout 1 year ago
Ironically, I decided to try with the repo&#x27;s own Github page, and when I open the resulting HTML file in Chrome, it&#x27;s all errors in the console, and I don&#x27;t see the `README` or anything
评论 #39816300 未加载
stringtointabout 1 year ago
Nice! Reminds me of the time I was working on a browser extension to do this.
causality0about 1 year ago
How&#x27;s this better than the MHTML functionality built into my browser?
评论 #39811476 未加载
dosourcenotcodeabout 1 year ago
A cool tool to be sure.<p>However I feel this tool is a crutch for the stupid way browsers handle web pages and shouldn&#x27;t be necessary in a sane world.<p>Instead of the bullshit browsers do where they save a page as &quot;blah.html&quot; file + &quot;blah_files&quot; folder they should instead wrap both in folder that can then later be moved&#x2F;copied as one unit and still benefit from it&#x27;s subcomponents being easily accessed &#x2F; picked apart as desired.
评论 #39812551 未加载
fs111about 1 year ago
<a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;WARC_(file_format)" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;WARC_(file_format)</a>
victorbjorklundabout 1 year ago
This is great. I have wished for something like this.
AdmiralAsshatabout 1 year ago
So what happens if the page is behind a paywall and the embedded Javascript stores some authentication or phone-home code? Does that end up getting invoked on the monolith copy HTML?<p>I&#x27;m wondering how this would work if I wanted to use it to, say, save a quiz from Udemy for offline review.
评论 #39821054 未加载
dohello1about 1 year ago
and I thought my code pages were long haha
sunshine202022about 1 year ago
fun
ethanpilabout 1 year ago
Nice. My next step: Figure out how to make a web extension 1 click button. Tab to Monolith to Joplin with a tag.
评论 #39811369 未加载
AdieuToLogicabout 1 year ago
Or perhaps wget[0] as described here[1] and documented here[2] could do the trick.<p>0 - <a href="https:&#x2F;&#x2F;www.gnu.org&#x2F;software&#x2F;wget&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.gnu.org&#x2F;software&#x2F;wget&#x2F;</a><p>1 - <a href="https:&#x2F;&#x2F;tinkerlog.dev&#x2F;journal&#x2F;downloading-a-webpage-and-all-of-its-assets-with-wget" rel="nofollow">https:&#x2F;&#x2F;tinkerlog.dev&#x2F;journal&#x2F;downloading-a-webpage-and-all-...</a><p>2 - <a href="https:&#x2F;&#x2F;www.gnu.org&#x2F;software&#x2F;wget&#x2F;manual&#x2F;wget.html" rel="nofollow">https:&#x2F;&#x2F;www.gnu.org&#x2F;software&#x2F;wget&#x2F;manual&#x2F;wget.html</a>
评论 #39812227 未加载