I am creating a simple web-based RSS reader in Python, but I'm having trouble parsing XML is. I started experimenting with some things in the Python command line.
gt; & Gt; Xml.dom import minidom & gt; & Gt; & Gt; Import urllib2 & gt; & Gt; & Gt; Url = 'http: //www.digg.com/rss/index.xml' & gt; & Gt; & Gt; Xmldoc = minidom.parse (urllib2.urlopen (url)) & gt; & Gt; & Gt; Channelnode = xmldoc.getElementsByTagName ("Channel") & gt; & Gt; & Gt; Channelnode = xmldoc.getElementsByTagName ("Channel") & gt; & Gt; & Gt; Titlenode = channelnode [0] .getElementsByTagName ("title") & gt; & Gt; & Gt; Print Titel Node [0] & lt; DOM element: Title 0xb37440 & gt; & Gt; & Gt; & Gt; Print titlenode [0] .nodeValue none
I have played with this for some time, but nodeValue
looks everything none
. Even if you see XML, then surely there are values. You should try the library for RSS feeds.
This makes management of RSS feeds very simple.
import feeders d = feedparser.parse ('http://www.digg.com/rss/index.xml') title = d.channel. Title
Comments
Post a Comment