Explosm rss feed
I occasionally enjoy the comics from http://explosm.net and I was annoyed that the RSS feed they provide requires the reader to click on the link in order to see the comic. The reason for using the RSS feed in the first place is to be able to get the updated content fast. Having to click a link and wait for the page to load just breaks that flow.
So I decided to take things into my own hand and write a RSS generator code here for the comic feed. The idea is simple, I parse the original RSS feed, extracting the link I need to press as a reader, fetch the link, parse the page and grab the comic in that page, create another feed with only that comic and expose this new RSS feed.
The result of that is https://explosm-1311.appspot.com/ which anyone can just point their RSS reader to.
There are several “hacks” which I had to use in oder for it to play well with appengine, which I decided to use as it’s less maintenance work than hosting it on my own server. Firstly, ideally the server should fetch the original RSS feed every x interval. However, to prevent spams, appengine does not allow the hosted code to do that. Instead, such network requests has to be initiated by an actual user. This means I cannot just stick it in a endless loop fetching the original RSS. The workaround I decided on is to check when the last request triggered by an incoming request (RSS reader for e.g.) and check if that is longer than the previous poll by a given frequency. If it is, then do the update. Otherwise, there is no difference whether the feed is updated or not.
If a tree falls in a forest and no one is around to hear it, does it make a sound?
The brilliant thing about this is if any RSS reader polls this server regularly (e.g. ever hour), then it has the same effect as periodically refreshing the feed.
On hindsight, this workaround was needed because I didn’t know one could do cron jobs in appengine as well. It would be less hacky if I exposed a trigger
endpoint, and have a cron job that polls that endpoint, triggering an update.