如何调用 Google 翻译 api?

如何调用 Google 翻译退出国内了,因为项目需求,想调用 Google 翻译 api,请问什么方法可以突破限制?

阅读 1.6k
1 个回答

让你的程序走代理就好了。一般两种方式:

  1. 设置全局的系统代理
  2. 指定你的程序走代理,用 axios rest调用为例,可以在创建http client的时候传入http proxy
const HttpsProxyAgent = require("https-proxy-agent"),
const axios = require("axios");
const httpsAgent = new HttpsProxyAgent({host: "proxyhost", port: "proxyport", auth: "username:password"})
axios = axios.create({httpsAgent});
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进