Skip to content

Instantly share code, notes, and snippets.

@nukosuke
Created June 8, 2016 00:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nukosuke/a9c6832b3ea4a0d1e62e96ed5db87b61 to your computer and use it in GitHub Desktop.
Save nukosuke/a9c6832b3ea4a0d1e62e96ed5db87b61 to your computer and use it in GitHub Desktop.
node.jsでKyokoさんに源氏物語1章を朗読してもらう
var client = require('cheerio-httpcli');
var execSync = require('child_process').execSync;
client.fetch('http://attic.neophilia.co.jp/aozora/genjimonogatari/htmlfiles/kiritsubo.html', {}, (err, $, res) => {
$('p').each(function(idx) {
$(this)[0].children
.filter(item => item.type === 'text')
.map(item => item.data.replace(/(.+)/g, ''))
.forEach(item => execSync(`say ${item}`));
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment