Follow

I created a small script to parse text/gemini files to HTML (to be able to add them to Wallabag). If you are interested, it's here: git.oscarbenedito.com/osf/file

It works well with pipes so you can download files and parse them easily from the command line, for example:

echo -ne "gemini://example.com/path/to/f" | ncat --ssl example.com 1965 | tail -n +2 | ./gemini-to-html.py

will output the HTML content (assuming the gemini header is "20 text/gemini").

You can create a shell function to make it simpler:

gmi() {
address=${1#gemini://}
domain=${address%%/*}
echo -ne "gemini://$address\r\n" | ncat --ssl $domain 1965 | tail -n +2 | /path/to/gemini-to-html.py
}

And then call "gmi example.com/path > file.html". You can also add additional checks for the gemini response code if you want 😃.

@ob ncat! I've been looking for something like ncat for *ages*! In fact, I tried (and failed) to write one. Thanks.

@wizzwizz4 Glad you found it! To be fair, that command is not originally mine, I read it somewhere. It's great to get gemini pages on the command line easily (and now to pipe them to my new script!)

Sign in to participate in the conversation
Fosstodon

Fosstodon is an English speaking Mastodon instance that is open to anyone who is interested in technology; particularly free & open source software.