Lurker News

Comments (141) 55 threads

simonw5 replies#
I was intrigued to see how the demo GIF in the README was generated: https://github.com/tamnd/kage/blob/01e75b87ecc893bbba7943c63...

Turns out it's using another project by the same author: https://github.com/tamnd/ascii-gif
The script used for the demo is at https://github.com/tamnd/kage/blob/01e75b87ecc893bbba7943c63... and has a comment showing how to run it:

  ascii-gif render docs/demo/kage.tape -o docs/static/demo.gif
Looks like it's an opinionated wrapper around https://github.com/charmbracelet/vhs
alterom#
FYI, on other platforms (Windows/MacOS), LiceCAP is a fantastic tool to record screen into compact GIFs by the author of Winamp and Reaper DAW:

https://www.cockos.com/licecap/

jubilanti1 reply#
Have you heard the good news about the terminal savior asciinema -- https://asciinema.org/
embedding-shape#
It's a cool tool/platform, but very different. Asciinema tries to make the "multimedia" itself better by making it actual text instead of being video/images, while the CLI command above turns actual text into multimedia supported by platforms already. Both are useful, both have their use cases :)
stavros#
VHS is fantastic for scripting cli video generation.
embedding-shape#
Very cool, never thought of that! "way smaller" is almost an understatement, when it's 50kb :P Neat that it loads in GitHub READMEs as well, which is probably a large reason people use .gif today.
Noumenon722 replies#
How can you do it? I don't see an SVG output from ascii-gif.
tamnd#
I have a bunch of opinionated/personal-use binaries like this in my $HOME/bin/, like delete-all-npm, clean-rust-cache, download-youtube-playlist, and get-markdown . It feels good, and I don't need to remember any commands. Sometimes my coding agent can figure out how to call some of those tools too ;))
wolttam3 replies#
One use I'd have for this is company wikis that you want to give folks easy offline access to (maybe the wiki has documentation that's useful at sites that don't have cellular coverage).

Cool!
It would be especially cool to have a version that didn't require the separate serving process - even though it's nifty you can package up a whole site as a single binary.
Maybe a single HTML entrypoint shim with a bit of javascript that could index into an archive (potentially embedded) of the site's content?

tamnd4 replies#
Submitting this to Hacker News is the right place! Thanks for your idea. I will consider implementing that :)

Also, in my mind, I already have a script/program to convert HTML to Markdown, so it could actually store everything on disk as a folder of Markdown files, and then commit them to a Git repo.

mgiampapa1 reply#
I think the zim flow was perfect for offline use. I know I will be making use of it as soon as I can figure out how to pass chrome the cookies so I can be signed into the site. Didn't see it in the page, but I didn't look closely yet.
tamnd#
Not yet supporting cookies, since I created this tool for shadowing public websites first. I will add options to pass cookies later. It will pass them to the underlying Chrome/Chromium process, so it should not be hard to do.
smeej#
I would use the shit out of this. I'm a heavy user of Logseq (OG, the md file-based version). Would LOVE to save my favorite web resources this way.
mcdonje#
Not to load you up with too many ideas, but a markdown folder sounds a lot like obsidian, which has a plugin system now.

Epub would also be a great target.

d3Xt3r1 reply#
I'd like to request something between what GP suggested and what your program is doing currently - basically I still want a single binary, but instead of embedding a full browser in it, I would like the binary to be just a self-extracting archive that calls the user's default browser, maybe in a new window/frame.

Basically I'm looking for something like the old-school .chm files on Windows, where you could pack a bunch of HTML documents into a single archive and open it without needing to embed a full browser engine.
This would have the advantage of keeping the file sizes really small. And you don't have to worry about the browser engine become outdated and potentially becoming an attack vector.

Bad_CRC2 replies#
I instantly searched for chm on the comments and yours was the only one :o

Continue this thread — 2 replies

everforward#
This is a nice way to do it if you’re already stuck with a solution (print to PDF would probably also, if you can script it).

In a green field world, I have a personal requirement that technical documentation systems are capable of bulk exporting to a human-readable format on disk. I’m pretty flexible on what that is, though. Markdown is preferred, but I’m also fine with static, dependency-free HTML and I could accept PDFs if the rest of it is super nice.
It’s an integral part of DR, and most places want their docs on-premise, so DR effectively requires offline documentation. Everywhere I’ve worked either a) writes documentation in something that works offline (eg git repo with tarballs somewhere), or b) has invested a bunch of time in trying to scrape their own wiki into something legible during DR.
I guess it’s a long-winded way of saying “that’s using a tool to fix a self-inflicted problem that shouldn’t exist”.

ninalanyon3 replies#
> kage serve $HOME/data/kage/paulgraham.com

If the result is static why does it need a server? Isn't it possible to make it so that it can simply be opened by the browser? Like:
$ firefox $HOME/data/kage/paulgraham.com
Then the result would be useable on machines without kage nstalled.

doctoboggan4 replies#
Usually JavaScript is blocked when you load pages that way.
pixelatedindex#
I thought all the JS was stripper?
embedding-shape1 reply#
Since when? You won't be able to make HTTP requests to localhost, as it'd be a different Origin, but I don't think any mainstream browser blocks JS outright when you use file:// to load and view HTML files.

Continue this thread — 6 replies

dmazzoni#
Not all JavaScript, but a lot of APIs are restricted
recursive1 reply#
I am quite familiar with this and it is factually false
danielheath3 replies#
Js modules don’t work on file urls (classic js does).

Continue this thread — 3 replies

afavour1 reply#
You’ll likely run into a ton of CORS issues doing that.
embedding-shape#
I don't think so, there is no HTTP requests being done from JS as it's stripped away, and all the other resources are pulled down (and I'm assume their reference made relative), so really shouldn't be any issues because of CORS at all.
tamnd#
You could use python -m http.server instead. I haven't tried it yet, but it should work.

Actually, Kage has two parts: a crawler that crawls pages and converts them to clean HTML by capturing the DOM after rendering in Chrome/Chromium, and a pack/serve component that packages the result as either a ZIM file for Kiwix or an executable file.

tamnd3 replies#
It seems this repo only saves one web page?

What I'm implementing here is mirroring a whole website, with all its subpages, so you can browse it all offline. For example, all essays from paulgraham.com.

maxloh#
Oh, I see. In that case, feature-wise, it is actually a modern alternative to HTTrack.

I think the misunderstanding stems from the browser's "Save As" reference in the description. It is misleading. You use "Save As" to save a single page, not an entire website.
Also, the description lacks a clear explanation of the project's purpose. It would be helpful to include a sentence explaining that the program downloads an entire website, not just a single page.

sillysaurusx#
> For example, all essays from paulgraham.com

Not the same thing, but I made a clone of pg’s website which can be used for exactly that: https://github.com/shawwn/pg
https://shawwn.github.io/pg/
If you want to read all essays, just clone the repo and open any of the .html files. Or any of the .page files which generated them.

tamnd1 reply#
And thanks for the link. Let me implement this single HTML feature, it looks nice to have!
maxloh#
Yeah. An idea on top of that is to bundle an entire website into a single HTML page, with vendored JavaScript to enable client-side routing (all of the original pages' JS is still stripped out).

That way, the page is self-contained as it is, but requires no bundled binary code to serve the site. It is actually safer security-wise.
The vendored script can be as simple as this:

  const site = {
    "path-1": " ... ",
    "path-2": " ... ",
    // More paths
  }

  function attachListeners() {
    for (const [path, html] of Object.entries(site)) {
      document.querySelector(`a[href=${path}]`).onclick = () => {
        document.documentElement.outerHTML = html
        attachListeners()
      }
    }
  }

  document.addEventListeners("DOMContentLoaded", attachListeners)
HelloUsername2 replies#
What's the difference with, any webbrowser on a computer, File -> Save as ?

Continue this thread — 2 replies

Continue this thread — 2 more replies

Load more comments