Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

近期google-translate-api更新一次 #110

Open
sufeiweb opened this issue Apr 20, 2020 · 3 comments
Open

近期google-translate-api更新一次 #110

sufeiweb opened this issue Apr 20, 2020 · 3 comments

Comments

@sufeiweb
Copy link

client:t=>webapp

返回值 body[0] 存在为空的情况,导致翻译会报错

需要修改为body[0] => body[0] && body[0].forEach

由于主人断更了,可以移步 https://github.com/sufeiweb/google-translate-free
稍后会发布到npm上,方便大家直接使用

@mashirozx
Copy link

google translate 403了。。

{ HTTPError: Response code 403 (Forbidden)
Url: https://translate.google.com/translate_a/single?client=t&sl=auto&tl=ja&hl=ja&dt=at&dt=bd&dt=ex&dt=ld&dt=md&dt=qca&dt=rw&dt=rm&dt=ss&dt=t&ie=UTF-8&oe=UTF-8&otf=1&ssel=0&tsel=0&kc=7&q=hello&tk=29979.29979
at EventEmitter.emitter.on (/root/tmp/google-translate-server/node_modules/google-translate-free/node_modules/got/source/as-promise.js:74:19)
at process.tickCallback (internal/process/next_tick.js:68:7)
name: 'HTTPError',
host: 'translate.google.com',
hostname: 'translate.google.com',
method: 'GET',
path:
'/translate_a/single?client=t&sl=auto&tl=ja&hl=ja&dt=at&dt=bd&dt=ex&dt=ld&dt=md&dt=qca&dt=rw&dt=rm&dt=ss&dt=t&ie=UTF-8&oe=UTF-8&otf=1&ssel=0&tsel=0&kc=7&q=hello&tk=29979.29979',
socketPath: undefined,
protocol: 'https:',
url:
'https://translate.google.com/translate_a/single?client=t&sl=auto&tl=ja&hl=ja&dt=at&dt=bd&dt=ex&dt=ld&dt=md&dt=qca&dt=rw&dt=rm&dt=ss&dt=t&ie=UTF-8&oe=UTF-8&otf=1&ssel=0&tsel=0&kc=7&q=hello&tk=29979.29979',
gotOptions:
{ path:
'/translate_a/single?client=t&sl=auto&tl=ja&hl=ja&dt=at&dt=bd&dt=ex&dt=ld&dt=md&dt=qca&dt=rw&dt=rm&dt=ss&dt=t&ie=UTF-8&oe=UTF-8&otf=1&ssel=0&tsel=0&kc=7&q=hello&tk=29979.29979',
protocol: 'https:',
slashes: true,
auth: null,
host: 'translate.google.com',
port: null,
hostname: 'translate.google.com',
hash: null,
search:
'?client=t&sl=auto&tl=ja&hl=ja&dt=at&dt=bd&dt=ex&dt=ld&dt=md&dt=qca&dt=rw&dt=rm&dt=ss&dt=t&ie=UTF-8&oe=UTF-8&otf=1&ssel=0&tsel=0&kc=7&q=hello&tk=29979.29979',
pathname: '/translate_a/single',
href:
'https://translate.google.com/translate_a/single?client=t&sl=auto&tl=ja&hl=ja&dt=at&dt=bd&dt=ex&dt=ld&dt=md&dt=qca&dt=rw&dt=rm&dt=ss&dt=t&ie=UTF-8&oe=UTF-8&otf=1&ssel=0&tsel=0&kc=7&q=hello&tk=29979.29979',
retry:
{ retries: [Function],
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,
method: 'GET' },
statusCode: 403,
statusMessage: 'Forbidden',
headers:
{ 'content-type': 'text/html; charset=utf-8',
'cache-control': 'no-cache, no-store, max-age=0, must-revalidate',
pragma: 'no-cache',
expires: 'Mon, 01 Jan 1990 00:00:00 GMT',
date: 'Thu, 10 Dec 2020 02:57:07 GMT',
p3p:
'CP="This is not a P3P policy! See g.co/p3phelp for more info."',
'content-security-policy':
'script-src 'report-sample' 'nonce-2SS05MGfxTQswalInk95OQ' 'unsafe-inline';object-src 'none';base-uri 'self';report-uri /
/TranslateApiHttp/cspreport;worker-src 'self'',
'content-encoding': 'gzip',
server: 'ESF',
'x-xss-protection': '0',
'x-content-type-options': 'nosniff',
'set-cookie':
[ 'NID=204=LaG63GHQSaYQ9KaHIEIqnc55OMtfBld5ib62t4cAaO3JmG-JUqdm-ODSw1fJM2f1rBsPLkmI7V9EQXFIvbwb7lxbyySbLGiVh9Eq4bTMDGjJyWrTqrwYu5DAJ__6dINd19ySc_aNYGbJnMX1W42DrzhoXJtRw7BP9Kwr32YFGTE; expires=Fri, 11-Jun-2021 02:57:07 GMT; path=/; domain=.google.com; HttpOnly' ],
'alt-svc':
'h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"',
connection: 'close',
'transfer-encoding': 'chunked' },
body:
'<title>Error 403 (禁止)!!1</title><style nonce="2SS05MGfxTQswalInk95OQ">{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{color:#222;text-align:unset;margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px;} > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}pre{white-space:pre-wrap;}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}</style>

403. エラーが発生しました。

このページへのアクセス権限がありません。 その他の詳細は不明です。

',
code: 'BAD_REQUEST' }

@mashirozx
Copy link

加了UA也不行。。。

@dawangraoming
Copy link

same 403

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants