Search code examples
restcontent-management-systemmediawikimediawiki-apimediawiki-extensions

Retrieve information from a mediawiki in a more structured way


We would like to use a self-hosted mediawiki as a lightweight CMS to retrieve information from. However, the basic REST API is very limited in the way that it can retrieve content: this is probably because most information on wiki's is in unstructured form.

  • Is it possible to add your own ID system to a mediawiki so that instead of getting a whole page or section worth of information, you could search for specific ID's (or even request content by ID in a REST-like way? for example /:heading/:subheading/:sub-subheading ?
  • or if not, at least have a way of adding your own ID's so you could parse the information within a section in a more structured way?

Solution

  • Solved by using: - The default REST API, simplified using npm package nodemw. - Parsing wiki/text to HTML using npm package instaview. - Accessing / modifying the HTML serverside using npm package cheerio.

    Long live free, unstructured BLOBs of text! go wikimedia go! omg.