cytrus-re/wikipediajs
Promise-based Wikipedia API wrapper.
Table of contents
Installation
Install via npm:
$ npm install @cytrus-re/wikipediajs
...or via a CDN:
<script src="https://unpkg.com/@cytrus-re/wikipediajs/dist/index.umd.min.js" />
Features
- Search Wikipedia articles in any language
- Get a random article
- Get feed for Picture of the day, featured article or 'on this day' articles
Usage
-
Import module:
import wiki from "@cytrus-re/wikipediajs";
...or require:
const wiki = require("@cytrus-re/wikipediajs");
-
Search for an article:
wiki
.search("savanna hawk")
.then((res) => console.log(res))
.catch((error) => console.log(error));
-
Search for an article in a different language:
wiki
.search("Veulta a san juan", "es")
.then((res) => console.log(res))
.catch((error) => console.log(error));