1.1.0 • Published 6 years ago
wikipedia-titles v1.1.0
wikipedia-titles
13 million English Wikipedia article titles, searchable on the command line.
Installation
This module requires Node.js 7 or higher, because it uses async functions.
npm i wikipedia-titles
A postinstall script will download title data from Wikipedia. This file is around 73MB gzipped, and 273MB unzipped.
Programmatic Usage
const stream = require('wikipedia-titles')
stream
.on('data', (title) => {
console.log(title)
})
.on('end', () => {
console.log('done!')
})
CLI Usage
Install it globally:
npm i -g wikipedia-titles
Now you'll have a command called
wikipedia-titles
on your PATH, and another called wt
for convenience.
Count all titles:
wt | wc -l
13556168
You can optionally specify a string to match. Results are not case sensitive.
wt magnetism
Animal_magnetism
Antiferrimagnetism
Antiferromagnetism
Archaeomagnetism
Asperomagnetism
Bio-magnetism
Bioelectromagnetism
Biomagnetism
...
Pass the --urls
option for full URLs. If you're using a fancy terminal like
Hyper
wt solar --urls
https://en.wikipedia.org/wiki/.solar
https://en.wikipedia.org/wiki/160-minute_solar_cycle
https://en.wikipedia.org/wiki/1859_solar_superstorm
https://en.wikipedia.org/wiki/1878_solar_eclipse
https://en.wikipedia.org/wiki/1919_solar_eclipse
https://en.wikipedia.org/wiki/1986_solar_eclipse
https://en.wikipedia.org/wiki/2009_solar_eclipse
https://en.wikipedia.org/wiki/2013_Kerala_solar_panel_scam
https://en.wikipedia.org/wiki/2017_US_solar_eclipse
...
Using open
and pick
, you
can pipe results into a keyboard-selectable set.
open $(wt electromagnet --urls | pick)
Dependencies
- byline: simple line-by-line stream reader
- minimist: parse argument options
- nugget: minimalist wget clone written in node. HTTP GETs a file and saves it to the current working directory
Dev Dependencies
- jest: Delightful JavaScript Testing.
- mocha: simple, flexible, fun test framework
- standard: JavaScript Standard Style
- semantic-release: Automated semver compliant package publishing
- travis-deploy-once: Run a deployment script only once in the Travis test matrix
License
MIT