Closed chayleaf closed 3 years ago
Version 2.0.0 supports the long texts now. Please see the usage in README:
getAllAudioUrls(text, [option])
(For text longer than 200 characters)lang
, slow
, host
, splitPunct
Example:
const googleTTS = require('google-tts-api');
const results = googleTTS.getAllAudioUrls('LONG_TEXT_...', {
lang: 'en-US',
slow: false,
host: 'https://translate.google.com',
splitPunct: ',.?',
});
console.log(results);
// [
// { shortText: '...', url: '...' },
// { shortText: '...', url: '...' },
// ...
// ];
getAllAudioBase64(text, [option])
(For text longer than 200 characters)lang
, slow
, host
, timeout
, splitPunct
Example:
const googleTTS = require('google-tts-api');
googleTTS
.getAllAudioBase64('LONG_TEXT_...', {
lang: 'en-US',
slow: false,
host: 'https://translate.google.com',
timeout: 10000,
splitPunct: ',.?',
})
.then(console.log)
// [
// { shortText: '...', base64: '...' },
// { shortText: '...', base64: '...' },
// ...
// ];
.catch(console.error);
q=<part>&total=<total parts>&idx=<part index>&textlen=<part length>