Home > OS >  Extract Sound from translate.google.com
Extract Sound from translate.google.com

Time:09-23

Bunenas tardes señores!

For many years I extract sound from google.translate.com by Chrome DevTools and the Network tab. When click the sound button in the Network tab mp3 file appears. I just click on it and download for further educational purposes.

Now (literally today) there only XHR type files with countless character sequences inside square brackets as like as strings in JS arrays. And page itself is quite complicated.

How to extract sound in new circumstance?

  • Some how extract from XHR files.
  • May be some way to record in GNU/Linux sound system.
  • Or something else.

Thank you.

CodePudding user response:

How to extract sound from translate.google.com Base64 response.

  1. Visit google.translate.com, run Chrome DevTools by F12 key, enter the Network tab. Enter a text and press enter to make sound button appears. Click the sound button.
  2. Select a largest xhr request to batchexecute?rpcids... it would be several kB, these kind of xhr responses contains mp3 encoded in base64.
  3. At the Response tab of this request would be a long string in an array surrounded by square brackets and escaped double quotes "[\"//NExAAR...VV\"]", purge this string from brackets and quiotes to get something like //NExAAR...VV and save it ingo sound.base64 file.
  4. Then decode text from sound.base64 into a mp3 file by this command:
base64 -d sound.base64 > 1.mp3
  1. To listen mp3 from the terminal next command may be used:
mpg123 1.mp3

OR

Use https://soundoftext.com/ or test https://github.com/soimort/translate-shell#usage Audio Options.

UPD:

curl ... | grep -oP '\[\["wrb.fr","jQ1olc","\[\\"\K(?:[A-Za-z0-9 /]{4})*(?:[A-Za-z0-9 /]{2}==|[A-Za-z0-9 /]{3}=)?' | base64 -d > /tmp/123.mp3

thanks for code to @alukardd.

It is possible to make a right click on the request in the Chrome DevTools: Copy => copy as cURL.

thanks for information to @fjewo.

CodePudding user response:

A quick alternative - If you are on Mac OSx, you could also install SoundFlower and re-route the audio output to a DAW or just QuickTime player.

https://soundflower.en.softonic.com/mac

  • Related