Skip to content
Java Wiki Bot Framework is a library to maintain Wikis like Wikipedia based on MediaWiki.
Java Shell
Branch: master
Clone or download

JWBF - JavaWikiBotFramework.

Build Status Coverage Status Maven Central

The Java Wiki Bot Framework is a library to retrieve data from and maintain MediaWiki-based wikis such as Wikipedia. It has packages that handle basic tasks (login, cookies, encoding, token management) so that you can write your wiki bot without being a MediaWiki API expert. JWBF requires JRE 1.7.

Code sample

   * Sample bot that retrieves and edits an article.
  public static void main(String[] args) {
    MediaWikiBot wikiBot = new MediaWikiBot("");
    Article article = wikiBot.getArticle("42");
    System.out.println(article.getText().substring(5, 42));
    wikiBot.login("user", "***");;

  static void applyChangesTo(Article article) {
    // edits the article...

Table of contents

Code sample | Developer resources | Getting started | Dependencies | Working with Wikimedia | More resources

Developer resources

Getting started

JWBF uses Maven to automatically resolve dependencies. To use Maven to start a new project, follow the Maven in Five Minutes tutorial. For a more detailed introduction, see Maven's Getting Started guide.

The Java Wiki Bot Framework is available from two repositories. For a more stable version of JWBF, use the most recent version in the RELEASES repository at Maven Central. For the development version, which will be most up-to-date, use the most recent version in the SNAPSHOTS repository at


Once you have started your project in Maven and have a pom.xml file for your bot's project, add the appropriate JWBF dependency to the <dependencies> section. When you build your project, JWBF and its own dependencies will be downloaded automatically.

Beginning with jwbf 4.x.x Java 8 is required



If you want to use a different release of JWBF, find your desired version in RELEASES and change <version> to its listed title.


Add this to your <repositories> section:

  <name>Sonatype Nexus Snapshots</name>

Add this to your <dependencies> section:


If you want to use a different snapshot of JWBF, find your desired version in SNAPSHOTS and change <version> to its listed title.


Here is one example of using JWBF to write a bot that can retrieve and edit an article on a desired wiki.

More Java examples (e.g. for queries) can be found at unit- and integration-test packages.

Working with Wikimedia

If you are working with Wikimedia sites, set an informative User-Agent header, because all Wikimedia sites require a HTTP User-Agent header for all requests.

//Creating a new MediaWikiBot with an informative user agent
HttpActionClient client = HttpActionClient.builder() //
  .withUrl("") //
  .withUserAgent("BotName", "1.0", "your Email or Maintainer UserName") //
  .withRequestsPerUnit(10, TimeUnit.MINUTES) //
MediaWikiBot wikiBot = new MediaWikiBot(client);

See also

You can’t perform that action at this time.