Giter Site home page Giter Site logo

wikimon's Introduction

WikiMon

Watch the RecentChanges IRC feed with Python. Support for various WikiMedia projects and languages.

Usage

At the moment, WikiMon's primary usage pattern is broadcasting changes over WebSocket. If you'd simply like to consume these messages, feel free to point a WebSocket client (such as your browser or Autobahn) at http://wikimon.hatnote.com/en/.

If you'd like to run your own copy of WikiMon, install the requirements below, and run the monitor_websocket.py command as follows:

usage: monitor_websocket.py [-h] [--project PROJECT] [--lang LANG]
                            [--port PORT] [--debug] [--loglevel LOGLEVEL]

broadcast realtime edits to a Mediawiki project over websockets

optional arguments:
    -h, --help           show this help message and exit
    --project PROJECT
    --lang LANG
    --port PORT          listen port for websocket connections
    --debug
    --loglevel LOGLEVEL

Requirements

  • Twisted==13.0.0
  • autobahn==0.5.14
  • wapiti

Format

Here are a couple example messages, as broadcast over WebSocket:

{
  "action": "edit",
  "change_size": 19,
  "flags": "M",
  "hashtags": [],
  "is_anon": false,
  "is_bot": false,
  "is_minor": true,
  "is_new": false,
  "is_unpatrolled": false,
  "mentions": [],
  "ns": "User talk",
  "page_title": "User talk:Manxruler",
  "parent_rev_id": "775894803",
  "rev_id": "775894650",
  "summary": "/* The battle of Kristiansand (1940) */",
  "url": "https://en.wikipedia.org/w/index.php?diff=775894803&oldid=775894650",
  "user": "Carsten R D"
}

{
  "action": "edit",
  "change_size": -12,
  "flags": null,
  "geo_ip": {
    "city": "Salisbury",
    "country_name": "United States",
    "latitude": 38.3761,
    "longitude": -75.6086,
    "region_name": "Maryland"
  },
  "hashtags": [],
  "is_anon": true,
  "is_bot": false,
  "is_minor": false,
  "is_new": false,
  "is_unpatrolled": false,
  "mentions": [],
  "ns": "Main",
  "page_title": "Evanescence (Evanescence album)",
  "parent_rev_id": "775894800",
  "rev_id": "774995266",
  "summary": "/* Credits and personnel */ \"Personnel\" is sufficient",
  "url": "https://en.wikipedia.org/w/index.php?diff=775894800&oldid=774995266",
  "user": "71.200.123.192"
}

As you can see, the set of keys sent is always the same. Note that the flags key is redundant, as it is parsed out into is_minor, is_bot, is_unpatrolled, and is_new.

Geolocation

Geolocation is done in process, using maxmind's free dataset. See the GeoDB directory for more info.

See also

wikimon's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wikimon's Issues

Websocket messages occasionally have null change_size values

Websocket messages will occasionally have null values for the change_size key in the JSON. This can be the result of a non-edit recent change entry, such as Special:Log/abuse, which actually doesn't have a size, but those entries actually don't have sizes. For real edits, this problem only seems to occur when it's a "Wikipedia-generated" message, such as "replaced content with '...'" or "Undid revision...".

For reference, an example IRC message:

[[Life sciences]] http://en.wikipedia.org/w/index.php?diff=558037670&oldid=555286077 * 41.133.165.179 * (�-2118�) [[WP:AES|←]]Replaced content with 'Science = Ashleigh.'

And the resulting JSON:

'{"is_anon": true, "page_title": "Life sciences", "url": "http://en.wikipedia.org/w/index.php?diff=558037670&oldid=555286077", "is_unpatrolled": false, "is_bot": false, "is_new": false, "is_minor": false, "summary": "(\\u0002-2118\\u0002) [[WP:AES|\\u2190]]Replaced content with \'Science = Ashleigh.\'", "flags": null, "user": "41.133.165.179", "ns": "Main", "change_size": null}'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.