2

I am trying to parse rss feed using python.

The rss feed has the format:

 <rss xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
      <channel>
                <title>Yahoo! News - Latest News & Headlines</title>
                <link>http://news.yahoo.com/</link>
                <description>...</description>
                <language>en-US</language>
                <copyright>Copyright (c) 2013 Yahoo! Inc. All rights reserved</copyright>
                <pubDate>Thu, 30 May 2013 21:14:41 -0400</pubDate>
                <ttl>5</ttl>
                <image>...</image>
                <item>...</item>
                <item>...</item>
                <item>...</item>
      </channel>
 </rss>

I need to extract some details of the <items>.

Using print feed['channel']['title'] etc I can get details of those blocks occurring only once. How do I extract details of the items? feed['channel']entries[0] or feed['channel']['items[0]] etc do not seem to work.

vidit
  • 6,293
  • 3
  • 32
  • 50
Manas Paldhe
  • 766
  • 1
  • 10
  • 32

1 Answers1

1
feed.entries[doc_iter]['title'] 

Seems to work. The doc_iter mentions the ith item.

nick
  • 1,090
  • 1
  • 11
  • 24
Manas Paldhe
  • 766
  • 1
  • 10
  • 32