package google import ( "encoding/json" "errors" "fmt" "io" "net/http" "strings" ) func (t *Translator) TranslateV1(source, sourceLang, targetLang string) (string, error) { var text []string var result []interface{} encodedSource := encodeURI(source) uri := "https://translate.googleapis.com/translate_a/single?client=gtx&sl=" + sourceLang + "&tl=" + targetLang + "&dt=t&q=" + encodedSource r, err := http.Get(uri) if err != nil { return "err", errors.New("error getting translate.googleapis.com") } defer r.Body.Close() body, err := io.ReadAll(r.Body) if err != nil { return "err", errors.New("error reading response body") } bReq := strings.Contains(string(body), `