Skip to content

Commit

Permalink
fix: 修复秘钥获取出错的问题 issues #3
Browse files Browse the repository at this point in the history
  • Loading branch information
roojay520 committed Nov 5, 2020
1 parent ab2a7b9 commit a0cfd05
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/bob/util.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// eslint-disable-next-line max-len
export var userAgent = `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36`;

/* eslint-disable max-len */
export var userAgent = `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36`;
export var googleNid = `NID=204=jKqc7wKrG7-x9wg-nlvxczNd7zMMzWF6Ohx0hLu77vL4GAUwQ0xh-mX3xzY1DUyJZhkQ5HCLIKwW4jX39lt7fSREShR45jIJi9Kz52l_XCIl7zP1wGfnaMfy455Dy0YNO1RBrVS46ix4OxSynS5AXGjJnFvbtC8KDRmep5Qx9sw`;
export function error(
type: Bob.ServiceErrorType = 'unknown',
message = '插件出错',
Expand Down Expand Up @@ -57,4 +57,5 @@ export default {
getType,
asyncTo,
userAgent,
googleNid,
};
5 changes: 4 additions & 1 deletion src/google-token.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ async function updateTKK(opts) {
Bob.$http.get({
timeout,
url: `https://translate.google.${tld}`,
headers: { 'User-Agent': Bob.util.userAgent },
header: {
'User-Agent': Bob.util.userAgent,
Cookie: Bob.util.googleNid,
},
}),
);
if (err) throw Bob.util.error('network', '秘钥接口网络错误', err);
Expand Down

0 comments on commit a0cfd05

Please sign in to comment.