wikimedia-stream-library is a library getting an edit stream of wikimedia based pages (e.g, en.wikipedia.org).
Example for Gradle:
repositories {
maven { url "https://dl.bintray.com/patrykpacewicz/maven" }
}
dependencies {
compile 'pl.patrykpacewicz:wikimedia-stream-library:0.1.0'
}
The library works through socket.io wikimedia server connection. Details about the api and the data structures can be found in the mediawiki documentation.
Configure and set listeners using WikiMediaStream.builder()
and then connect()
to the source of events
WikiMediaStream wikiMediaStream = WikiMediaStream.builder()
.mikimediaStreamUrl(...)
.subscribeChannel(...)
.onDisconnect(...)
.onConnect(...)
.onChange(...)
.onError(...)
.build()
wikiMediaStream.connect();
wikiMediaStream.disconnect();
Simple example of listening on *.wikipedia.org
channels and printing out the data.
import pl.patrykpacewicz.wikimedia.stream.WikiMediaStream;
public class Start {
public static void main(String[] args) throws Exception {
WikiMediaStream.builder()
.subscribeChannel("*.wikipedia.org")
.onChange(System.out::println)
.build().connect();
}
}