Skip to content

Give me a term and I'll give you a list of links found in its Wikipedia article

Notifications You must be signed in to change notification settings

IonicaBizauKitchen/wikipedia-hyperlinks

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wikipedia-hyperlinks

Give me a term and I'll give you a list of links found in its Wikipedia article

Installation

This module requires Node.js 8 or higher, because it uses async functions.

Install as a module for programmatic use in your JavaScript code:

npm i wikipedia-hyperlinks --save

Or install as a command-line tool:

npm i -D wikipedia-hyperlinks

Module Usage

The module exports a single async function which expects a search string:

const wh = require('wikipedia-hyperlinks')

wh('Pierre Curie').then(links => {
  console.log(links.slice(0, 10))

  // Paris
  // University of Paris
  // Radioactivity
  // Curie-Weiss law
  // Curie constant
  // Curie temperature
  // Piezoelectricity
  // Marie Skłodowska-Curie
  // Irène Joliot-Curie
})

If no match is found, an empty array is returned.

CLI Usage

If you install the module globally, you'll have a command called wikipedia-hyperlinks on your PATH, and another called wh for convenience.

Enter a term:

wh Pierre Curie | head

Paris
University of Paris
Radioactivity
Curie-Weiss law
Curie constant
Curie temperature
Piezoelectricity
Marie Skłodowska-Curie
Irène Joliot-Curie

Tests

npm install
npm test

Dependencies

  • cheerio: Tiny, fast, and elegant implementation of core jQuery designed specifically for the server
  • got: Simplified HTTP requests
  • lodash: Lodash modular utilities.
  • minimist: parse argument options
  • urldecode: Decode url

Dev Dependencies

  • chai: BDD/TDD assertion library for node.js and the browser. Test framework agnostic.
  • mocha: simple, flexible, fun test framework
  • nixt: Simple and powerful testing for command-line apps
  • standard: JavaScript Standard Style
  • standard-markdown: Test your Markdown files for Standard JavaScript Style™

License

MIT

About

Give me a term and I'll give you a list of links found in its Wikipedia article

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%