💾 Archived View for gemi.dev › gemlog › 2023-06-22-random-gemipedia.gmi captured on 2023-11-14 at 08:24:08. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-07-10)
-=-=-=-=-=-=-
2023-06-22 | #gemipedia | @Acidus
I love getting feedback on the things I make. It absolutely makes my day. It's also a steady source of suggestions on how to improve things. Yesterday I got an email from Santiago asking to add a "Random Article" function to Gemipedia to use for discovery. This will redirect you to random articles on Wikipedia.
So when I went to add a `GetRandomArticle()` method to our Wikipedia API client, I was surprised to find it already existed! Turns out, I had added this functionality last year without directly exposing it to the user and I had completely forgotten! I used it to stress test my Wikipedia HTML parser. Wikipedia is full of gross HTML (Table's used to create 2 column layouts, etc.). As I added support for things like math formulas, geolocation links, infoboxes, I wanted to make sure they worked, or at the very least, didn't cause a crash. The solution? Make a simple loop that like this:
do { string name = ""; try { Article article = GetRandomArticle(); name = article.Name; Gemipedia.Render(article); } catch(Exception ex) { Console.WriteLine($"Error {name}. Threw exception: {ex.Message}"); } } while(true);
I let this run through a hundred thousand or so random articles, collecting errors and fixing them, and I had a fairly robust HTML-to-gemtext system.
Since I already had the API stubbed out, I simply added a "View Random Article" link to the homepage of Gemipedia! Here you go:
Santiago told me they wanted the Random Article feature because they liked just discovering interesting content on Wikipedia. I should add that Gemipedia supports Wikipedia's Featured Article from the front page of Wikipedia. Featured Articles are a special designation that only the best, most complete, and well written article receive. Only about 0.09% of all articles in the English Wikipedia are featured articles. Even if it's a topic you have never heard of, it will be well rounded and engaging content. So this is a great way to find interesting content.
Wikipedia also lists the most read articles for that day. Personally I use this as kind of a crowd-sourced filter to see what the current topics are in the zeitgeist without having to actual read the news site. Gemipedia makes this available too.
Featured Article and 25 most popular articles (updated daily)
Drop me an email. I makes my day to get emails, and its where I find some of the latest ideas.