Reddit RSS Feed Parsing/Proxying In Python

RSS Reader

The problem

I like reading news via feed aggregators - and after the demise of Google Reader, I've migrated to Feedly. Which is great by itself, and doesn't even need me to provide an URL of teh feed - it can use site URL, or even site name, to provide one.

Also, I read some (very limited) streams on Reddits, such as r/programming/ - but the problem is, if I use just the feed directly, it points me to a post on Reddit, which I find fairly useless: I don't care about comments, I mostly care about the content of the articles people post.

So I wanted clicks on the item to lead me directly to the article, skipping the Reddit post.

The solution

The solution I came up with was to host a simple proxy that would accept feed name, get the feed XML from Reddit, parse it, replace the post URL with article URL, and return the results. Since I have some apps running here and there, I could put it on a server, so I didn't need to be concerned about CORS requests or any other browser security constraints.

So the result is a simple Python app that uses Bottle as HTTP server framework. It doesn't do much, but it does what I need it to:


NOTE: I had to change the path handling from regex to query parameter in thw example app because conflicts in my Flask app with some other route handling mechanisms.

It actually existed for a few years now, I just finally decided to upgrade it to Python3 and thought of posting it here.