Giter Club home page Giter Club logo

Comments (3)

plainheart avatar plainheart commented on May 20, 2024 1

另外,刚才测试中出现 translate is not a function 错误。
改为 import { translate as trans_bing } from 'bing-translate-api'; 用 trans_bing 就没错了。遇到过这种问题吗?

暂时没有遇到,也许是其他地方声明了同名变量被覆盖了。

大量并发的情况还没有测试过,不过毕竟是 free to use, 还是建议控制请求频率。

from bing-translate-api.

plainheart avatar plainheart commented on May 20, 2024

Hi, 是否是临时的网络问题?我刚刚运行了测试用例,结果显示并无异常。

from bing-translate-api.

flyeven avatar flyeven commented on May 20, 2024

我也测了下,只运行测试代码正常。可能是并发大量翻译造成的。

使用 google translate api 也有类似问题。单个测试大概能过。大量请求基本都是 RequestError 。看来还要想办法注册key。

另外,刚才测试中出现 translate is not a function 错误。

改为 import { translate as trans_bing } from 'bing-translate-api'; 用 trans_bing 就没错了。遇到过这种问题吗?

下面是 google translation 的错误信息。

GotError [RequestError]: socket hang up
    at ClientRequest.<anonymous> (D:\Programming\nodescraping\node_modules\got\source\request-as-event-emitter.js:178:14)
    at Object.onceWrapper (events.js:422:26)
    at ClientRequest.emit (events.js:327:22)
    at ClientRequest.origin.emit (D:\Programming\nodescraping\node_modules\@szmarczak\http-timer\source\index.js:37:11)
    at TLSSocket.socketOnEnd (_http_client.js:493:9)
    at TLSSocket.emit (events.js:327:22)
    at endReadableNT (internal/streams/readable.js:1327:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  code: 'ECONNRESET',
  host: 'translate.google.com',
  hostname: 'translate.google.com',
  method: 'GET',
  path: '/',
  socketPath: undefined,
  protocol: 'https:',
  url: 'https://translate.google.com/',
  gotOptions: {
    path: '/',
    protocol: 'https:',
    slashes: true,
    auth: null,
    host: 'translate.google.com',
    port: null,
    hostname: 'translate.google.com',
    hash: null,
    search: null,
    query: null,
    pathname: '/',
    href: 'https://translate.google.com/',
    retry: {
      retries: [Function (anonymous)],
      methods: [Set],
      statusCodes: [Set],
      errorCodes: [Set]
    },
    headers: {
      'user-agent': 'got/9.6.0 (https://github.com/sindresorhus/got)',
      'accept-encoding': 'gzip, deflate'
    },
    hooks: {
      beforeRequest: [],
      beforeRedirect: [],
      beforeRetry: [],
      afterResponse: [],
      beforeError: [],
      init: []
    },
    decompress: true,
    throwHttpErrors: true,
    followRedirect: true,
    stream: false,
    form: false,
    json: false,
    cache: false,
    useElectronNet: false,
    agent: TunnelingAgent {
      options: [Object],
      proxyOptions: [Object],
      maxSockets: Infinity,
      requests: [],
      sockets: [Array],
      _events: [Object: null prototype],
      _eventsCount: 1,
      request: [Function: request],
      createSocket: [Function: createSecureSocket],
      defaultPort: 443
    },
    method: 'GET',
    forceRefresh: true
  }
}

from bing-translate-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.