Skip to content

Commit 6fae1ff

Browse files
committed
Fix google translator
1 parent fb8a02f commit 6fae1ff

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

google.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,13 @@ func (g *googleTranslator) translate(ctx context.Context, req Request) (resp *Re
3838
resp.Err = fmt.Errorf("sendRequest error: %v", err)
3939
return
4040
}
41+
4142
resp.Result, resp.Err = g.getResult(string(data))
4243
return
4344
}
4445

4546
func (g *googleTranslator) getResult(dataStr string) (string, error) {
46-
result := regexp.MustCompile(`(?U),null,null,null,\[\[\\"(?P<result>\S+)\\",\[\\"`).FindStringSubmatch(dataStr)
47+
result := regexp.MustCompile(`(?U),\[\[\\"(?P<result>\S+)\\",\[\\"`).FindStringSubmatch(dataStr)
4748
if len(result) != 2 {
4849
return "", fmt.Errorf("cannot get result")
4950
}

0 commit comments

Comments
 (0)