Wikipedia paragraph parser with google text to speech api.
This is a sample NPM module inspired by Learn Enough JavaScript to Be Dangerous by Michael Hartl.
This module scrapes Wikipedia pages and converts them to speech with google text-to-speech. Then it plays the audio file generated.
The module can be used as follows:
Installation
First:
$ npm install --global wikp-tts
To run the client library, you must first set up authentication by creating a service account and setting an environment variable. https://cloud.google.com/text-to-speech/docs/reference/libraries Follow directions under Setting up authentication.
Replace [PATH] with the file path of the JSON file that contains your service account key.
export GOOGLE_APPLICATION_CREDENTIALS="[PATH]"
For example:
$ export GOOGLE_APPLICATION_CREDENTIALS="/home/user/Downloads/service-account-file.json"
Usage
$ wikp <URL-ARGUMENT>
For example:
$ wikp Naruto_Uzumaki$ wikp "Naruto Uzumaki"
For use in project:
First:
$ npm install wikp-tts --save
const WikpTts = ;let wikp = ; // processes the command line argument *the search term to wikiwikp;
$ node index.js donald_trump
You can also pass a search term directly:
wikp;
$ node index.js