#!/usr/local/bin/python import feedparser import cgi import re feeds = [ 'http://www.myelin.co.nz/post/rss.xml', 'http://topicexchange.com/rss', 'http://www.scripting.com/rss.xml', 'http://diveintomark.org/xml/rss.xml', ] maxlen = 60 def esc(s): return cgi.escape(s, 1) for feed in feeds: print '
' ret = feedparser.parse(feed) print '%s
' % ret['channel']['title'] for item in ret['items']: title = item.get('title', item.get('description', 'untitled')) title = re.sub(r'\<.*?\>', '', title) if len(title) > maxlen: title = title[:maxlen] + " ..." print '%s
' % (esc(item['link']), esc(title)) print "
"