Search code examples
pythonrssatom-feed

Atom to RSS Conversion Tool in Python


This post is really going to show my lack of knowledge with the two formats, but does there exist a tool that will convert an Atom document into an RSS document?

I'm hoping there is a pre-existing library in Python that I can use but obviously if it's not too much of a hassle, I don't mind writing it myself.


Solution

  • I don't know of anything that does it in one step (you've tried searching The Cheese Shop, right?), but you can do it in two steps pretty easily.

    I've used feedparser to parse both Atom and RSS (both 1.0 and 2.0), and it does an amazing job at handling all of the annoying edge cases, including common but not-quite-standard uses, broken encodings, etc.

    And then generating the RSS should be the easy part—there are probably lots of libs for that, but I don't really have one to recommend.

    Meanwhile, this looks interesting: interssection lets you read multiple Atom and RSS feeds, and do set operations on them, and export the result to a single feed in any format. Presumably it would work just fine if the "multiple" feeds were a list of 1… The problem is that "at the moment" (and that was written 2 years ago), Atom 1.0 is the only supported output…