random-wiki-batch
v0.2.0
Published
Get a random batch of wikipedia articles using the MediaWiki API
Downloads
4
Maintainers
Readme
random-wiki-batch
Get a specified number of random Wikipedia articles. Returns a Promise consisting of an array of random articles from Wikipedia using the MediaWiki API with their titles, pageid, and content.
The content appears under the revisions
key of an article as raw wikitext. Check out txtwiki.js for parsing wikitext as plaintext.
Install
$ npm install --save random-wiki-batch
Usage
const randomWikiBatch = require('random-wiki-batch');
// If no arguments passed, randomWikiBatch defaults to 10 random articles
const randomArticles = randomWikiBatch(3);
randomArticles.then(articles => console.log(articles));
// [ { pageid: 1442049,
// ns: 0,
// title: 'International Center of Photography',
// revisions: [ [Object] ] },
// { pageid: 51440676,
// ns: 0,
// title: 'Basti Azeem',
// revisions: [ [Object] ] },
// { pageid: 53745028,
// ns: 0,
// title: 'Gold Star Families Memorial and Park',
// revisions: [ [Object] ] } ]
License
MIT