Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ParamsApi = "https://cn.bing.com/translator" // 获取参数的API AudioApi = "https://cn.bing.com/tfettts" // 转语音API TranslateApi = "https://cn.bing.com/ttranslatev3" // 翻译API TranslateApiExt = "https://cn.bing.com/tlookupv3" // 翻译扩展API UserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36" ReqFormType = "application/x-www-form-urlencoded" // 定义从页面数据中获取IG参数值的正则 IgReg = regexp.MustCompile("IG:\"[0-9a-zA-Z]*?\"") RegM = regexp.MustCompile("\".*\"") // 定义从页面数据中获取token 和 key 参数值的正则 TkDataReg = regexp.MustCompile("(params_AbusePreventionHelper).*3600000];") TkReg = regexp.MustCompile(`\[.*\]`) )
Functions ¶
Types ¶
type Options ¶
type Options struct { // 请求API所需的参数 IG string Token string Key string IID string // 生成的语音配置项 VoiceName string // 文本转语音输出的语音角色 ProsodyPitch string // 指示文本的基线音节 ProsodyRate string // 指示文本的讲出速率 // 翻译 FromLang string ToLang string }
func (*Options) GetTextAudioData ¶
获取文本生成的音频数据
func (*Options) TextToAudio ¶
文本转语音
Click to show internal directories.
Click to hide internal directories.