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

TTS (Ctrl+Shift+2) link needs to be updated

Open ryanerwin opened this issue 5 years ago • 4 comments

to-google-translate seems to be using an older, no longer accessible version of a call to the Google Translate TTS engine.

When using Right Click > to Google Translate > Listen...

Or the keyboard shortcut CTRL + ALT + 2...

I keep on getting the following popup, and when I inspect the details, it seems Firefox is getting a 404 on the TTS audio file...

image

Example of current link with 404:

https://translate.google.com/translate_tts?ie=UTF-8&total=1&idx=0&client=tw-ob&tl=en-US&q=sshpass%3A%20An%20Excellent%20Tool%20for%20Non-Interactive%20SSH%20Login%20%E2%80%93%20Never%20Use%20on%20Production%20Server&textlen=89

image

I believe the old link was basically:

http://translate.google.com/translate_tts?tl=en&q=Hello+world

And the new link is basically:

https://translate.google.com/translate_tts?ie=UTF-8&tl=en-US&client=tw-ob&q=Hello+world

ryanerwin avatar May 18 '20 07:05 ryanerwin

Hello @ryanerwin ,

But if you copy and paste the 404 URL directly in the browser you have a 200 response.

image

Looks like Google is blocking the requests if don't come from his domain. I need to investigate this.

Thanks for reporting.

itsecurityco avatar May 18 '20 08:05 itsecurityco

Interestingly enough, in my case, only the new link works to get a 200... Even pasting the old link into a new window, I'm getting a 403 (forbidden)

old link is top window, new link is bottom window...

image

inspector showing 403 on old link

image

ryanerwin avatar May 18 '20 09:05 ryanerwin

I see, but the extension don't use the old link, the actual URI generated to use the TTS option is

https://translate.google.com/translate_tts?ie=UTF-8&total=1&idx=0&client=tw-ob&tl=en-US&q=Hello+World

You can find it here:

https://github.com/itsecurityco/to-google-translate/blob/master/src/config.js#L31

itsecurityco avatar May 18 '20 09:05 itsecurityco

I see, but the extension don't use the old link, the actual URI generated to use the TTS option is

That's odd... Doesn't seem like it should be possible to ever get the old link to pop up, because as you pointed out, that link isn't even in the code...

Is the TTS function working for you?

Unfortunately, I still can't get it to work. Yet using ImTranslator (way too much bloat for me) the TTS option does work.

Any other suggestions on how to get to the bottom of this?

ryanerwin avatar May 19 '20 06:05 ryanerwin