zlargon / google-tts Goto Github PK
View Code? Open in Web Editor NEWGoogle TTS (Text-To-Speech) for node.js
Home Page: https://www.npmjs.com/package/google-tts-api
License: MIT License
Google TTS (Text-To-Speech) for node.js
Home Page: https://www.npmjs.com/package/google-tts-api
License: MIT License
Any text that is over 200 characters returns a URL that just 404's.
What if i want to execute node file.js and listen to the output?
The sample code present in the examples is not working:
// get base64 text
googleTTS.getAudioBase64('Hello World', {
lang: 'en-US',
slow: false,
host: 'https://translate.google.com',
timeout: 10000,
})
.then(console.log) // base64 text
.catch(console.error);
Error: lang "en-US" might not exist
It successfully returned base64 output for language codes: 'en', 'es'.
en-Us, en-AU are working fine for getAudioUrl,getAllAudioUrls functions though.
Hello,
Currently, I'm using google-tts-api in version 0.06, and it's not working as I get the "get key failed from google" error. Is there any way to solve the issue?
Thank you.
Hi, I was using google TTS API (the real one in google cloud). I saw they have gender params at here. Does this package supported?
can i use SSML-Tags to control the tts?
i dont see anything mentioned here...
https://cloud.google.com/text-to-speech/docs/ssml
thx,
hi i have been using your api and im trying to get male voices for it do u have it
I've checked the source code and found the key is requested and computed every time the function is called.
I'm using a simple script that reads out some text, using en-US as the lang. For an unknown reason the API is playing a different voice every so often.
q=<part>&total=<total parts>&idx=<part index>&textlen=<part length>
This can be done by sending a request with data:
[[["MkEWBc","[[\"WORD_TO_CHECK\",\"auto\",\"TARGET_LANGUAGE\",true],[null]]",null,"generic"]]]
example result
)]}'
393
[["wrb.fr","MkEWBc","[[null,null,\"en\",[[[0,[[[null,7]\n]\n,[true]\n]\n]\n]\n,7]\n]\n,[[[null,null,null,null,null,[[\"pengujian\",[\"pengujian\"]\n]\n]\n]\n]\n,\"id\",1,\"auto\",[\"testing\",\"auto\",\"id\",true]\n]\n,\"en\",[\"testing\",null,null,[[\"test\"]\n,null,1]\n,null,null,null,null,\"en\",1]\n]\n",null,null,null,"generic"]
,["di",29]
,["af.httprm",28,"-2444905251841777356",28]
]
26
[["e",4,null,null,430]
]
where the detected language seems to be in ...[[null,null,\"en\"...
But this also mean that we need to send 2 requests, first to get the detected language, second to get the base64 data
I'm using the exact same code as I have been for the past few months, and recently have been getting a Error: get key failed from google
Any way to fix this?
Thanks for the great repo, it is very useful.
I have one suggestion:
In some countries, we cannot access https://translate.google.com
It will be helpful if we support use other api host
Hey Leon, I have gone through your npm package “google-tts”. It was very good and useful. I have a doubt. If I use Text to Speech from Google. I had to pay them and get credentials. How it is free in your “google-tts”. Will I get any issues in the future If I use it for a long time?
Hi!
I tried to use google-tts in my web app but when I did a request I obtained this error in the console:
Failed to load https://translate.google.com/: Redirect from 'https://translate.google.com/' to 'https://translate.google.com/m/translate' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Error: get token key failed from google
https://austinfrg.is-inside.me/9ADE6PrS.png
I'm getting this error every time I try to use tts, it used to work when I increased the "maxTimes" option, but it doesn't work at all now.
I use it with discord.js v11.6.1
How to fix this with New version 2.0.0?
Why you don't have discord server?
const tts = require("google-tts-api");
// tts(tts1, `km`, 0.90) old version
tts.getAudioUrl("hello world", {
lang: "en-US",
slow: false,
host: "https://translate.google.com"
})
.then(function(url) {
voiceChannel.join().then(connection => {
voice();
function voice() {
const stream = connection.playStream(url);
}
});
I was wondering if it would be possible for people to choose between a female and male voice (if there is one)
Hi,
I'm on a fairly slow connection behind a VPN, and not always getting replies processed. Is this likely just due to my conditions or can there be other reasons?
Thanks!
I tried to install it in my react-native project but it is throwing error
\node_modules\google-tts-api\dist\getAudioUrl.js: url could not be found within the project or in these directories: node_modules
var assertInputTypes_1 = __importDefault(require("./assertInputTypes")); var splitLongText_1 = __importDefault(require("./splitLongText")); var url_1 = __importDefault(require("url"));
can you help me why i am getting this error
Hi, this gave me the error
Error: get key failed from google
at [redacted]\node_modules\google-tts-api\lib\key.js:23:23
at
at process._tickCallback (internal/process/next_tick.js:189:7)
Nothing much else to say, I don't have any errors or anything; there aren't any.
Google must have changed something as where this was working before, now it isn't.
As title is asking, I'm curious to see if this is free forever? I implemented it but have not seen to hit any kind of limit or anything. I'm nervous to use this in my application due to needing a billing key or something from Google.
Hi,
I just test google-tts-api and I'm in trouble to use it.
I always get the following error: Error: get key failed from google
Is there a way to avoid that ?
I am in the last version: 0.04.
Thanks by advance
.
I am receiving an error with respect to a get key.
I looked at issue #17 but did not understand the context to the notification package which I did not have previously installed.
I tried to install this notification package but I did not see a change of behavior
I just installed the most recent version 0.0.4 of the library and tested with my react-native sample project, it gave me this exception:
get key failed from google,
BTW, I can access this site: https://translate.google.com from my region.
So is the key expired? or I need to get my own key? or google changed their API again?
Thanks
Hi, @zlargon
I noticed that there is an option regarding tts speed in the getAudioUrl file.
ttsspeed: slow ? 0.24 : 1,
I wonder if there is any way for us to assign different speeds. i.e. slow(0.25), medium(0.5), upper medium(0.75) and normal(1)
Thanks.
Hi Leon
First of all thanks for your package!
recently, when installing I got a node-fetch vulnerability. See:
$ npm install google-tts-api
npm notice created a lockfile as package-lock.json. You should commit this file.
+ [email protected]
added 8 packages from 7 contributors and audited 8 packages in 1.69s
found 1 low severity vulnerability
run `npm audit fix` to fix them, or `npm audit` for details
$ npm audit
=== npm audit security report ===
┌──────────────────────────────────────────────────────────────────────────────┐
│ Manual Review │
│ Some vulnerabilities require your attention to resolve │
│ │
│ Visit https://go.npm.me/audit-guide for additional guidance │
└──────────────────────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low │ Denial of Service │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ node-fetch │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in │ >=2.6.1 <3.0.0-beta.1|| >= 3.0.0-beta.9 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ google-tts-api │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ google-tts-api > isomorphic-fetch > node-fetch │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://npmjs.com/advisories/1556 │
└───────────────┴──────────────────────────────────────────────────────────────┘
found 1 low severity vulnerability in 8 scanned packages
1 vulnerability requires manual review. See the full report for details.
$ npm audit fix
up to date in 0.188s
fixed 0 of 1 vulnerability in 8 scanned packages
1 vulnerability required manual review and could not be updated
How can I remove the vulnarability?
Have you to update the package?
see github suggestion:
Remediation
Upgrade node-fetch to version 2.6.1 or later. For example:
"dependencies": {
"node-fetch": ">=2.6.1"
}
or…
"devDependencies": {
"node-fetch": ">=2.6.1"
}
Thanks/Cheers
giorgio
Hi
this is not an issue, just a note.
I'm using google-tts (THANKS) in https://github.com/solyarisoftware/jointts, my work in progress package.
I also used google-tts in past an run smoothly.
recently I experiencing some errors like Error: get key failed from google
(google-tts-api/lib/key.js:30:32). I presume it's a Google API reject/error. Apparently errors arise random (e.g. not related to API calls rate).
$ jointts download gt mi chiamo Giorgio --language=it
sentence : mi chiamo Giorgio
language : it
speed : normal
Error: get key failed from google
at /home/giorgio/jointts/node_modules/google-tts-api/lib/key.js:30:32
at processTicksAndRejections (internal/process/task_queues.js:93:5)
Workaround (not rocket-science): because the google API raise error occasionally, I retry until I got success.
In few shots the API return success (I admit, that's dirty):
for (;;) {
callGoogleAPI(...)
if success
break
sleep(few hundreds msecs)
}
Any idea?
Thanks
giorgio
what is the stream format of the url get by getAllAudioUrls
Not works in Chrome
Fetch API cannot load https://translate.google.com/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
home.vue:68 TypeError: Failed to fetch
I can not access link from module with error .
Access to translate.google.com was denied You don't have authorization to view this page.
HTTP ERROR 403
Hello 👋
I run a security community that finds and fixes vulnerabilities in OSS. A researcher (@zer0h-bb) has found a potential issue, which I would be eager to share with you.
Could you add a SECURITY.md
file with an e-mail address for me to send further details to? GitHub recommends a security policy to ensure issues are responsibly disclosed, and it would help direct researchers in the future.
Looking forward to hearing from you 👍
(cc @huntr-helper)
is it possible to migrate this project to firebase?
Hello zlargon,
Currently, I'm using google-tts-api in version 0.0.3, and it's no longer working, an "get key failed from google" error appears.
Does it not work in older versions?
Do we need to update to the latest version?
Thank.
Is it possible to add intonation like in android?
Expressive, flat
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.