I am looking for a good library in python that will help me parse RSS feeds. Has anyone used feedparser? Any feedback?
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
If you want an alternative, try xml.dom.minidom. Like "Django is Python", "RSS is XML".
I Strongly recommend feedparser.
Feedparser is very powerful, configurable and sooo easy to use. A very friendly learning curve, if at all.
Example
Programatically determine how many answers your question has:
Using feedparser is a much better option than rolling your own with minidom or BeautifulSoup.
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/
In answer to your followup. You could use BeautifulSoup - but feedparser is much better geared towards RSS handing.
Not to snark - but have you read feedparsers documentation? I don't know how it could be simpler to use.
http://www.feedparser.org/
First hit on G.