-- Leo's gemini proxy

-- Connecting to gemini.cyberbot.space:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

Gemini to Epub


2021-02-27


I've been wanting to read gemini posts on an eink device lately and posted about this desire on the fediverse and started looking into it. At the moment the most feasible way to accomplish this is on an ereader. There are some other things in the works for eink gemini browsing like a kobo gemini client and at least a couple people that are working on some way to read gemini on the M5Paper.


Thanks to some awesome people that have already made some tools needed to accomplish this I am able to take my aggregated gemlog feed page and end up with the posts that appear there in epub format that I can transfer to my ereader for consumption. @dublinux@mastodon.technology tipped me off to a python script by Sotiris Papatheodorou on sourcehut that converts gemtext files to epub and it works like a charm. It doesn't accept URLs though so we need to find a way to actually download the posts to convert to epub. My wonderful friend on the fediverse @FiXato@toot.cat let me know about a tool called gemget that does exactly that. The developer of gemget is none other than the crator of my favorite gemini client Amfora, @makeworld@sunbeam.city. Next was automating it to be able to just run a script and get the new posts automatically converted. I'm not a programmer but was planning on trying to hack something together over the weekend. Then FiXato (who actually does know what he's doing, unlike me) sent me a bash script he whipped up that pulls down the gmi files from a gemini page (with gemget), converts them to epub (with the gemini-ebook python script) and you can provide a date to to limit how many posts you want to process. There are some small improvements that could be made but it already does pretty much exactly what I envisioned.

gemlog post on my kobo ereader


If you want use this yourself here are the steps to get it working. Links to the necessary tools below. I have only tested this on linux but it is probably adaptable to other OSs. You will need Python 3 installed if you don't have it already.


1. Download gemget for your architecture from the releases page.

2. Make gemget executable and copy it somewhere in your $PATH

3. git clone https://git.sr.ht/~sotirisp/gemini-ebook

4. Make a folder named "gemini-epub" (or whatever you want to call it) and a folder inside that called "gmi_docs"

5. Copy the "gemtext2epub" python script to the "gemini-epub" directory

6. Download FiXato's script into the "gemini-epub" directory and make it executable

7. Run the script:


./gemsub_to_ebook.sh gemini://gemini.cyberbot.space/gmisub.gmi


That link is my page of aggregated gemlog posts but you can use a similar feed page on another capsule. You can also supply a date argument at the end to specify how far back you want to fetch posts like this:


./gemsub_to_ebook.sh gemini://gemini.cyberbot.space/gmisub.gmi 2021-02-01



Big thank yous to FiXato, makeworld and Sotiris Papatheodorou for sharing the code that makes this possible!


gemget

gemini-ebook

FiXato's script

FiXato's toot on mastodon with usage examples


back to gemlog index

-- Response ended

-- Page fetched on Fri Apr 19 19:33:26 2024