Closed solyarisoftware closed 3 years ago
Google might change the way to store the key. I will take a look. Thanks.
I've also been using this package for a while now and am experiencing the same error.
The original way the library get the secret token key from the google website cannot 100% guarantee success now. After doing some testing, I decided to add a retry mechanism into the code. The latest version 0.0.5 should work fine.
I plan to re-write the project to handle this issue in another efficient way: caching the token key so that we don't have to fetch the token key every time. I also plan to add some new features, such as supporting long text input. It will be expected to have some breaking changes.
Thanks.
There are two patterns for Google Translate page URL ( https//translate.google.com ) contents and the contents sometime doesn't contain TKK
parameter. This is why Error: get key failed from google
happens.
Google might is introducing new process about TTS into Google Translate # In my short investigation, the pattern which doesn't contain the parameter offers base64 encoded mp3 data, not URL.
But @timothydillan found that we can play TTS mp3 URL without the TKK
parameter like a following mp3 URL currently.
https://translate.google.com/translate_tts?ie=UTF-8&client=something&tl=en&q=Hello
https://github.com/horihiro/esp8266-google-tts/issues/10#issuecomment-723540589
@horihiro Wow, it's really cool that we can access the URL without a token key! Thank you for your investigation. It's really informative. I also notice that google translate is changing the website recently, and they are adding some new mechanism to prevent someone from abusing the APIs. Not very sure what will happen next, but we will see, haha.
Our systems have detected unusual traffic from your computer network. Please try your request again later.
Why did this happen?
IP address: xxx.xxx.xxx.xxx
Time: 2020-11-08T09:12:16Z
URL: https://translate.google.com/translate_tts?ie=UTF-8&client=something&tl=en&q=Hello
Please try client=tw-ob
in query parameters.
# This API also might be blocked :(
@horihiro thanks, even if I fair this is dangerous: https://stackoverflow.com/questions/32053442/google-translate-tts-api-blocked
This answer no longer works consistently. Your ip address will be blocked by google temporarily if you abuse this too much.
Hmm, In my environment, the following url can be downloaded. https://translate.google.com/translate_tts?ie=UTF-8&q=mi%20chiamo%20Giorgio&tl=it&client=tw-ob
The approach https://github.com/zlargon/google-tts/issues/33#issuecomment-723554295 by @horihiro has been implemented in PR https://github.com/zlargon/google-tts/pull/37 by @freddiefujiwara. It has been released in version 0.0.6.
Thank you all. 🎉
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).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):
Any idea?
Thanks giorgio