Skip to content

ArtisanCloud/BaiduTrans

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BaiduTrans

官方文档:
https://api.fanyi.baidu.com/
https://api.fanyi.baidu.com/doc/21

通用翻译API HTTPS 地址:
https://fanyi-api.baidu.com/api/trans/vip/translate

go get -u github.com/ArtisanCloud/BaiduTrans
package main

import (
	"github.com/ArtisanCloud/BaiduTrans/config"
	"github.com/ArtisanCloud/BaiduTrans/trans/general"
	"github.com/ArtisanCloud/BaiduTrans/trans/general/request"
	"context"
	"github.com/ArtisanCloud/PowerLibs/v3/fmt"
)

func main() {

	conf := config.Get()

	var err error
	gApp, err := general.NewGeneralTrans(conf)
	if err != nil || gApp == nil {
		panic(err)
	}

	params := &request.RequestGeneralTrans{
		Query: "室内,暗淡,高品质,桌椅,大床",
		From:  "zh",
		To:    "en",
	}
	res, err := gApp.Translate(context.Background(), params)
	if err != nil || gApp == nil {
		panic(err)
	}
	if res.ErrCode != "" {
		panic(res)
	}

	fmt.Dump(res)

	return
}

更多产品:

PowerWechat: https://github.com/ArtisanCloud/PowerWeChat
PowerX: https://github.com/ArtisanCloud/PowerX

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages