Skip to content

Commit

Permalink
fix bing and sogou
Browse files Browse the repository at this point in the history
  • Loading branch information
xwjdsh committed Oct 15, 2019
1 parent 83ac7ed commit 77b24f6
Show file tree
Hide file tree
Showing 4 changed files with 207 additions and 193 deletions.
4 changes: 2 additions & 2 deletions bing.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type bingTranslator struct{}
var bing translator = new(bingTranslator)

func (b *bingTranslator) desc() (string, string) {
return "bing", "https://www.bing.com/translator/"
return "bing", "https://cn.bing.com/translator"
}

func BingTranslate(ctx context.Context, req Request) *Response {
Expand All @@ -31,7 +31,7 @@ func (b *bingTranslator) translate(ctx context.Context, req Request) (resp *Resp
"text": {req.Text},
}

urlStr := "https://www.bing.com/ttranslatev3"
urlStr := "https://cn.bing.com/ttranslatev3"
body := strings.NewReader(param.Encode())
_, data, err := sendRequest(ctx, "POST", urlStr, body, func(req *http.Request) error {
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ require (
golang.org/x/sys v0.0.0-20190321052220-f7bb7a8bee54 // indirect
gopkg.in/sourcemap.v1 v1.0.5 // indirect
)

go 1.13
Loading

0 comments on commit 77b24f6

Please sign in to comment.