Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
google-baidu-translate-api
Advanced tools
免费 & 无限制的google & baidu 翻译 api
npm install google-baidu-translate-api
const translate = require('google-baidu-translate-api')
translate('我是谁', 'en').then(res => {
console.log(res.dist)
// who am I
console.log(res)
// {
// type: 'google',
// from: 'zh-CN',
// to: 'en',
// src: '我是谁',
// dist: 'who am I',
// targets: [ 'who am I', 'who I am', 'Who am I?' ]
// }
})
translate.google('我是谁', 'en').then(console.log)
translate.baidu('我是谁', 'en').then(console.log)
先尝试使用 google 翻译,如果失败再使用 baidu 翻译
参数如下:
translate(
word: string, // [必填] 要翻译的文字
to: string, // [必填] 要翻译成什么语言
from: string // 原本字符的语言,默认 auto 自动识别
): Promise<{
type: string, // 服务 google | baidu
from: string, // 原本字符的语言
to: string, // 翻译后的语言
src: string, // 原本被翻译的字符
dist: string, // 翻译后字符
targets: string[] // 翻译后字符的其他相似项
}>
使用 google 翻译,参数同 translate()
使用 baidu 翻译,参数同 translate()
baidu 支持的语言列表:http://api.fanyi.baidu.com/api/trans/product/apidoc#languageList google 支持的语言列表:https://cloud.google.com/translate/docs/languages
使用 http 请求获取 google 翻译 和 baidu 翻译页面,模拟页面翻译,google 翻译的host 默认为 translate.google.cn
,无需梯子
google-translate-api: https://github.com/matheuss/google-translate-api baidu-translate-api: https://github.com/TimLuo465/baidu-translate-api
本项目基于以上两个项目扩展,代码大部分来自于以上两个项目
FAQs
A free and unlimited API for Google & Baidu Translate
The npm package google-baidu-translate-api receives a total of 3 weekly downloads. As such, google-baidu-translate-api popularity was classified as not popular.
We found that google-baidu-translate-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.