5 lines RSS reader
Tuesday, May 19th, 2009 | Software Development, Web
Recently while creating AXANT Labs we decided to put inside the page a little RSS aggregator which should mix news from our projects, at first we took a look at Planet, but it was a bit too big for our needing so we developed this short RSS feed reader using Universal Feed Parser. I’m sharing this as the sources are really compact and might be useful in other situations
import feedparser, operator, time
feeds = (”http://blog.axant.it/feed”, “http://www.lscube.org/rss.xml”)
feeds = map(lambda x : feedparser.parse(x).entries, feeds)
feeds = reduce(operator.concat, feeds)
feeds = sorted(feeds, lambda x,y : cmp(y.date_parsed, x.date_parsed))
for entry in feeds: print ‘%s (%s) -> %s’ % (entry.title, time.strftime(”%Y-%m-%d %H:%M”, entry.date_parsed), entry.description)