mirror of
https://github.com/shufflewzc/faker3.git
synced 2026-04-04 00:44:07 +08:00
sync
This commit is contained in:
21
TS_JDHelloWorld.d.ts
vendored
21
TS_JDHelloWorld.d.ts
vendored
@@ -1,21 +0,0 @@
|
||||
interface User {
|
||||
i: number;
|
||||
UserName: string;
|
||||
cookie: string;
|
||||
UserAgent: string;
|
||||
}
|
||||
declare class JDHelloWorld {
|
||||
scriptName: string;
|
||||
constructor(scriptName?: string);
|
||||
getCookie(check?: boolean): Promise<string[]>;
|
||||
checkCookie(cookie: string): Promise<boolean>;
|
||||
exceptCookie(filename?: string): any;
|
||||
get(url: string, headers?: any): Promise<unknown>;
|
||||
post(url: string, data: any, headers?: any): Promise<object>;
|
||||
wait(ms?: number): Promise<unknown>;
|
||||
o2s(obj: object, title?: string): void;
|
||||
run(son: {
|
||||
main: Function;
|
||||
}): Promise<void>;
|
||||
}
|
||||
export { User, JDHelloWorld };
|
||||
File diff suppressed because one or more lines are too long
@@ -1,341 +0,0 @@
|
||||
import axios from "axios"
|
||||
import {Md5} from "ts-md5"
|
||||
import * as dotenv from "dotenv"
|
||||
import {existsSync, readFileSync} from "fs"
|
||||
import {sendNotify} from './sendNotify'
|
||||
|
||||
dotenv.config()
|
||||
const USER_AGENTS_ARR: string[] = [
|
||||
"jdapp;android;10.0.2;10;network/wifi;Mozilla/5.0 (Linux; Android 10; ONEPLUS A5010 Build/QKQ1.191014.012; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36",
|
||||
"jdapp;iPhone;10.0.2;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
|
||||
"jdapp;android;10.0.2;9;network/4g;Mozilla/5.0 (Linux; Android 9; Mi Note 3 Build/PKQ1.181007.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/045131 Mobile Safari/537.36",
|
||||
"jdapp;android;10.0.2;10;network/wifi;Mozilla/5.0 (Linux; Android 10; GM1910 Build/QKQ1.190716.003; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36",
|
||||
"jdapp;android;10.0.2;9;network/wifi;Mozilla/5.0 (Linux; Android 9; 16T Build/PKQ1.190616.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36",
|
||||
"jdapp;iPhone;10.0.2;13.6;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 13_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
|
||||
"jdapp;iPhone;10.0.2;13.6;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 13_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
|
||||
"jdapp;iPhone;10.0.2;13.5;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 13_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
|
||||
"jdapp;iPhone;10.0.2;14.1;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 14_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
|
||||
"jdapp;iPhone;10.0.2;13.3;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
|
||||
"jdapp;iPhone;10.0.2;13.7;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
|
||||
"jdapp;iPhone;10.0.2;14.1;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 14_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
|
||||
"jdapp;iPhone;10.0.2;13.3;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
|
||||
"jdapp;iPhone;10.0.2;13.4;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 13_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
|
||||
"jdapp;iPhone;10.0.2;14.3;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
|
||||
"jdapp;android;10.0.2;9;network/wifi;Mozilla/5.0 (Linux; Android 9; MI 6 Build/PKQ1.190118.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36",
|
||||
"jdapp;android;10.0.2;11;network/wifi;Mozilla/5.0 (Linux; Android 11; Redmi K30 5G Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045511 Mobile Safari/537.36",
|
||||
"jdapp;iPhone;10.0.2;11.4;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 11_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15F79",
|
||||
"jdapp;android;10.0.2;10;;network/wifi;Mozilla/5.0 (Linux; Android 10; M2006J10C Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36",
|
||||
"jdapp;android;10.0.2;10;network/wifi;Mozilla/5.0 (Linux; Android 10; M2006J10C Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36",
|
||||
"jdapp;android;10.0.2;10;network/wifi;Mozilla/5.0 (Linux; Android 10; ONEPLUS A6000 Build/QKQ1.190716.003; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045224 Mobile Safari/537.36",
|
||||
"jdapp;android;10.0.2;9;network/wifi;Mozilla/5.0 (Linux; Android 9; MHA-AL00 Build/HUAWEIMHA-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36",
|
||||
"jdapp;android;10.0.2;8.1.0;network/wifi;Mozilla/5.0 (Linux; Android 8.1.0; 16 X Build/OPM1.171019.026; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36",
|
||||
"jdapp;android;10.0.2;8.0.0;network/wifi;Mozilla/5.0 (Linux; Android 8.0.0; HTC U-3w Build/OPR6.170623.013; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36",
|
||||
"jdapp;iPhone;10.0.2;14.0.1;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 14_0_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
|
||||
"jdapp;android;10.0.2;10;network/wifi;Mozilla/5.0 (Linux; Android 10; LYA-AL00 Build/HUAWEILYA-AL00L; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36",
|
||||
"jdapp;iPhone;10.0.2;14.2;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
|
||||
"jdapp;iPhone;10.0.2;14.3;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
|
||||
"jdapp;iPhone;10.0.2;14.2;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
|
||||
"jdapp;android;10.0.2;8.1.0;network/wifi;Mozilla/5.0 (Linux; Android 8.1.0; MI 8 Build/OPM1.171019.026; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/045131 Mobile Safari/537.36",
|
||||
"jdapp;android;10.0.2;10;network/wifi;Mozilla/5.0 (Linux; Android 10; Redmi K20 Pro Premium Edition Build/QKQ1.190825.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045227 Mobile Safari/537.36",
|
||||
"jdapp;iPhone;10.0.2;14.3;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
|
||||
"jdapp;iPhone;10.0.2;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
|
||||
"jdapp;android;10.0.2;11;network/wifi;Mozilla/5.0 (Linux; Android 11; Redmi K20 Pro Premium Edition Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045513 Mobile Safari/537.36",
|
||||
"jdapp;android;10.0.2;10;network/wifi;Mozilla/5.0 (Linux; Android 10; MI 8 Build/QKQ1.190828.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045227 Mobile Safari/537.36",
|
||||
"jdapp;iPhone;10.0.2;14.1;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 14_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
|
||||
]
|
||||
|
||||
function getRandomNumberByRange(start: number, end: number) {
|
||||
end <= start && (end = start + 100)
|
||||
return Math.floor(Math.random() * (end - start) + start)
|
||||
}
|
||||
|
||||
let USER_AGENT = USER_AGENTS_ARR[getRandomNumberByRange(0, USER_AGENTS_ARR.length)]
|
||||
|
||||
async function getBeanShareCode(cookie: string) {
|
||||
let {data}: any = await axios.post('https://api.m.jd.com/client.action',
|
||||
`functionId=plantBeanIndex&body=${encodeURIComponent(
|
||||
JSON.stringify({version: "9.0.0.1", "monitor_source": "plant_app_plant_index", "monitor_refer": ""})
|
||||
)}&appid=ld&client=apple&area=5_274_49707_49973&build=167283&clientVersion=9.1.0`, {
|
||||
headers: {
|
||||
Cookie: cookie,
|
||||
Host: "api.m.jd.com",
|
||||
Accept: "*/*",
|
||||
Connection: "keep-alive",
|
||||
"User-Agent": USER_AGENT
|
||||
}
|
||||
})
|
||||
if (data.data?.jwordShareInfo?.shareUrl)
|
||||
return data.data.jwordShareInfo.shareUrl.split('Uuid=')![1]
|
||||
else
|
||||
return ''
|
||||
}
|
||||
|
||||
async function getFarmShareCode(cookie: string) {
|
||||
let {data}: any = await axios.post('https://api.m.jd.com/client.action?functionId=initForFarm', `body=${encodeURIComponent(JSON.stringify({"version": 4}))}&appid=wh5&clientVersion=9.1.0`, {
|
||||
headers: {
|
||||
"cookie": cookie,
|
||||
"origin": "https://home.m.jd.com",
|
||||
"referer": "https://home.m.jd.com/myJd/newhome.action",
|
||||
"User-Agent": USER_AGENT,
|
||||
"Content-Type": "application/x-www-form-urlencoded"
|
||||
}
|
||||
})
|
||||
|
||||
if (data.farmUserPro)
|
||||
return data.farmUserPro.shareCode
|
||||
else
|
||||
return ''
|
||||
}
|
||||
|
||||
async function getCookie(check: boolean = false): Promise<string[]> {
|
||||
let pwd: string = __dirname
|
||||
let cookiesArr: string[] = []
|
||||
const jdCookieNode = require('./jdCookie.js')
|
||||
let keys: string[] = Object.keys(jdCookieNode)
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
let cookie = jdCookieNode[keys[i]]
|
||||
if (!check) {
|
||||
if (pwd.includes('/ql') && !pwd.includes('JDHelloWorld')) {
|
||||
} else {
|
||||
cookiesArr.push(cookie)
|
||||
}
|
||||
} else {
|
||||
if (await checkCookie(cookie)) {
|
||||
cookiesArr.push(cookie)
|
||||
} else {
|
||||
let username = decodeURIComponent(jdCookieNode[keys[i]].match(/pt_pin=([^;]*)/)![1])
|
||||
console.log('Cookie失效', username)
|
||||
await sendNotify('Cookie失效', '【京东账号】' + username)
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(`共${cookiesArr.length}个京东账号\n`)
|
||||
return cookiesArr
|
||||
}
|
||||
|
||||
async function checkCookie(cookie: string) {
|
||||
await wait(3000)
|
||||
try {
|
||||
let {data}: any = await axios.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`, {
|
||||
headers: {
|
||||
'authority': 'api.m.jd.com',
|
||||
'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1',
|
||||
'referer': 'https://home.m.jd.com/',
|
||||
'cookie': cookie
|
||||
}
|
||||
})
|
||||
data = JSON.parse(data.match(/GetJDUserInfoUnion\((.*)\)/)[1])
|
||||
return data.retcode === '0';
|
||||
} catch (e) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
function wait(ms: number) {
|
||||
return new Promise(resolve => {
|
||||
setTimeout(resolve, ms)
|
||||
})
|
||||
}
|
||||
|
||||
function getJxToken(cookie: string, phoneId: string = '') {
|
||||
function generateStr(input: number) {
|
||||
let src = 'abcdefghijklmnopqrstuvwxyz1234567890'
|
||||
let res = ''
|
||||
for (let i = 0; i < input; i++) {
|
||||
res += src[Math.floor(src.length * Math.random())]
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
if (!phoneId)
|
||||
phoneId = generateStr(40)
|
||||
let timestamp = Date.now().toString()
|
||||
let nickname = cookie.match(/pt_pin=([^;]*)/)![1]
|
||||
let jstoken = Md5.hashStr('' + decodeURIComponent(nickname) + timestamp + phoneId + 'tPOamqCuk9NLgVPAljUyIHcPRmKlVxDy')
|
||||
return {
|
||||
'strPgtimestamp': timestamp,
|
||||
'strPhoneID': phoneId,
|
||||
'strPgUUNum': jstoken
|
||||
}
|
||||
}
|
||||
|
||||
function exceptCookie(filename: string = 'x.ts') {
|
||||
let except: any = []
|
||||
if (existsSync('./utils/exceptCookie.json')) {
|
||||
try {
|
||||
except = JSON.parse(readFileSync('./utils/exceptCookie.json').toString() || '{}')[filename] || []
|
||||
} catch (e) {
|
||||
console.log('./utils/exceptCookie.json JSON格式错误')
|
||||
}
|
||||
}
|
||||
return except
|
||||
}
|
||||
|
||||
function randomString(e: number, word?: number) {
|
||||
e = e || 32
|
||||
let t = word === 26 ? "012345678abcdefghijklmnopqrstuvwxyz" : "0123456789abcdef", a = t.length, n = ""
|
||||
for (let i = 0; i < e; i++)
|
||||
n += t.charAt(Math.floor(Math.random() * a))
|
||||
return n
|
||||
}
|
||||
|
||||
function o2s(arr: object, title: string = '') {
|
||||
title ? console.log(title, JSON.stringify(arr)) : console.log(JSON.stringify(arr))
|
||||
}
|
||||
|
||||
function randomNumString(e: number) {
|
||||
e = e || 32
|
||||
let t = '0123456789', a = t.length, n = ""
|
||||
for (let i = 0; i < e; i++)
|
||||
n += t.charAt(Math.floor(Math.random() * a))
|
||||
return n
|
||||
}
|
||||
|
||||
function randomWord(n: number = 1) {
|
||||
let t = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', a = t.length
|
||||
let rnd: string = ''
|
||||
for (let i = 0; i < n; i++) {
|
||||
rnd += t.charAt(Math.floor(Math.random() * a))
|
||||
}
|
||||
return rnd
|
||||
}
|
||||
|
||||
async function getshareCodeHW(key: string) {
|
||||
let shareCodeHW: string[] = []
|
||||
for (let i = 0; i < 5; i++) {
|
||||
try {
|
||||
let {data}: any = await axios.get('https://api.jdsharecode.xyz/api/HW_CODES')
|
||||
shareCodeHW = data[key] || []
|
||||
if (shareCodeHW.length !== 0) {
|
||||
break
|
||||
}
|
||||
} catch (e) {
|
||||
console.log("getshareCodeHW Error, Retry...")
|
||||
await wait(getRandomNumberByRange(2000, 6000))
|
||||
}
|
||||
}
|
||||
return shareCodeHW
|
||||
}
|
||||
|
||||
async function getShareCodePool(key: string, num: number) {
|
||||
let shareCode: string[] = []
|
||||
for (let i = 0; i < 2; i++) {
|
||||
try {
|
||||
let {data}: any = await axios.get(`https://api.jdsharecode.xyz/api/${key}/${num}`)
|
||||
shareCode = data.data || []
|
||||
console.log(`随机获取${num}个${key}成功:${JSON.stringify(shareCode)}`)
|
||||
if (shareCode.length !== 0) {
|
||||
break
|
||||
}
|
||||
} catch (e) {
|
||||
console.log("getShareCodePool Error, Retry...")
|
||||
await wait(getRandomNumberByRange(2000, 6000))
|
||||
}
|
||||
}
|
||||
return shareCode
|
||||
}
|
||||
|
||||
/*
|
||||
async function wechat_app_msg(title: string, content: string, user: string) {
|
||||
let corpid: string = "", corpsecret: string = ""
|
||||
let {data: gettoken} = await axios.get(`https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=${corpid}&corpsecret=${corpsecret}`)
|
||||
let access_token: string = gettoken.access_token
|
||||
|
||||
let {data: send} = await axios.post(`https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=${access_token}`, {
|
||||
"touser": user,
|
||||
"msgtype": "text",
|
||||
"agentid": 1000002,
|
||||
"text": {
|
||||
"content": `${title}\n\n${content}`
|
||||
},
|
||||
"safe": 0
|
||||
})
|
||||
if (send.errcode === 0) {
|
||||
console.log('企业微信应用消息发送成功')
|
||||
} else {
|
||||
console.log('企业微信应用消息发送失败', send)
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
async function getDevice() {
|
||||
let {data} = await axios.get('https://betahub.cn/api/apple/devices/iPhone', {
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36'
|
||||
}
|
||||
})
|
||||
data = data[getRandomNumberByRange(0, 16)]
|
||||
return data.identifier
|
||||
}
|
||||
|
||||
async function getVersion(device: string) {
|
||||
let {data} = await axios.get(`https://betahub.cn/api/apple/firmwares/${device}`, {
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36'
|
||||
}
|
||||
})
|
||||
data = data[getRandomNumberByRange(0, data.length)]
|
||||
return data.firmware_info.version
|
||||
}
|
||||
|
||||
async function jdpingou() {
|
||||
let device: string, version: string;
|
||||
device = await getDevice();
|
||||
version = await getVersion(device);
|
||||
return `jdpingou;iPhone;5.19.0;${version};${randomString(40)};network/wifi;model/${device};appBuild/100833;ADID/;supportApplePay/1;hasUPPay/0;pushNoticeIsOpen/0;hasOCPay/0;supportBestPay/0;session/${getRandomNumberByRange(10, 90)};pap/JA2019_3111789;brand/apple;supportJDSHWK/1;Mozilla/5.0 (iPhone; CPU iPhone OS 14_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148`
|
||||
}
|
||||
|
||||
function get(url: string, headers?: any): Promise<any> {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(url, {
|
||||
headers: headers
|
||||
}).then(res => {
|
||||
if (typeof res.data === 'string' && res.data.includes('jsonpCBK')) {
|
||||
resolve(JSON.parse(res.data.match(/jsonpCBK.?\(([\w\W]*)\);?/)[1]))
|
||||
} else {
|
||||
resolve(res.data)
|
||||
}
|
||||
}).catch(err => {
|
||||
reject({
|
||||
code: err?.response?.status || -1,
|
||||
msg: err?.response?.statusText || err.message || 'error'
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function post(url: string, prarms?: string | object, headers?: any): Promise<any> {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.post(url, prarms, {
|
||||
headers: headers
|
||||
}).then(res => {
|
||||
resolve(res.data)
|
||||
}).catch(err => {
|
||||
reject({
|
||||
code: err?.response?.status || -1,
|
||||
msg: err?.response?.statusText || err.message || 'error'
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export default USER_AGENT
|
||||
export {
|
||||
getBeanShareCode,
|
||||
getFarmShareCode,
|
||||
getCookie,
|
||||
wait,
|
||||
getRandomNumberByRange,
|
||||
getJxToken,
|
||||
exceptCookie,
|
||||
randomString,
|
||||
o2s,
|
||||
randomNumString,
|
||||
getshareCodeHW,
|
||||
getShareCodePool,
|
||||
randomWord,
|
||||
jdpingou,
|
||||
get,
|
||||
post,
|
||||
USER_AGENTS_ARR
|
||||
}
|
||||
77
jd_cash.ts
77
jd_cash.ts
@@ -1,77 +0,0 @@
|
||||
/**
|
||||
* 京东-领现金
|
||||
* 兼容panda api和本地sign
|
||||
*
|
||||
* 使用panda sign
|
||||
* export PANDA_TOKEN=""
|
||||
* 本地sign算法 import {getSign} from './test/sign'
|
||||
*/
|
||||
|
||||
import {User, JDHelloWorld} from "./TS_JDHelloWorld";
|
||||
import {getSign} from "./test/sign";
|
||||
|
||||
class CASH extends JDHelloWorld {
|
||||
cookie: string
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
async init() {
|
||||
await this.run(new CASH())
|
||||
}
|
||||
|
||||
async api(fn: string, body: object) {
|
||||
let sign = getSign(fn, body)
|
||||
return await this.post(`https://api.m.jd.com/client.action?functionId=${fn}`, sign, {
|
||||
'Host': 'api.m.jd.com',
|
||||
'Cookie': this.cookie,
|
||||
'user-agent': 'jdapp;',
|
||||
})
|
||||
}
|
||||
|
||||
async main(user: User) {
|
||||
this.cookie = user.cookie
|
||||
let res: any = await this.api('cash_homePage', {})
|
||||
if (res.data.result.signedStatus !== 1) {
|
||||
console.log('今日未签到')
|
||||
await this.api('cash_sign', {"remind": 0, "inviteCode": "", "type": 0, "breakReward": 0})
|
||||
await this.wait(1000)
|
||||
console.log('签到成功')
|
||||
} else {
|
||||
console.log('今日已签到')
|
||||
}
|
||||
|
||||
res = await this.api('cash_homePage', {})
|
||||
let type: number[] = [2, 4, 31, 16, 3, 5, 17, 21], data: any
|
||||
let otherTaskNum = res.data.result.taskInfos.filter(item => !type.includes(item.type)).length
|
||||
let taskNum = res.data.result.taskInfos.filter(item => type.includes(item.type)).length
|
||||
console.log(taskNum, otherTaskNum)
|
||||
|
||||
for (let i = 0; i < 10; i++) {
|
||||
res = await this.api('cash_homePage', {})
|
||||
if (res.data.result.taskInfos.filter(item => type.includes(item.type) && item.doTimes === item.times).length === taskNum) {
|
||||
console.log('任务全部完成')
|
||||
break
|
||||
}
|
||||
|
||||
for (let t of res?.data?.result?.taskInfos || []) {
|
||||
if (t.doTimes < t.times && t.type !== 7) {
|
||||
console.log(t.name)
|
||||
data = await this.api('cash_doTask', {"type": t.type, "taskInfo": t.desc})
|
||||
await this.wait(t.duration * 1000 || 1000)
|
||||
if (data.data.bizCode === 0) {
|
||||
console.log('任务完成', data.data.result.totalMoney ?? '')
|
||||
break
|
||||
} else {
|
||||
console.log('任务失败', JSON.stringify(data))
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
await this.wait(2000)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
new CASH().init().then().catch()
|
||||
@@ -1,12 +0,0 @@
|
||||
import {getCookie} from "./TS_USER_AGENTS"
|
||||
|
||||
let cookie: string = '', UserName: string
|
||||
|
||||
!(async () => {
|
||||
let cookiesArr: string[] = await getCookie(true)
|
||||
for (let [index, value] of cookiesArr.entries()) {
|
||||
cookie = value
|
||||
UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
|
||||
console.log(index + 1, UserName)
|
||||
}
|
||||
})()
|
||||
63
jd_health.ts
63
jd_health.ts
@@ -1,63 +0,0 @@
|
||||
import {User, JDHelloWorld} from "./TS_JDHelloWorld";
|
||||
|
||||
class TEST extends JDHelloWorld {
|
||||
user: User
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
async init() {
|
||||
await this.run(new TEST)
|
||||
}
|
||||
|
||||
async api(fn: string, body: object) {
|
||||
return await this.post('https://api.m.jd.com/', `functionId=${fn}&body=${encodeURIComponent(JSON.stringify(body))}&client=wh5&clientVersion=1.0.0&uuid=`, {
|
||||
'Host': 'api.m.jd.com',
|
||||
'Origin': 'https://h5.m.jd.com',
|
||||
'User-Agent': this.user.UserAgent,
|
||||
'Referer': 'https://h5.m.jd.com/',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': this.user.cookie
|
||||
})
|
||||
}
|
||||
|
||||
async main(user: User) {
|
||||
this.user = user
|
||||
let res: any = await this.api('jdhealth_getTaskDetail', {"buildingId": "", "taskId": "", "channelId": 1})
|
||||
try {
|
||||
for (let t of res.data.result.taskVos) {
|
||||
if (t.status === 1 || t.status === 3) {
|
||||
console.log(t.taskName)
|
||||
for (let tp of t.productInfoVos || t.followShopVo || t.shoppingActivityVos || []) {
|
||||
if (tp.status === 1) {
|
||||
console.log('\t', tp.skuName || tp.shopName || tp.title)
|
||||
if (t.taskName.includes('早睡打卡') && t.taskBeginTime < Date.now() && t.taskEndTime > Date.now()) {
|
||||
res = await this.api('jdhealth_collectScore', {"taskToken": tp.taskToken, "taskId": t.taskId, "actionType": 1})
|
||||
await this.wait(2000)
|
||||
console.log('\t', res.data.bizMsg)
|
||||
}
|
||||
if (t.waitDuration) {
|
||||
res = await this.api('jdhealth_collectScore', {"taskToken": tp.taskToken, "taskId": t.taskId, "actionType": 1})
|
||||
console.log('\t', res.data.bizMsg)
|
||||
await this.wait(t.waitDuration * 1000)
|
||||
}
|
||||
res = await this.api('jdhealth_collectScore', {"taskToken": tp.taskToken, "taskId": t.taskId, "actionType": 0})
|
||||
if (res.data.bizMsg.includes('做完')) {
|
||||
console.log(res.data.bizMsg)
|
||||
break
|
||||
} else {
|
||||
console.log(res.data.bizMsg, parseInt(res.data.result.score))
|
||||
await this.wait(1500)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('Error', e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
new TEST().init().then()
|
||||
@@ -1,41 +0,0 @@
|
||||
import {User, JDHelloWorld} from "./TS_JDHelloWorld";
|
||||
|
||||
class Joy_Park extends JDHelloWorld {
|
||||
user: User
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
async init() {
|
||||
await this.run(new Joy_Park())
|
||||
}
|
||||
|
||||
async api(fn: string, body: Object): Promise<object> {
|
||||
return await this.post('https://api.m.jd.com/', `functionId=${fn}&body=${JSON.stringify(body)}&_t=${Date.now()}&appid=activities_platform`, {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'User-Agent': this.user.UserAgent,
|
||||
'Host': 'api.m.jd.com',
|
||||
'Referer': 'https://joypark.jd.com/',
|
||||
'Origin': 'https://joypark.jd.com',
|
||||
'Cookie': this.user.cookie
|
||||
});
|
||||
}
|
||||
|
||||
async main(user: User) {
|
||||
this.user = user;
|
||||
let res: any = await this.api('apTaskList', {"linkId": "L-sOanK_5RJCz7I314FpnQ"});
|
||||
let t: any = res.data[2]
|
||||
for (let i = t.taskDoTimes; i < t.taskLimitTimes; i++) {
|
||||
let res: any = await this.api('apTaskTimeRecord', {"linkId": "L-sOanK_5RJCz7I314FpnQ", "taskId": t.id})
|
||||
console.log(res.success)
|
||||
await this.wait(31000)
|
||||
let url: any = "https://pro.m.jd.com/jdlite/active/3qRAXpNehcsUpToARD9ekP4g6Jhi/index.html?babelChannel=ttt6"
|
||||
await this.api('apDoTask', {"channel": "4", "checkVersion": true, "itemId": encodeURIComponent(url), "linkId": "L-sOanK_5RJCz7I314FpnQ", "taskId": t.id, "taskType": t.taskType})
|
||||
console.log(res.success)
|
||||
await this.wait(1000)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
new Joy_Park().init().then()
|
||||
@@ -1,221 +0,0 @@
|
||||
/**
|
||||
* 汪汪乐园-跑步+组队
|
||||
* cron: 20 * * * *
|
||||
* export FP_448DE="" // url: runningMyPrize => h5st.split(';')[1]
|
||||
* export FP_B6AC3="" // url: runningOpenBox => h5st.split(';')[1]
|
||||
*/
|
||||
|
||||
import {H5ST} from "./utils/h5st"
|
||||
import {getDate} from "date-fns";
|
||||
import {JDHelloWorld, User} from "./TS_JDHelloWorld";
|
||||
|
||||
class Joy_Park_Run extends JDHelloWorld {
|
||||
teamTool: H5ST
|
||||
apiTool: H5ST
|
||||
user: User
|
||||
captainId: string | number
|
||||
|
||||
constructor() {
|
||||
super()
|
||||
}
|
||||
|
||||
async init() {
|
||||
await this.run(new Joy_Park_Run())
|
||||
}
|
||||
|
||||
// 秒转时分秒
|
||||
secondsToMinutes(seconds: number) {
|
||||
let minutes: number = Math.floor(seconds / 60)
|
||||
let second: number = Math.floor(seconds % 60)
|
||||
return `${minutes}分${second}秒`
|
||||
}
|
||||
|
||||
// 小数加法
|
||||
add(num1: number, num2: number) {
|
||||
let r1: number, r2: number
|
||||
try {
|
||||
r1 = num1.toString().split('.')[1].length
|
||||
} catch (e) {
|
||||
r1 = 0
|
||||
}
|
||||
try {
|
||||
r2 = num2.toString().split('.')[1].length
|
||||
} catch (e) {
|
||||
r2 = 0
|
||||
}
|
||||
let m: number = Math.pow(10, Math.max(r1, r2))
|
||||
return (num1 * m + num2 * m) / m
|
||||
}
|
||||
|
||||
async team(fn: string, body: object) {
|
||||
let timestamp: number = Date.now(), h5st: string
|
||||
h5st = this.teamTool.__genH5st({
|
||||
appid: "activities_platform",
|
||||
body: JSON.stringify(body),
|
||||
client: "ios",
|
||||
clientVersion: "3.1.0",
|
||||
functionId: fn,
|
||||
t: timestamp.toString()
|
||||
})
|
||||
return await this.get(`https://api.m.jd.com/?functionId=${fn}&body=${encodeURIComponent(JSON.stringify(body))}&t=${timestamp}&appid=activities_platform&client=ios&clientVersion=3.1.0&cthr=1&h5st=${h5st}`, {
|
||||
'Host': 'api.m.jd.com',
|
||||
'User-Agent': 'jdltapp;',
|
||||
'Origin': 'https://h5platform.jd.com',
|
||||
'X-Requested-With': 'com.jd.jdlite',
|
||||
'Referer': 'https://h5platform.jd.com/',
|
||||
'Cookie': this.user.cookie
|
||||
})
|
||||
}
|
||||
|
||||
async api(fn: string, body: object) {
|
||||
let timestamp: number = Date.now(), h5st: string = ''
|
||||
if (fn === 'runningOpenBox') {
|
||||
h5st = this.apiTool.__genH5st({
|
||||
appid: "activities_platform",
|
||||
body: JSON.stringify(body),
|
||||
client: "ios",
|
||||
clientVersion: "3.1.0",
|
||||
functionId: fn,
|
||||
t: timestamp.toString()
|
||||
})
|
||||
}
|
||||
let params: string = `functionId=${fn}&body=${JSON.stringify(body)}&t=${timestamp}&appid=activities_platform&client=ios&clientVersion=3.1.0&cthr=1`
|
||||
h5st && (params += `&h5st=${h5st}`)
|
||||
return await this.post('https://api.m.jd.com/', params, {
|
||||
'authority': 'api.m.jd.com',
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'cookie': this.user.cookie,
|
||||
'origin': 'https://h5platform.jd.com',
|
||||
'referer': 'https://h5platform.jd.com/',
|
||||
'user-agent': 'jdltapp;iPhone;3.1.0;'
|
||||
})
|
||||
}
|
||||
|
||||
async runningPageHome() {
|
||||
return this.get(`https://api.m.jd.com/?functionId=runningPageHome&body=%7B%22linkId%22:%22L-sOanK_5RJCz7I314FpnQ%22,%22isFromJoyPark%22:true,%22joyLinkId%22:%22LsQNxL7iWDlXUs6cFl-AAg%22%7D&t=${Date.now()}&appid=activities_platform&client=ios&clientVersion=3.1.0`, {
|
||||
'Host': 'api.m.jd.com',
|
||||
'Origin': 'https://h5platform.jd.com',
|
||||
'User-Agent': 'jdltapp;',
|
||||
'Referer': 'https://h5platform.jd.com/',
|
||||
'Cookie': this.user.cookie
|
||||
})
|
||||
}
|
||||
|
||||
async main(user: User) {
|
||||
this.user = user
|
||||
let assets: number = parseFloat(process.env.JD_JOY_PARK_RUN_ASSETS || '0.08')
|
||||
let rewardAmount: number = 0
|
||||
try {
|
||||
this.teamTool = new H5ST('448de', 'jdltapp;', process.env.FP_448DE || '')
|
||||
await this.teamTool.__genAlgo()
|
||||
let res: any = await this.team('runningMyPrize', {"linkId": "L-sOanK_5RJCz7I314FpnQ", "pageSize": 20, "time": null, "ids": null})
|
||||
let sum: number = 0, success: number = 0
|
||||
rewardAmount = res.data.rewardAmount
|
||||
if (res.data.runningCashStatus.currentEndTime && res.data.runningCashStatus.status === 0) {
|
||||
console.log('可提现', rewardAmount)
|
||||
res = await this.api('runningPrizeDraw', {"linkId": "L-sOanK_5RJCz7I314FpnQ", "type": 2})
|
||||
await this.wait(2000)
|
||||
console.log(res.data.message)
|
||||
}
|
||||
|
||||
for (let t of res?.data?.detailVos || []) {
|
||||
if (getDate(new Date(t.createTime)) === new Date().getDate()) {
|
||||
sum = this.add(sum, t.amount)
|
||||
success++
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
console.log('成功', success)
|
||||
console.log('收益', parseFloat(sum.toFixed(2)))
|
||||
res = await this.team('runningTeamInfo', {"linkId": "L-sOanK_5RJCz7I314FpnQ"})
|
||||
if (!this.captainId) {
|
||||
if (res.data.members.length === 0) {
|
||||
console.log('成为队长')
|
||||
this.captainId = res.data.captainId
|
||||
} else if (res.data.members.length !== 6) {
|
||||
console.log('队伍未满', res.data.members.length)
|
||||
this.captainId = res.data.captainId
|
||||
} else {
|
||||
console.log('队伍已满')
|
||||
}
|
||||
} else if (this.captainId && res.data.members.length === 0) {
|
||||
console.log('已有组队ID,未加入队伍')
|
||||
res = await this.team('runningJoinTeam', {"linkId": "L-sOanK_5RJCz7I314FpnQ", "captainId": this.captainId})
|
||||
if (res.code === 0) {
|
||||
console.log('组队成功')
|
||||
for (let member of res.data.members) {
|
||||
if (member.captain) {
|
||||
console.log('队长', member.nickName)
|
||||
break
|
||||
}
|
||||
}
|
||||
if (res.data.members.length === 6) {
|
||||
console.log('队伍已满')
|
||||
this.captainId = ''
|
||||
}
|
||||
} else {
|
||||
this.o2s(res, '组队失败')
|
||||
}
|
||||
} else {
|
||||
console.log('已组队', res.data.members.length)
|
||||
console.log('战队收益', res.data.teamSumPrize)
|
||||
}
|
||||
|
||||
this.apiTool = new H5ST('b6ac3', 'jdltapp;', process.env.FP_B6AC3 || '')
|
||||
await this.apiTool.__genAlgo()
|
||||
res = await this.runningPageHome()
|
||||
console.log('🧧', res.data.runningHomeInfo.prizeValue)
|
||||
console.log('💊', res.data.runningHomeInfo.energy)
|
||||
await this.wait(2000)
|
||||
|
||||
console.log('⏳', this.secondsToMinutes(res.data.runningHomeInfo.nextRunningTime / 1000))
|
||||
if (res.data.runningHomeInfo.nextRunningTime && res.data.runningHomeInfo.nextRunningTime / 1000 < 300) {
|
||||
console.log('⏳')
|
||||
await this.wait(res.data.runningHomeInfo.nextRunningTime + 3000)
|
||||
res = await this.runningPageHome()
|
||||
await this.wait(1000)
|
||||
} else if (res.data.runningHomeInfo.nextRunningTime && res.data.runningHomeInfo.nextRunningTime / 1000 > 3000 && res.data.runningHomeInfo.energy !== 0) {
|
||||
console.log('💉')
|
||||
res = await this.api('runningUseEnergyBar', {"linkId": "L-sOanK_5RJCz7I314FpnQ"})
|
||||
console.log(res.errMsg)
|
||||
res = await this.runningPageHome()
|
||||
await this.wait(1000)
|
||||
}
|
||||
|
||||
if (!res.data.runningHomeInfo.nextRunningTime) {
|
||||
console.log('终点目标', assets)
|
||||
for (let i = 0; i < 10; i++) {
|
||||
res = await this.api('runningOpenBox', {"linkId": "L-sOanK_5RJCz7I314FpnQ"})
|
||||
if (parseFloat(res.data.assets) >= assets) {
|
||||
let assets: number = parseFloat(res.data.assets)
|
||||
res = await this.api('runningPreserveAssets', {"linkId": "L-sOanK_5RJCz7I314FpnQ"})
|
||||
console.log('领取成功', assets)
|
||||
break
|
||||
} else {
|
||||
if (res.data.doubleSuccess) {
|
||||
console.log('翻倍成功', parseFloat(res.data.assets))
|
||||
await this.wait(5000)
|
||||
} else if (!res.data.doubleSuccess && !res.data.runningHomeInfo.runningFinish) {
|
||||
console.log('开始跑步', parseFloat(res.data.assets))
|
||||
await this.wait(5000)
|
||||
} else {
|
||||
console.log('翻倍失败')
|
||||
break
|
||||
}
|
||||
}
|
||||
await this.wait(5000)
|
||||
}
|
||||
}
|
||||
|
||||
res = await this.runningPageHome()
|
||||
console.log('🧧', res.data.runningHomeInfo.prizeValue)
|
||||
await this.wait(2000)
|
||||
} catch (e) {
|
||||
console.log('Error', e)
|
||||
await this.wait(3000)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
new Joy_Park_Run().init().then()
|
||||
@@ -1,54 +0,0 @@
|
||||
import {JDHelloWorld, User} from "./TS_JDHelloWorld";
|
||||
|
||||
class Jd_queryRedpacket extends JDHelloWorld {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
async init() {
|
||||
await this.run(new Jd_queryRedpacket())
|
||||
}
|
||||
|
||||
async main(user: User) {
|
||||
let res: any = await this.get(`https://m.jingxi.com/user/info/QueryUserRedEnvelopesV2?type=1&orgFlag=JD_PinGou_New&page=1&cashRedType=1&redBalanceFlag=1&channel=1&_=${Date.now()}&sceneval=2&g_login_type=1&g_ty=ls`, {
|
||||
'Host': 'm.jingxi.com',
|
||||
'Referer': 'https://st.jingxi.com/my/redpacket.shtml',
|
||||
"Cookie": user.cookie,
|
||||
'User-Agent': user.UserAgent
|
||||
})
|
||||
let day: number = new Date().getDay(), jdRed: number = 0, jdRedExp: number = 0
|
||||
for (let j of res.data.useRedInfo?.redList || []) {
|
||||
if (j.orgLimitStr.includes('京喜')) {
|
||||
} else if (j.activityName.includes('极速版')) {
|
||||
} else if (j.orgLimitStr.includes('京东健康')) {
|
||||
} else {
|
||||
jdRed = add(jdRed, j.balance)
|
||||
if (new Date(j.endTime * 1000).getDay() === day)
|
||||
jdRedExp = add(jdRedExp, j.balance)
|
||||
}
|
||||
}
|
||||
console.log(jdRed, ' 今日过期:', jdRedExp)
|
||||
let msg = `【账号】 ${user.UserName}\n京东红包 ${jdRed}\n今日过期 ${jdRedExp}\n\n`
|
||||
return {
|
||||
msg: msg
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
new Jd_queryRedpacket().init().then().catch()
|
||||
|
||||
function add(arg1: number, arg2: number) {
|
||||
let r1, r2, m
|
||||
try {
|
||||
r1 = arg1.toString().split('.')[1].length
|
||||
} catch (e) {
|
||||
r1 = 0
|
||||
}
|
||||
try {
|
||||
r2 = arg2.toString().split('.')[1].length
|
||||
} catch (e) {
|
||||
r2 = 0
|
||||
}
|
||||
m = Math.pow(10, Math.max(r1, r2))
|
||||
return parseFloat(((arg1 * m + arg2 * m) / m).toFixed(2))
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
/**
|
||||
* 微信小程序签到红包
|
||||
* FP_9A38A
|
||||
* cron: 8 0 * * *
|
||||
*/
|
||||
|
||||
import {H5ST} from "./utils/h5st"
|
||||
import {User, JDHelloWorld} from "./TS_JDHelloWorld";
|
||||
|
||||
class Wechat_sign extends JDHelloWorld {
|
||||
constructor() {
|
||||
super("微信小程序签到红包");
|
||||
}
|
||||
|
||||
async init() {
|
||||
await this.run(new Wechat_sign())
|
||||
}
|
||||
|
||||
async main(user: User) {
|
||||
let h5stTool = new H5ST("9a38a", 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15F79 MicroMessenger/8.0.15(0x18000f2e) NetType/WIFI Language/zh_CN', process.env.FP_9A38A || "");
|
||||
await h5stTool.__genAlgo()
|
||||
let timestamp: number = Date.now()
|
||||
let h5st: string = h5stTool.__genH5st({
|
||||
appid: 'hot_channel',
|
||||
body: JSON.stringify({"activityId": "10002"}),
|
||||
client: 'android',
|
||||
clientVersion: '7.16.250',
|
||||
functionId: 'SignComponent_doSignTask',
|
||||
t: timestamp.toString(),
|
||||
})
|
||||
let res: any = await this.post(`https://api.m.jd.com/signTask/doSignTask?functionId=SignComponent_doSignTask&appid=hot_channel&body={"activityId":"10002"}&client=android&clientVersion=7.16.250&t=${timestamp}&h5st=${h5st}`, '', {
|
||||
'content-type': 'application/json',
|
||||
'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15F79 MicroMessenger/8.0.15(0x18000f2e) NetType/WIFI Language/zh_CN',
|
||||
'referer': 'https://servicewechat.com/wx91d27dbf599dff74/581/page-frame.html',
|
||||
'cookie': user.cookie
|
||||
})
|
||||
if (res.data) {
|
||||
console.log('已签到', res.data.signDays, '天,奖励', res.data.rewardValue, '元')
|
||||
return {msg: `【京东账号${user.i + 1}】 ${user.UserName}\n已签到 ${res.data.signDays}天\n奖励 ${res.data.rewardValue}元\n\n`}
|
||||
} else {
|
||||
console.log(res.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
new Wechat_sign().init().then()
|
||||
Reference in New Issue
Block a user