Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/edsu/wikichanges

a NodeJS library for monitoring changes on Wikipedia sites
https://github.com/edsu/wikichanges

Last synced: 8 days ago
JSON representation

a NodeJS library for monitoring changes on Wikipedia sites

Awesome Lists containing this project

README

        

wikichanges
===========

**Note: it is now possible to get the Wikipedia update stream easily from Wikipedia's [EventStreams](https://wikitech.wikimedia.org/wiki/Event_Platform/EventStreams). I think there's so much tooling around the old IRC update channels that they haven't been turned off yet, but maybe someday. If you are building something new you should really look at EventStreams!**

---

wikichanges is a node.js library for getting an edit stream from the 37 major language Wikipedias. The Wikipedia MediaWiki installations are configured to log changes in [specific IRC channels](http://meta.wikimedia.org/wiki/IRC/Channels#Raw_feeds). wikichanges joins all these channels, listens for updates, which it then parses, and sends as JavaScript objects to a callback of your choosing. Each change will look something like:

```javascript
{
channel: '#en.wikipedia',
wikipedia: 'English Wikipedia',
page: 'Persuasion (novel)',
pageUrl: 'http://en.wikipedia.org/wiki/Persuasion_(novel)',
url: 'http://en.wikipedia.org/w/index.php?diff=498770193&oldid=497895763',
delta: -13,
comment: '/* Main characters */',
wikipediaUrl: 'http://en.wikipedia.org',
user: '108.49.244.224',
userUrl: 'http://en.wikipedia.org/wiki/User:108.49.244.224',
unpatrolled: false,
newPage: false,
robot: false,
anonymous: true,
namespace: 'Article'
flag: '',
}
```

Install
-------

If you aren't on Ubuntu, try to do the equivalent to get your node.js
environment set up, and run a test program:

% sudo apt-get install nodejs
% npm install wikichanges

Usage
-----

Here's a simple example of listening on all Wikipedia channels and printing
out the page that changed along with its URL.

```javascript
var wikichanges = require("wikichanges");

var w = new wikichanges.WikiChanges();
w.listen(function(change) {
console.log(change.page + " " + change.pageUrl)
});
```

If you would like to listen only on a particular channel or channels
create the wikichanges object like this:

```javascript
var w = new wikichanges.WikiChanges({wikipedias: ["#fr.wikipedia", "#de.wikipedia"]});
```

By default wikichanges picks a IRC nick of `wikichanges-{hostname}` where
hostname is the hostname for the computer that your program is running.
If you would like to control the IRC nick used by your program use the
`ircNickname` option:

```javascript
var w = new wikichanges.WikiChanges({ircNickname: 'super-awesome'})
```

License
-------

* CC0