MediaWiki RecentChanges into text line while keeping track of changes seen
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


wikirc2text is a simple Python script to dump MediaWiki RecentChanges as single text line. The script is able to keep the state of the already seen lines avoiding to output the same changes again.

The idea behind the script is to have a simple command-line interface to dump Wiki RecentChanges feed into other program like sendxmpp ( As I didn't want to flood the XMPP conference room with the same output, I made wikirc2text to track the already seen lines.


    Usage: url(s)

      -h, --help            show this help message and exit
      -s, --state           keep state of existing rcline seen and don't output
      -c STATESEC, --cleanstate=STATESEC
                            expire states existing more than number of seconds
      -t, --tail            tail-like operation by continuously appending new
                            changes (--state option is enable)
      -w WAIT, --wait=WAIT  number of seconds to wait before refreshing (default
                    is 60)

Sample usage

% python "" --state | head -4
Ekopedia  - Recent changes [en] by Wibil @ Sun, 09 Jan 2011 08:09:03 +0000 by Wibil @ Sun, 09 Jan 2011 06:31:28 +0000 by Social Networking @ Sat, 08 Jan 2011 20:19:42 +0000

If you do a second request, just after. As there is no changes, there is no output. If you don't use the --state option, you'll get all the latest changes without checking the state cache.

% python "" --state

You can clear the state following an interval specified in seconds.

% python -c 60
29 states deleted

You can also use the tail-like interface to have a continuous update of the new recent changes.

% python "" --tail

Usage with sendxmpp

% python --state "" | head -5 |sendxmpp -u yourbotname -p yourbotpassword -r yourbotressource -j an.xmpp.server -t -c aconference@conference.somewhere

Software required