Skip to content

Latest commit

 

History

History
93 lines (74 loc) · 2.42 KB

README.md

File metadata and controls

93 lines (74 loc) · 2.42 KB

WikiMon

Watch the Wikimedia EventStreams feed with Python. Support for various Wikimedia projects and languages.

Usage

WikiMon broadcasts real-time Wikimedia edits over WebSocket. Point a WebSocket client at wss://wikimon.hatnote.com/en/ (or any supported language path like /de/, /ja/, /wikidata/, etc.).

To run your own instance:

usage: python -m wikimon.monitor [-h] [--port PORT] [--lang LANG]
                                 [--project PROJECT]
                                 [--debug] [--loglevel LOGLEVEL]

Broadcast realtime Wikimedia edits over WebSockets (multi-language)

optional arguments:
    -h, --help           show this help message and exit
    --port PORT          listen port for WebSocket connections
    --lang LANG          run a single language only (for testing); omit for all
    --project PROJECT    project (used with --lang)
    --debug
    --loglevel LOGLEVEL  e.g., DEBUG, INFO, WARN

By default (no --lang), the server handles all 43 supported languages on a single port, routing by WebSocket path.

Requirements

  • Python 3.10+
  • aiohttp
  • websockets
  • requests

Format

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

{
  "action": "edit",
  "change_size": 19,
  "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,
  "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"
}

The set of keys is always the same.

See also