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

Update qqApi.js #158

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions config/qqApi.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
SESSION_URL = "https://fanyi.qq.com/"
AUTH_URL = "https://fanyi.qq.com/api/aaa123"
TRANSLATE_URL =
"https://fanyi.qq.com/api/translate"
USER_AGENT =
Expand Down Expand Up @@ -48,17 +49,17 @@ if (!session) {
};

initSession = () => {
return Request.get(SESSION_URL, {
jar: session,
gzip: true,
return Request.post(AUTH_URL, {
json: true,
headers: {
Referer: SESSION_URL,
Origin: SESSION_URL,
"User-Agent": USER_AGENT
}
})
.then(body => {
qtv = /var qtv = "([^\"]+)";/.exec(body)[1]
qtk = /var qtk = "([^\"]+)";/.exec(body)[1]
qtv = body.qtv
qtk = body.qtk
})
.then(requestTranslation)
};
Expand Down