I Launched a Simple Lobsters Mirror for Gemini
If I remember correctly, there have been mirrors for Hacker News and Lobsters on Gemini before, but I cannot find them anymore, or they are broken.
While I have subscribed to the Lobsters RSS feed, I don’t actually participate in submitting or voting on Lobsters, and I try to stay clear of Hacker News. On Gnome, I use Lobjur every once in a while instead of the RSS feed.
But the (un?)official Lobsters API was too simple to pass up. It’s just the ordinary URLs with a `.json` suffix, which return flat JSON content. Read the contents of a single JSON file, unmarshall, generate the page. Done.
The first iteration of my mirror just creates files in the file system every ten minutes for the three main Lobsters pages, the homepage, active, and recents. I tried to create a fully dynamic version, but an indented comment hierarchy and voting would be hard to express with Gemtext, and to sacrifice the current simple interface just to enumerate some tag pages was not worth it, IMHO. So I kept the simple version with links to HTTPS pages, which I am releasing now.
In the repository’s readme are the working links for the JSON endpoints documented, if someone wants to do more. The only ones I couldn’t figure out were the user pages, which apparently don’t have JSON endpoints. A cursory look into their Rails app seems to confirm this.
This time, I chose Go instead of Python, because it’s too much of a hassle to maintain virtual environments locally and on the server. And Go is a nice fit for simple smallnet applications and services. I did a little bit of Go before while adding DER certificate support to `gemcert`. Go is a simple language, and with `go fmt` and `go vet` it’s easy to write idiomatic Go code, especially for such a simple app.
Fun fact: the Makefile is as long as the Go code.