load - nodef/extra-quotes GitHub Wiki

Loads quotes from Wikiquote, or local (movies).

quotes.load([query], [options]);
// query: query text, for Wikiquote
// options:
// .all: load all query results (default: true)
// --> Promise true, when done
const quotes = require('extra-quotes');

await quotes.load('mahatma gandhi');
/* loads Mahatma Gandhi quotes from Wikiquote */

await quotes.load('arnold', {all: false});
/* loads only Arnold Schwarzenegger quotes from Wikiquote*/

await quotes.load();
/* loads local popular movie quotes */

quotes.corpora;
// Map {'Mahatma Gandhi' => quotes, 'Arnold Schwarzenegger' => quotes, '' => movie quotes}

quotes('success');
// [ { text:
//      "Satan's successes are the greatest when he appears with the name of God on his lips.",
//     by: 'Mahatma Gandhi',
//     ref:
//      `"The Inwardness of Non-Co-operation". Quoted in Freedom's Battle: Being a Comprehensive Collection of Writings and Speeches (1922), p. 144.` },
//   { text:
//      "Just remember, you can't climb the ladder of success with your hands in your pockets.",
//     by: 'Arnold Schwarzenegger',
//     ref:
//      'Commencement Speech at University of Southern California (May 2009).' } ]

// NOTE: by default, quote texts longer that 160 characters are ignored.
//       to include them, try: quotes('success', null, {filter: null});