Last Update: 16.11.2006. By azarai in python
I guess everyone knows these wonderful feeds and the most used standards atom and rss. Reading them is nowadays really simple, cuz we don’t need to concentrate on parsing. There are a lot of libs for reading feed in, i guess, almost all languages. Maybe not asm, but who knows :-)
I’d like to have a overview page of some feeds i read and cuz i started learning python a while ago its a wonderful possibility to combine these two goals. So i started looking for a lib, i really don’t like to reinvent the wheel all the time and found the Universal Feed Parser.
So after installation of the module its damn simple to use.
import feedparser feed = feedparser.parse("http://feeds.feedburner.com/RumblingsOfAFrustratedProgrammer" ) for item in feed[ "items" ]: print item[ "title" ] + "\t(" + item[ "date" ] + ")" print "\t" + item[ "summary" ] print "\t" + item[ "link" ]
The few line read the rss of this blog an print the title, date and summary of each article to the command line. Pretty, isnt it?
Ah, we still need the html output and support of multiple feeds, but that has too wait until next time.
Want content like this in your inbox
each workday irregularly? No BS, spam or tricks... just useful content: