mirror of
https://codeberg.org/aryak/mozhi
synced 2024-12-22 16:59:49 +05:30
gofmt
This commit is contained in:
parent
fa3612fbdf
commit
bfd34a06f8
@ -1,13 +1,13 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"github.com/gocolly/colly"
|
||||
"strings"
|
||||
"github.com/google/uuid"
|
||||
"github.com/google/go-querystring/query"
|
||||
"github.com/OwO-Network/gdeeplx"
|
||||
"os"
|
||||
"errors"
|
||||
"github.com/OwO-Network/gdeeplx"
|
||||
"github.com/gocolly/colly"
|
||||
"github.com/google/go-querystring/query"
|
||||
"github.com/google/uuid"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type LangOut struct {
|
||||
@ -171,7 +171,7 @@ func TranslateMyMemory(to string, from string, text string) (LangOut, error) {
|
||||
Translate string `url:"langpair"`
|
||||
Text string `url:"q"`
|
||||
}
|
||||
opt := Options{ from+"|"+to, text }
|
||||
opt := Options{from + "|" + to, text}
|
||||
v, _ := query.Values(opt)
|
||||
myMemoryOut := GetRequest("https://api.mymemory.translated.net/get?" + v.Encode())
|
||||
gjsonArr := myMemoryOut.Get("responseData.translatedText").Array()
|
||||
@ -205,12 +205,12 @@ func TranslateYandex(to string, from string, text string) (LangOut, error) {
|
||||
Srv string `url:"srv"`
|
||||
Id string `url:"sid"`
|
||||
}
|
||||
uuidWithHyphen := uuid.New()
|
||||
uuid := strings.Replace(uuidWithHyphen.String(), "-", "", -1)
|
||||
opt := Options{from + "-" + to, text, "android", uuid+"-0-0"}
|
||||
uuidWithHyphen := uuid.New()
|
||||
uuid := strings.Replace(uuidWithHyphen.String(), "-", "", -1)
|
||||
opt := Options{from + "-" + to, text, "android", uuid + "-0-0"}
|
||||
v, _ := query.Values(opt)
|
||||
|
||||
yandexOut := PostRequest("https://translate.yandex.net/api/v1/tr.json/translate?" + v.Encode(), []byte(""))
|
||||
yandexOut := PostRequest("https://translate.yandex.net/api/v1/tr.json/translate?"+v.Encode(), []byte(""))
|
||||
gjsonArr := yandexOut.Get("text.0").Array()
|
||||
var langout LangOut
|
||||
langout.OutputText = gjsonArr[0].String()
|
||||
@ -241,7 +241,7 @@ func TranslateDeepl(to string, from string, text string) (LangOut, error) {
|
||||
return LangOut{}, errors.New("failed")
|
||||
}
|
||||
answer1 := answer.(map[string]interface{})
|
||||
ans:= answer1["data"].(string)
|
||||
ans := answer1["data"].(string)
|
||||
var langout LangOut
|
||||
langout.OutputText = ans
|
||||
return langout, nil
|
||||
|
Loading…
Reference in New Issue
Block a user