google-translate-tts
google-translate-tts copied to clipboard
Rate limit?
soundoftext-api | GET /sounds/6854cf90-504b-11eb-966e-e52d1cd1ebcf 200 217.638 ms - 71
soundoftext-api | <TITLE>302 Moved</TITLE></HEAD><BODY><H1>302 Moved</H1>The document has moved<A HREF="https://www.google.com/sorry/index?continue=https://translate.google.com/_/TranslateWebserverUi/data/batchexecute&q=EgSlFpBxGL</BODY></HTML>S5BwrEFKQPEi4GstNTudFjUoAuIwMgFy">here</A>.
soundoftext-api | 2021-01-06T21:50:46.328Z - : Request could not be fulfilled: {
soundoftext-api | text: Nell'ottobre 2018 la Hasbro ha ufficialmente inserito il logo di: "Glitter Force" tra le varie serie che presenterà alla fiera degli addetti del settore, ovvero: "Mipcom",
soundoftext-api | id: 337054c0-5069-11eb-a3fd-2f0f9848c024
soundoftext-api | }
soundoftext-api | 2021-01-06T21:50:46.331Z - : message=Unexpected token < in JSON at position 0, stack=SyntaxError: Unexpected token < in JSON at position 0
I don't think the url got moved. I think Google is restricting the IP for soundoftext.com because of too much traffic.
This could probably be fixed by including the at
field of the POST body.
Just setup soundoftext.com on a new IP and requests started working again. Will probably have to emulate the original google-tts-api and make a request to google to get the access token before making the request to create audio.
Do you maintain any logs where it could be possible to see how many requests coming from which ip?
@berk76 I'm not really sure what you mean.
My guess is that Google Translate is rate-limiting the IP for soundoftext.com because I'm making too many requests. This is exactly what happened for the older google translate API when the access token wasn't included.
I'm guessing that if I included the at
field from this request, then I wouldn't be rate-limited:
Problem is that this field comes embedded in the HTML from translate.google.com, and it's different every request.
The original JS library used to do this: https://github.com/zlargon/google-tts/blob/0.0.5/lib/key.js#L24
It's also possible that some other parameter might solve the problem, as was found here on the old api: https://github.com/zlargon/google-tts/issues/33#issuecomment-723554295
how can change voice model
Okay, I think I'm wrong. I think att
is just an account token. That parameter is not included if you visit translate.google.com from an Incognito window.