Socket
Socket
Sign inDemoInstall

node-wikifetch

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    node-wikifetch

A small utility which helps make requests to wikipedia api easily.


Version published
0
Maintainers
1
Install size
7.22 kB
Created
Weekly downloads
 

Readme

Source

node-wikifetch

A small utility that helps make wikipedia api requests easily.

  • Node.js > 6.9
  • No external dependencies

How to install

npm install node-wikifetch --save

How to use

const wikifetch = require('node-wikifetch');
 
// Using sring query
wikifetch('action=query&format=json&prop=extracts&exintro=1&redirects=1&titles=nodejs', (err, data) => {
    if (err) {
        // handle an error here 
    }
    console.log(data);
});

// Using object query
wikifetch({
    action: 'query',
    format: 'json',
    prop: 'extract',
    exintro: '1',
    redirects: '1',
    titles: 'nodejs'
}, (err, data) => {
    if (err) {
        // handle an error here 
    }
    console.log(data);
});

Wikifetch api

wikifetch(query, callback)

  • query <String | Object>
  • cb <Function>

A query is either a string or an object that would be translated to a string for mediawiki api. A callback is a function with an error as the first argument and the data received from wikipedia as the second.

Example

To execute an example and to see a sample output type

node example.js

Keywords

FAQs

Last updated on 03 May 2019

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc