views:

466

answers:

2

Anyone know of a good feed parser for python 3.1? I was using feedparser for 2.5 but it doesn't seem to be ported to 3.1 yet, and it's apparently more complicated than just running 2to3.py on it. Any help?

A: 

You may take a look at the Atom Models blog post by Ian Bicking. He proposes not to use any special "feed parsing" library because Atom and RSS are just XML so your model is really an XML tree, not some fancy class. You could try his code under Python 3.

Andrey Vlasovskikh
These days, anytime someone says "just XML", I usually suspect they're making a joke. This approach would work just fine if you're pulling in feeds produced by a single party in a very consistent way. But if there's really any human element at all, it's not going to work. Feeds are notoriously bad when it comes to not following standards, or for that matter, even being valid XML. Sometimes someone hands you the URI of an HTML page instead of a feed. Handling all that crap gracefully is something you want a library like `feedparser` to take care of.
Bob Aman
Yes, I'm aware of `feedparser`'s features. It was just another opinion on the subject.
Andrey Vlasovskikh
I'll give it a shot, thanks!
matthew
+1  A: 

Start porting feedparser to Python 3.1.

Bob Aman
hehe, I tried. Failed miserably. I'm more of a python "hack" than a programmer.
matthew