WikiQ
WikiQ allows you to query wikipedia pages and other info using WikiMedia API. WikiMedia is pretty well documented, this provides a NodeJS adapter to query different information from Wikipedia as:
See APIs details here
Install using npm:
npm install ---save wikiq
Parse Pages
To parse and get content of page Zika_virus
:
var wiki = ; wiki;
To get custom properties:
var wiki = ; wiki ;
See more detail about properties here
Query Pages
To query page Zika_virus
:
var wiki = ; wiki;
Similary can specify custom properties, as in parse using prop
method
See more detail about properties here
Get Category Tree
Category tree provides the category tree for a page title, you can query the same using:
var wiki = ; wiki;
See more detail about properties here
Query Template Info
Wikipedia has lot of templates, or you can create a new template - which are used across lot of pages in Wikipedia. To query a template info:
var wiki = ; wikidata { console; console;};
See more detail about properties here
API
Wikiq API is simple, once you have required wikiq
, you simply select the type of api:
Every type has these common methods:
- format (string): format of the response. Wikipedia suppports
- json
- none
- php
- xml
- prop (string or array): specify list of properties to fetch, varies as per the API type
Also the method follows fluent interface, so you can kepp on piping API calls.
wiki action'query' ...
Page API
Page API has following methods:
- query (callback): query a page, using
action:query
- parse (callback): parse a page, using
action:parse
- templates (callback): gets the templates in a page
- sections (callback): gets the sections in a page
- xml (callback): gets the complete xml
parsetree
of page - images (callback): gets the
images
of page
Category API
Category API has following methods:
- tree (callback): gets the category tree
Template API
Template API has following methods:
- data (callback): gets the template data
Custom API
You can hit your own custom API or action as they are in Wikimedia:
wiki action'query' title'Malaria'