Created
March 17, 2014 15:14
-
-
Save kissge/9601092 to your computer and use it in GitHub Desktop.
Wikipedia scraper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// usage: node wikipedia.js バールのようなもの 鈍器 | |
var scraper = require('scraper'); | |
var fs = require('fs'); | |
process.argv.forEach( | |
function (v, i) | |
{ | |
if (i < 2) return; | |
scraper('http://ja.wikipedia.org/wiki/' + v, | |
function (err, $) | |
{ | |
if (err) throw err; | |
fs.writeFileSync(v + '.txt', $('#mw-content-text').text()); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment