[Toolserver-l] RC gateway

Merlijn van Deen valhallasw at arctus.nl
Sun Jul 29 12:35:56 UTC 2007


Hello all,

I have created a recent changes gateway that reads from IRC and outputs in
JSON format. Be aware that the variable None needs to be defined for some
packets. This behaviour may change later (by removing parameters that have
None as value)

It runs as a simple TCP server on port 8267 (listening only to localhost).

How to use:
* connect to localhost:8267
* join channels using 'J <wiki>' (alternatives: jAa)
       accepted formats: #en.wikipedia, en.wikipedia, en.wikipedia.org
       eg: J #en.wikipedia
           J pl.wikipedia
           J nl.wikipedia.org
* part channels using 'P <wiki>' (alternatives: pDdRr)
       eg: P en.wikipedia
           P pl.wikipedia.org
           P #nl.wikipedia

Every wiki has three possible parsed formats; page changed, new page,
special (i.e. new user, page move, etc). Some wikis have rcid's included,
others don't.
If a message cannot be parsed (which generally happens with too long page
titles, and unicode page titles like on ja.wikipedia), you will get a raw
data message. No encoding conversion is done; everything comes directly
from the irc bytestring.

Examples:
{"comment": "/* Etymology */ modified the pov", "rcid": None, "title":
"Kalarippayattu", "diffsize": "-167", "flags": "", "user": "Bharatveer",
"diff": "147842174", "channel": "#en.wikipedia", "oldid": "147835786"}

{"comment": "deleted "[[\x0302Kline\"s\x0310]]": a7 no assertion of
notability content was: \"{{dated prod|concern = {{{concern|Local store,
unlikely to be notable.}}}|month = July|day = 29|year = 2007|time =
10:23|timestamp = 20070729102340}}...\"", "flags": "delete", "user":
"NawlinWiki", "channel": "#en.wikipedia", "title": "Special:Log/delete"}

{"comment": "new stub cat as per wss/p", "title": "Category:Wide receiver,
1950s birth stubs", "diffsize": "+181", "flags": "N", "user": "Waacstats",
"channel": "#en.wikipedia"}

and unparseable messages:
{"raw":
"\x0314[[\x0307FNS27\xe6\x99\x82\xe9\x96\x93\xe3\x83\x86\xe3\x83\xac\xe3\x83\x93
\xe3\x81\xbf\xe3\x82\x93\xe3\x81\xaa\xe2\x80\x9c\xe3\x81\xaa\xe3\x81\xbe\xe3\x81\x8b\xe2\x80\x9d\xe3\x81\xa0\xe3\x81\xa3!\xe3\x82\xa6\xe3\x83\x83\xe3\x82\xad\xe3\x83\xbc!\xe3\x83\x8f\xe3\x83\x83\xe3\x83\x94\xe3\x83\xbc!\xe8\xa5\xbf\xe9\x81\x8a\xe8\xa8\x98!\x0314]]\x034
M\x0310
\x0302http://ja.wikipedia.org/w/index.php?title=FNS27%E6%99%82%E9%96%93%E3%83%86%E3%83%AC%E3%83%93_%E3%81%BF%E3%82%93%E3%81%AA%E2%80%9C%E3%81%AA%E3%81%BE%E3%81%8B%E2%80%9D%E3%81%A0%E3%81%A3%21%E3%82%A6%E3%83%83%E3%82%AD%E3%83%BC%21%E3%83%8F%E3%83%83%E3%83%94%E3%83%BC%21%E8%A5%BF%E9%81%8A%E8%A8%98%21&diff=13940623&oldid=13940554\x03
\x035*\x03 \x0303Dream100\x03 \x035*\x03 (+41) \x0310", "channel":
"#ja.wikipedia"}

Comments, of course, are welcome. The source is available at
http://tools.wikimedia.de/websvn/filedetails.php?repname=valhallasw&path=%2Frcbot%2Frcbot.py&rev=0&sc=0

--valhallasw









More information about the Toolserver-l mailing list