One of the nice things about Java is there seems to be a friendly (or at least relatively friendly) API for everything.
A little off subject: who thought it was a good idea to name two distinct but related things WikiMedia and MediaWiki? Good luck keeping those terms straight.
Back to JWBF: It is pleasantly easy to use. Admittedly, my needs are far from complex: replace the text of a couple of templates on a regular basis. It’s hardly glamorous programming, but it should save us some time at work.
Now we’ll have more time to sing along with Invent a freeze ray.
Dr. Horrible’s Sing-Along Blog.
Happily the library exists in the central maven repository, so getting it included in my project is easy enough:
Actually using the framework is as easy as this:
MediaWikiBot mediaWikiBot =
new MediaWikiBot( "http://hostname/wiki/" );
mediaWikiBot.login( "CurrentlyDeployedBot", "password" );
Article article = new Article(mediaWikiBot.readContent(
"Template:Currently deployed/Arinc" ), mediaWikiBot );
article.setText( "Test" );
It’s always nice when things are this easy. *cheers*
One more thing: if you’re looking to create a bot or script for automatic or semi-automatic usage of Wikipedia, please review Wikipedia’s bot policy first.