The rss file is shown as below, i want to get the content in section media:group . I check the document of feedparser, but it seems not mention this. How to do
feedparser 4.1 as available from PyPi has this bug.
the solution for me was to get the latest feedparser.py (4.2 pre) from the repository.
svn checkout http://feedparser.googlecode.com/svn/trunk/ feedparser-readonly
cd feedparser-readonly
python setup.py install
now you can access all mrss items
>>> import feedparser # the new version!
>>> d = feedparser.parse(MY_XML_URL)
>>> for content in d.entries[0].media_content: print content['url']
should do the job for you
You can parse the feed using
feed = feedparser.parse(your_feeds_url)
and then access your xml elements using either python's attribute access or dictionary-like access on feed
and its subelements. The former method won't work for an element name like media:content
, so use the latter method.
The rest should become clear after studying the examples at http://www.feedparser.org