SeanColombo.com

My little corner of the internet.

Open sourcing a MediaWiki bot framework

On my last post I asked what my readers wanted me to write about and all of the responses I got on the post or in person had the “how to write a MediaWiki bot in 10 minutes or less” at the top of the list.

I have that post mostly written, but in order to make that whole process easier, I’ve finally made the bot framework that I now use to be open sourced and easily accessible online.

Background

I used to use custom scripts for my bot, but this summer when LyricWiki transitioned over to Wikia, they all broke. My scripts pre-dated the MediaWiki API so they had depended on screen-scraping which no longer worked when we switched to Wikia’s skins which had a completely different layout.

When I had to get my bots running again, I looked at a few Perl frameworks for connecting to the MediaWiki API, and the one that seemed to have significantly less bugs than the others was a perl module by CBM.

Over the months, I’ve realized that there was some functionality that wasn’t implemented yet but which I needed – deleting pages, issuing purges, finding all templates included on a page – so I updated to the module. I tried to get access to the MediaWiki Tool Server where the project is currently hosted, but they must be really busy because they haven’t replied to the JIRA issue (request for an account) and it’s been months.

Since it has become quite a waiting game, I decided to just fork the project. Hopefully CBM will want access to the repository and we can just keep working on it together. Regardless, I’ve created all of the usual suspects for a project such as this (see next section).

Project links

So, without further delay, here are the beginnings of the Perl MediaWiki API

The links (especially the wiki) need a lot of work before it becomes obvious how to quickly get set up and use the module. The next blog post will take care of that!

However, if you’re curious & are already comfortable with Perl (and to some extent MediaWiki), you can jump right in. Let me know if you have any feedback. Thanks!

Category: Programming
  • Jools says:

    Just wondering in regards to the comment about bugs, did you try and have any problems using my module (also called MediaWiki::API and on cpan), or you wanted something with more high level functions ?

    March 31, 2010 at 3:58 pm
  • Roberto Santoro says:

    Hello Sean,
    great job on this module. Do you think I can use it with basic authentication? (I’m using the Auth_remoteuser module to get the users authenticated).

    Thanks,
    Roberto.

    October 7, 2011 at 11:26 am
  • Sean says:

    @Roberto Yes: since it’s using Perls LWP::UserAgent under the hood you should be able to use basic auth with it.

    The syntax should be something like:
    $api = Mediawiki::API->new();
    $api->{‘agent’}->credentials(
    ‘servername:portnumber’,
    ‘realm-name’,
    ‘username’ => ‘password’
    );

    The Perl docs for LWP::UserAgent have more details if you need.

    Hope that helps! :)

    October 11, 2011 at 1:24 am

Your email address will not be published. Required fields are marked *

*