Giter VIP home page Giter VIP logo

wikipedia-tldr's Introduction

wikipedia-tldr

Grab the first paragraph of any Wikipedia page

Use it programmatically with JavaScript to fetch JSON, or use the command line interface (CLI) to look stuff up from your terminal.

Programmatic Usage

Install it:

npm install wikipedia-tldr

Use it in JavaScript:

const tldr = require('wikipedia-tldr')

tldr('somatology').then(result => {
  console.log(result)
})

The result looks like this:

{
  query: "pomology",
  type: "standard",
  title: "Pomology",
  displaytitle: "Pomology",
  thumbnail: {
    source: "https://upload.wikimedia.org/wikipedia/commons/thumb/9/95/Poire_Willermoz.jpg/241px-Poire_Willermoz.jpg",
    width: 241,
    height: 320
  },
  originalimage: {
    source: "https://upload.wikimedia.org/wikipedia/commons/9/95/Poire_Willermoz.jpg",
    width: 644,
    height: 856
  },
  lang: "en",
  description: "branch of botany that studies and cultivates fruit",
  extract: "Pomology is a branch of botany that studies and cultivates fruit. The denomination fruticulture—introduced from Romance languages —is also used.",
  extract_html: "<p><b>Pomology</b> is a branch of botany that studies and cultivates fruit. The denomination <b>fruticulture</b>—introduced from Romance languages —is also used.</p>"
}

If no result is found, null is returned.

The default language is English en, but you can specify a different language with an optional secondar argument to the function:

tldr('muñeca', 'es')

For available language codes, see the List of Wikipedias.

CLI Usage

npm i -g wikipedia-tldr && wikipedia-tldr pomology

or use npx

$ npx wikipedia-tldr zymology
npx: installed 62 in 4.301s
English

Alternative forms
zumology (dated)
Etymology
From zymo- +‎ -logy.
Noun
zymology (uncountable)
(zymurgy) A treatise on the fermentation of liquors, or the doctrine of fermentation.
The science of or knowledge concerning fermentation.
Translations


References
zymology in Webster’s Revised Unabridged Dictionary, G. & C. Merriam, 1913
The Century Dictionary, The Century Co., New York, 1914

Tests

npm install
npm test

Dependencies

  • cheerio: Tiny, fast, and elegant implementation of core jQuery designed specifically for the server
  • got: Simplified HTTP requests

Dev Dependencies

  • jest: Delightful JavaScript Testing.

License

MIT

wikipedia-tldr's People

Contributors

zeke avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.