RSS feed parser library in Python

rahman.bd picture rahman.bd · Feb 11, 2010 · Viewed 22.2k times · Source

I am looking for a good library in python that will help me parse RSS feeds. Has anyone used feedparser? Any feedback?

Answer

FogleBird picture FogleBird · Feb 11, 2010

Using feedparser is a much better option than rolling your own with minidom or BeautifulSoup.

  • It normalizes the differences between all versions of RSS and Atom so you don't have to have different code for each type.
  • It's good about detecting different date formats and other variations in feeds.
  • It automatically follows HTTP redirects.
  • It sanitizes HTML content.
  • It has support for ETag and Last-Modified headers so you can see if the feed has changed just by downloading the HTTP header and not the whole feed.
  • It has support for authenticated feeds.
  • It has support for HTTP proxies.

Like others have mentioned, just try it. It's like 2 lines of code to parse a feed. My only complaint is that it just uses dictionaries as its data model and some attributes can be missing from the dictionary if they weren't in the feed, so you have to check for that in your code. But the documentation is very clear on which attributes will always be in the dictionary and which might be missing.

Finally, I can vouch for it, as I've written an application that uses it. See here: http://www.feednotifier.com/