-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathjd_checkCookie.ts
29 lines (25 loc) · 1.01 KB
/
jd_checkCookie.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import {User, JDHelloWorld} from './TS_JDHelloWorld'
class Check_cookie extends JDHelloWorld {
constructor() {
super("Cookie检测");
}
async init() {
await this.run(new Check_cookie())
}
async main(user: User) {
let data: any = await this.get(`https://api.m.jd.com/client.action?functionId=GetJDUserInfoUnion&appid=jd-cphdeveloper-m&body=${encodeURIComponent(JSON.stringify({"orgFlag": "JD_PinGou_New", "callSource": "mainorder", "channel": 4, "isHomewhite": 0, "sceneval": 2}))}&loginType=2&_=${Date.now()}&sceneval=2&g_login_type=1&callback=GetJDUserInfoUnion&g_ty=ls`, {
'authority': 'api.m.jd.com',
'user-agent': user.UserAgent,
'referer': 'https://home.m.jd.com/',
'cookie': user.cookie
})
data = JSON.parse(data.match(/GetJDUserInfoUnion\((.*)\)/)[1])
if (data.retcode === '0') {
console.log('✅')
} else {
console.log('❌')
return {msg: `Cookie无效 账号${user.index + 1} ${user.UserName}`}
}
}
}
new Check_cookie().init().then()