wikifirc

filter irc.wikimedia.org on specific pages and users
git clone https://a3nm.net/git/wikifirc/
Log | Files | Refs | README

commit 4f80c19ddafcf0a08f6221453dd8002c3db4568e
parent e26c8ab3060fada34614850ec0ac686e1b4aab11
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Wed,  6 Jun 2012 11:50:22 +0200

shorten urls

Diffstat:
wikifirc | 9++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/wikifirc b/wikifirc @@ -2,6 +2,13 @@ import sys import time +import urllib2 + +API="http://uzy.me/?api&longurl=%s" + +def shorten(url): + return urllib2.urlopen(API % urllib2.quote(url)).read() + class Line: def __init__(self, project, data): @@ -13,7 +20,7 @@ class Line: fields = rest.split(' ') fields.pop(0) # trailing characters of title self.flags = fields.pop(0)[:-2] - self.diff = fields.pop(0)[3:-1] + self.diff = shorten(fields.pop(0)[3:-1]) self.flags2 = fields.pop(0)[2:-1] username, sep, rest = ' '.join(fields).partition('*') self.username = username[3:-4]