Should I learn Python instead?

Gerard Flanagan grflanagan at yahoo.co.uk
Sat Apr 15 06:16:24 EDT 2006


fyleow wrote:
> Hi guys,
>
> I'm a student/hobbyist programmer interested in creating a web project.
>  It's nothing too complicated, I would like to get data from an RSS
> feed and store that into a database.  I want my website to get the
> information from the database and display parts of it depending on the
> criteria I set.
>
[...]
>
> This is how to access an RSS feed and create an XML document to
> manipulate it.
>
> System.Net.WebRequest myRequest = System.Net.WebRequest.Create("//feed
> url here");
>         System.Net.WebResponse myResponse = myRequest.GetResponse();
>         System.IO.Stream rssStream = myResponse.GetResponseStream();
>         System.Xml.XmlDocument rssDoc = new System.Xml.XmlDocument();
>
>         rssDoc.Load(rssStream);
>
> Here's PHP.
>
> $rss_feed = file_get_contents($rss_url);
>

I've never used it myself but maybe this would be useful:

    http://feedparser.org/

>From the Homepage:

>>> import feedparser
>>> d = feedparser.parse("http://feedparser.org/docs/examples/atom10.xml")
>>> d.feed.title
u'Sample Feed'
>>> d.channel.title
u'Sample Feed'
>>> d.feed.link
u'http://example.org/'
>>> d.feed.subtitle                 # parses escaped HTML
u'For documentation <em>only</em>'
>>> d.channel.description
u'For documentation <em>only</em>'

Gerard




More information about the Python-list mailing list