🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

random-wiki-batch

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

random-wiki-batch

Get a random batch of wikipedia articles using the MediaWiki API

0.2.0
latest
Version published
Weekly downloads
5
400%
Maintainers
1
Weekly downloads
 
Created

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

FAQs

Package last updated on 08 Jun 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts