Skip to content

patrykpacewicz/wikimedia-stream-library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wikimedia-stream-library

Build Status Download

wikimedia-stream-library is a library getting an edit stream of wikimedia based pages (e.g, en.wikipedia.org).

Binaries

Example for Gradle:

repositories {
    maven { url "https://dl.bintray.com/patrykpacewicz/maven" }
}
dependencies {
    compile 'pl.patrykpacewicz:wikimedia-stream-library:0.1.0'
}

Implementation details

The library works through socket.io wikimedia server connection. Details about the api and the data structures can be found in the mediawiki documentation.

How to use:

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();

Example usage

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();
    }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published