google-translate-api icon indicating copy to clipboard operation
google-translate-api copied to clipboard

Autocorrect not properly applied to translations from certain networks

Open AidanWelch opened this issue 3 years ago • 6 comments

Certain networks require the X-Goog-BatchExecute-Bgr header to be sent on requests, or the autocorrect will not be applied to some translations(seemingly typos where a letter is dropped, such as "I spea Dutch!" instead of "I speak Dutch!").

The code for generating this header I believe is found in this static script.

I believe in xH.prototype.s()

This would likely take a while to fix.

AidanWelch avatar Oct 08 '22 14:10 AidanWelch

Certain networks require the X-Goog-BatchExecute-Bgr header to be sent on requests, or the autocorrect will not be applied to some translations(seemingly typos where a letter is dropped, such as "I spea Dutch!" instead of "I speak Dutch!").

The code for generating this header I believe is found in this static script.

I believe in xH.prototype.s()

This would likely take a while to fix.

Hello, can you generate this request header parameter value based on this static script?

RipperTs avatar Dec 26 '22 04:12 RipperTs

@RipperTs As far as I know, yes, but I'm not certain.

AidanWelch avatar Dec 26 '22 06:12 AidanWelch

no. that' s wrong.

xH.prototype.s=function(){var a=Swa([_.Ffa,_.Hfa,_.Ifa,_.Qr,_.Kfa,_.Rfa,_.Sfa,_.Tfa,_.Nk]); is just a feature id to request api endpoint map.

I debug and confirmed that. it has nothing to do with the header.

ttys3 avatar Mar 06 '23 05:03 ttys3

the real code is in the HTML page. and it is encrypted.

ttys3 avatar Mar 06 '23 05:03 ttys3

if you debug in dev tools, it may generate a wrong token like:

["FNL82,0,1,66,24095,60,24097",null,null,23879,987,null,null,0,"2"]

ttys3 avatar Mar 10 '23 12:03 ttys3

I don't have the time to look into this more, but if someone can figure it out I would happily merge the PR!

AidanWelch avatar May 22 '23 13:05 AidanWelch