#!/usr/bin/env python # Convert Advogato's recentlog page to an RSS feed. # Adam Sampson . # Needs the timeoutsocket module from: # http://www.timo-tasi.org/python/timeoutsocket.py # People you don't want to see in the feed. ignore_users = [ "mglazer" ] import sys, re, timeoutsocket timeoutsocket.setDefaultSocketTimeout(30) from urllib import urlopen def encode(s): return s.replace("&", "&").replace("<", "<").replace(">", ">") sys.stdout.write("Content-type: application/rdf+xml\r\n\r\n") print """ Advogato: Recent diary entries http://www.advogato.org/recentlog.html Recent diary entries from Advogato""" try: f = urlopen("http://www.advogato.org/recentlog.html") page = f.read().replace("\r\n", "\n") f.close() articlere = re.compile(r'^ (.*?) (.*?)\n.*?\((.*?)\).*?\n
\n(.*?)
\n(

\[ Home|

" print "" + user + " (" + cert + ")" + "" print "http://www.advogato.org/person/" + user + "/" body = re.sub(hrefre, lambda m: m.group(1) + "http://www.advogato.org/", body) print "" + encode(body) + "" print "" except timeoutsocket.Timeout: pass print """ """