google-tts-go is a golang implementation of the token validation of Google Translate.
package main
import (
"fmt"
"github.com/evalphobia/google-tts-go/googletts"
)
func main() {
url, err := googletts.GetTTSURL("Hello world.", "en")
if err != nil {
panic(err)
}
fmt.Println(url) // => https://translate.google.com/translate_tts?client=t&ie=UTF-8&q=Hello%2C+world.&textlen=13&tk=368668.249914&tl=en
tk, err := googletts.GetTTSToken("Hello world.")
if err != nil {
panic(err)
}
fmt.Println(tk) // => 368668.249914
}
The algorithm of this library is based on Boudewijn26/gTTS-token by Boudewijn26.