A pet project that I wanted to do since quite a while (to be precise, since Google killed Google Reader) was building my own RSS reader. Most of the free alternatives I've seen online either have too much advertising for my taste (and while I use an Ad-blocker, there's no best way to encourage me to keep it enabled than to flood with ads), or don't fully work, hiding feed errors or applying some unclear caching policies that make posts sometimes take a day or two to appear in the reader.
I also explored using some existing open-source feed readers, but almost everything is either PHP or Go, and while the later would be pretty easy to setup, in the end I had an excuse to play around with Python once again.
The result is PBRR - Pretty Basic RSS Reader, a very simple but working RSS feed. First a screenshot and then I'll give an overview of the (few) things it does and how:
It is designed with the same principle as a static-site generator: via Python you execute a runner that fetches from an OPML
feeds export all feeds, generates a very simple html files and folders structure (based on simple templates), dumps each post as an html, plus the lists of posts, list of sites, etc. Then, using the incredibly useful Unpoly Javascript library performs AJAX calls to render the data without any server-side code (the alternative would have been to use iframes
).
Basically, you setup a cron to run for example hourly to regenerate any new feeds, and set your webserver to serve static content (JS, CSS & HTML). And that's all, nothing scales better and runs faster than purely static content :)
It groups sites into categories (if the OPML
had them), sends a proper Last-Modified
header to be a good feed consumer citizen, and uses localStorage
and a few Javascript lines to differentiate sites with new posts from already seen ones.
You can check the source, fork it, etc. at https://github.com/Kartones/pbrr.
I am using it myself so I might enhance or add new features in the future, but this v1.0
serves my needs and, after some fighting with non-standard feeds (there's always a case or two where feedparser library can't help with malformed feeds), works with all but one RSS subscriptions I had.
Tags: CSS Development HTML Javascript Python Tools