2025-05-28 19:16:17 +08:00

25 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

注意百度翻译接口又做了加密还需要解密参考这篇https://blog.csdn.net/m0_72134256/article/details/126437674
## 语种识别
> 语种识别 APIPOST https://fanyi.baidu.com/langdetect
该接口的调用不需要Cookies、token等无访问频次或字数限制。发送翻译内容返回检测到的语种列表如下
| 代码 | 语言 |
|:--:|:--:|
| zh | 中文 |
| en | 英语 |
| jp | 日语 |
| kor | 韩语 |
| th | 泰语 |
| vie | 越南语 |
| ru | 俄语 |
## 翻译
> 翻译 APIPOST https://fanyi.baidu.com/v2transapi
该接口的调用查询需要在 headers 中提供 Cookies 和 token在 form-data 中提供翻译内容的校验码 sign。cookies 和token 通过调用模拟浏览器获取sign 可通过将翻译内容发送给 gen.js根据算法计算得出。
百度翻译网页说明翻译的字数限制为 5000 字,实测英文翻译限制为 3000 字符。在输入文本长度超过了 3000 字符时,只会翻译前 3000 个字符。
多次调用翻译接口时,如果不设置延时,经测试大约会在调用 20-50 次的时候无数据返回。设定延时2-3秒限制消失。