mirror of
https://github.com/shufflewzc/faker3.git
synced 2026-04-03 16:34:07 +08:00
update
This commit is contained in:
399
TS_USER_AGENTS.ts
Normal file
399
TS_USER_AGENTS.ts
Normal file
@@ -0,0 +1,399 @@
|
|||||||
|
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()
|
||||||
|
|
||||||
|
let fingerprint: string | number, token: string = '', enCryptMethodJD: any
|
||||||
|
|
||||||
|
const USER_AGENTS: Array<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 TotalBean(cookie: string) {
|
||||||
|
return {
|
||||||
|
cookie: cookie,
|
||||||
|
isLogin: true,
|
||||||
|
nickName: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getRandomNumberByRange(start: number, end: number) {
|
||||||
|
end <= start && (end = start + 100)
|
||||||
|
return Math.floor(Math.random() * (end - start) + start)
|
||||||
|
}
|
||||||
|
|
||||||
|
let USER_AGENT = USER_AGENTS[getRandomNumberByRange(0, USER_AGENTS.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 requireConfig(check: boolean = false): Promise<string[]> {
|
||||||
|
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) {
|
||||||
|
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(timeout: number) {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
setTimeout(resolve, timeout)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async function requestAlgo(appId: number = 10032) {
|
||||||
|
fingerprint = generateFp()
|
||||||
|
return new Promise<void>(async resolve => {
|
||||||
|
let {data}: any = await axios.post('https://cactus.jd.com/request_algo?g_ty=ajax', {
|
||||||
|
"version": "1.0",
|
||||||
|
"fp": fingerprint,
|
||||||
|
"appId": appId,
|
||||||
|
"timestamp": Date.now(),
|
||||||
|
"platform": "web",
|
||||||
|
"expandParams": ""
|
||||||
|
}, {
|
||||||
|
"headers": {
|
||||||
|
'Authority': 'cactus.jd.com',
|
||||||
|
'Pragma': 'no-cache',
|
||||||
|
'Cache-Control': 'no-cache',
|
||||||
|
'Accept': 'application/json',
|
||||||
|
'User-Agent': USER_AGENT,
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Origin': 'https://st.jingxi.com',
|
||||||
|
'Sec-Fetch-Site': 'cross-site',
|
||||||
|
'Sec-Fetch-Mode': 'cors',
|
||||||
|
'Sec-Fetch-Dest': 'empty',
|
||||||
|
'Referer': 'https://st.jingxi.com/',
|
||||||
|
'Accept-Language': 'zh-CN,zh;q=0.9,zh-TW;q=0.8,en;q=0.7'
|
||||||
|
},
|
||||||
|
})
|
||||||
|
if (data['status'] === 200) {
|
||||||
|
token = data.data.result.tk
|
||||||
|
let enCryptMethodJDString = data.data.result.algo
|
||||||
|
if (enCryptMethodJDString) enCryptMethodJD = new Function(`return ${enCryptMethodJDString}`)()
|
||||||
|
} else {
|
||||||
|
console.log(`fp: ${fingerprint}`)
|
||||||
|
console.log('request_algo 签名参数API请求失败:')
|
||||||
|
}
|
||||||
|
resolve()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function generateFp() {
|
||||||
|
let e = "0123456789"
|
||||||
|
let a = 13
|
||||||
|
let i = ''
|
||||||
|
for (; a--;)
|
||||||
|
i += e[Math.random() * e.length | 0]
|
||||||
|
return (i + Date.now()).slice(0, 16)
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
function obj2str(obj: object) {
|
||||||
|
return JSON.stringify(obj)
|
||||||
|
}
|
||||||
|
|
||||||
|
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 {
|
||||||
|
TotalBean,
|
||||||
|
getBeanShareCode,
|
||||||
|
getFarmShareCode,
|
||||||
|
requireConfig,
|
||||||
|
wait,
|
||||||
|
getRandomNumberByRange,
|
||||||
|
requestAlgo,
|
||||||
|
getJxToken,
|
||||||
|
exceptCookie,
|
||||||
|
randomString,
|
||||||
|
o2s,
|
||||||
|
randomNumString,
|
||||||
|
getshareCodeHW,
|
||||||
|
getShareCodePool,
|
||||||
|
randomWord,
|
||||||
|
obj2str,
|
||||||
|
jdpingou,
|
||||||
|
get,
|
||||||
|
post
|
||||||
|
}
|
||||||
87
jd_joy_joy_reward.ts
Normal file
87
jd_joy_joy_reward.ts
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
/**
|
||||||
|
汪汪乐园-提现
|
||||||
|
5 0 0 * * 5 jd_joy_joy_reward.ts
|
||||||
|
new Env('汪汪赛跑提现')
|
||||||
|
Modify By Dylan from HW
|
||||||
|
**/
|
||||||
|
|
||||||
|
import {get, post, requireConfig, wait} from './TS_USER_AGENTS'
|
||||||
|
import {H5ST} from "./function/h5st"
|
||||||
|
|
||||||
|
let cookie: string = '', res: any = '', UserName: string = '', fp_448de: string = '' || process.env.FP_448DE, fp_b6ac3: string = '' || process.env.FP_B6AC3
|
||||||
|
let h5stTool: H5ST = null
|
||||||
|
|
||||||
|
!(async () => {
|
||||||
|
let cookiesArr: string[] = await requireConfig()
|
||||||
|
for (let [index, value] of cookiesArr.entries()) {
|
||||||
|
cookie = value
|
||||||
|
UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
|
||||||
|
console.log(`\n开始【京东账号${index + 1}】${UserName}\n`)
|
||||||
|
let rewardAmount: number = 0
|
||||||
|
try {
|
||||||
|
h5stTool = new H5ST('448de', 'jdltapp;', fp_448de)
|
||||||
|
await h5stTool.__genAlgo()
|
||||||
|
res = await team('runningMyPrize', {"linkId": "L-sOanK_5RJCz7I314FpnQ", "pageSize": 20, "time": null, "ids": null})
|
||||||
|
rewardAmount = res.data.rewardAmount
|
||||||
|
if (res.data.runningCashStatus.currentEndTime && res.data.runningCashStatus.status === 0) {
|
||||||
|
console.log('可提现', rewardAmount)
|
||||||
|
res = await api('runningPrizeDraw', {"linkId": "L-sOanK_5RJCz7I314FpnQ", "type": 2})
|
||||||
|
await wait(2000)
|
||||||
|
if (res.success){
|
||||||
|
console.log(res.data.message)
|
||||||
|
} else {
|
||||||
|
console.log('提现失败:', res.errMsg)
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
console.log('还未到提现时间')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log('Error', e)
|
||||||
|
await wait(1000)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})()
|
||||||
|
|
||||||
|
async function api(fn: string, body: object) {
|
||||||
|
let timestamp: number = Date.now(), h5st: string = ''
|
||||||
|
if (fn === 'runningOpenBox') {
|
||||||
|
h5st = h5stTool.__genH5st({
|
||||||
|
appid: "activities_platform",
|
||||||
|
body: JSON.stringify(body),
|
||||||
|
client: "ios",
|
||||||
|
clientVersion: "3.1.0",
|
||||||
|
functionId: "runningOpenBox",
|
||||||
|
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 post('https://api.m.jd.com/', params, {
|
||||||
|
'authority': 'api.m.jd.com',
|
||||||
|
'content-type': 'application/x-www-form-urlencoded',
|
||||||
|
'cookie': cookie,
|
||||||
|
'origin': 'https://h5platform.jd.com',
|
||||||
|
'referer': 'https://h5platform.jd.com/',
|
||||||
|
'user-agent': 'jdltapp;'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async function team(fn: string, body: object) {
|
||||||
|
let timestamp: number = Date.now(), h5st: string
|
||||||
|
h5st = h5stTool.__genH5st({
|
||||||
|
appid: "activities_platform",
|
||||||
|
body: JSON.stringify(body),
|
||||||
|
client: "ios",
|
||||||
|
clientVersion: "3.1.0",
|
||||||
|
functionId: fn,
|
||||||
|
t: timestamp.toString()
|
||||||
|
})
|
||||||
|
return await 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': cookie
|
||||||
|
})
|
||||||
|
}
|
||||||
229
jd_joy_joy_run.ts
Normal file
229
jd_joy_joy_run.ts
Normal file
@@ -0,0 +1,229 @@
|
|||||||
|
/**
|
||||||
|
汪汪乐园-跑步+组队
|
||||||
|
默认翻倍到0.04红包结束,修改请设置变量
|
||||||
|
export JD_JOY_PARK_RUN_ASSETS="0.08"
|
||||||
|
32 * * * * jd_joy_joy_run.ts
|
||||||
|
new Env('极速版汪汪赛跑')
|
||||||
|
Modify By Dylan from HW
|
||||||
|
**/
|
||||||
|
|
||||||
|
import {get, post, o2s, requireConfig, wait} from './TS_USER_AGENTS'
|
||||||
|
import {H5ST} from "./function/h5st"
|
||||||
|
import {existsSync, readFileSync} from "fs";
|
||||||
|
import {getDate} from "date-fns";
|
||||||
|
|
||||||
|
let cookie: string = '', res: any = '', UserName: string = '', fp_448de: string = '' || process.env.FP_448DE, fp_b6ac3: string = '' || process.env.FP_B6AC3
|
||||||
|
let assets: number = 0, captainId: string = '', h5stTool: H5ST = null
|
||||||
|
|
||||||
|
!(async () => {
|
||||||
|
let cookiesArr: string[] = await requireConfig()
|
||||||
|
let account: { pt_pin: string, joy_park_run: number }[] = []
|
||||||
|
console.log('每周日18点组队分红!!')
|
||||||
|
for (let [index, value] of cookiesArr.entries()) {
|
||||||
|
cookie = value
|
||||||
|
UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
|
||||||
|
console.log(`\n开始【京东账号${index + 1}】${UserName}\n`)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
assets = parseFloat(process.env.JD_JOY_PARK_RUN_ASSETS || '0.04')
|
||||||
|
let rewardAmount: number = 0
|
||||||
|
try {
|
||||||
|
h5stTool = new H5ST('448de', 'jdltapp;', fp_448de)
|
||||||
|
await h5stTool.__genAlgo()
|
||||||
|
res = await team('runningMyPrize', {"linkId": "L-sOanK_5RJCz7I314FpnQ", "pageSize": 20, "time": null, "ids": null})
|
||||||
|
let sum: number = 0, success: number = 0
|
||||||
|
for (let t of res?.data?.detailVos || []) {
|
||||||
|
if (t.amount > 0 && getDate(new Date(t.createTime)) === new Date().getDate()) {
|
||||||
|
sum = add(sum, t.amount)
|
||||||
|
success++
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log('今日成功', success, '次')
|
||||||
|
console.log('今日收益', sum.toFixed(2), '元')
|
||||||
|
|
||||||
|
res = await team('runningTeamInfo', {"linkId": "L-sOanK_5RJCz7I314FpnQ"})
|
||||||
|
if (!captainId) {
|
||||||
|
if (res.data.members.length === 0) {
|
||||||
|
console.log('成为队长')
|
||||||
|
captainId = res.data.captainId
|
||||||
|
} else if (res.data.members.length !== 6) {
|
||||||
|
console.log('队伍未满', res.data.members.length, '人')
|
||||||
|
console.log('战队收益', res.data.teamSumPrize, '元')
|
||||||
|
captainId = res.data.captainId
|
||||||
|
} else {
|
||||||
|
console.log('队伍已满', res.data.members.length, '人')
|
||||||
|
console.log('战队收益', res.data.teamSumPrize, '元')
|
||||||
|
}
|
||||||
|
} else if (captainId && res.data.members.length === 0) {
|
||||||
|
console.log('已有组队ID,未加入队伍')
|
||||||
|
res = await team('runningJoinTeam', {"linkId": "L-sOanK_5RJCz7I314FpnQ", "captainId": 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('队伍已满')
|
||||||
|
captainId = ''
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
o2s(res, '组队失败')
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log('已组队', res.data.members.length, '人')
|
||||||
|
console.log('战队收益', res.data.teamSumPrize, '元')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
h5stTool = new H5ST('b6ac3', 'jdltapp;', fp_b6ac3)
|
||||||
|
await h5stTool.__genAlgo()
|
||||||
|
res = await runningPageHome()
|
||||||
|
console.log('🧧总金额', res.data.runningHomeInfo.prizeValue, '元')
|
||||||
|
|
||||||
|
let energy: number = res.data.runningHomeInfo.energy
|
||||||
|
console.log('💊 X', res.data.runningHomeInfo.energy, '个能量棒')
|
||||||
|
await wait(2000)
|
||||||
|
if (res.data.runningHomeInfo.nextRunningTime){
|
||||||
|
console.log('⏳体力恢复中,还有', secondsToMinutes(res.data.runningHomeInfo.nextRunningTime / 1000))
|
||||||
|
if (res.data.runningHomeInfo.nextRunningTime / 1000 < 300) {
|
||||||
|
await wait(res.data.runningHomeInfo.nextRunningTime)
|
||||||
|
res = await runningPageHome()
|
||||||
|
console.log('体力恢复完成,开始跑步....')
|
||||||
|
await wait(1000)
|
||||||
|
} else {
|
||||||
|
console.log('⏳等体力恢复在跑吧!');
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log('体力已恢复,开始跑步....')
|
||||||
|
}
|
||||||
|
|
||||||
|
await startRunning(res, assets)
|
||||||
|
for (let i = 0; i < energy; i++) {
|
||||||
|
console.log('💉消耗能量棒跑步....')
|
||||||
|
res = await api('runningUseEnergyBar', {"linkId": "L-sOanK_5RJCz7I314FpnQ"})
|
||||||
|
//console.log(res.errMsg)
|
||||||
|
res = await runningPageHome()
|
||||||
|
await startRunning(res, assets)
|
||||||
|
await wait(1000)
|
||||||
|
}
|
||||||
|
res = await runningPageHome()
|
||||||
|
console.log('🧧总金额', res.data.runningHomeInfo.prizeValue, '元')
|
||||||
|
await wait(2000)
|
||||||
|
} catch (e) {
|
||||||
|
console.log('Error', e)
|
||||||
|
await wait(3000)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})()
|
||||||
|
|
||||||
|
async function startRunning(res: any, assets: number) {
|
||||||
|
if (!res.data.runningHomeInfo.nextRunningTime) {
|
||||||
|
console.log('终点目标', assets)
|
||||||
|
for (let i = 0; i < 5; i++) {
|
||||||
|
res = await api('runningOpenBox', {"linkId": "L-sOanK_5RJCz7I314FpnQ"})
|
||||||
|
if (parseFloat(res.data.assets) >= assets) {
|
||||||
|
let assets: number = parseFloat(res.data.assets)
|
||||||
|
res = await api('runningPreserveAssets', {"linkId": "L-sOanK_5RJCz7I314FpnQ"})
|
||||||
|
console.log('领取成功', assets)
|
||||||
|
break
|
||||||
|
} else {
|
||||||
|
if (res.data.doubleSuccess) {
|
||||||
|
console.log('翻倍成功', parseFloat(res.data.assets))
|
||||||
|
await wait(10000)
|
||||||
|
} else if (!res.data.doubleSuccess && !res.data.runningHomeInfo.runningFinish) {
|
||||||
|
console.log('开始跑步', parseFloat(res.data.assets))
|
||||||
|
await wait(10000)
|
||||||
|
} else {
|
||||||
|
console.log('翻倍失败')
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await wait(3000)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function api(fn: string, body: object) {
|
||||||
|
let timestamp: number = Date.now(), h5st: string = ''
|
||||||
|
if (fn === 'runningOpenBox') {
|
||||||
|
h5st = h5stTool.__genH5st({
|
||||||
|
appid: "activities_platform",
|
||||||
|
body: JSON.stringify(body),
|
||||||
|
client: "ios",
|
||||||
|
clientVersion: "3.1.0",
|
||||||
|
functionId: "runningOpenBox",
|
||||||
|
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 post('https://api.m.jd.com/', params, {
|
||||||
|
'authority': 'api.m.jd.com',
|
||||||
|
'content-type': 'application/x-www-form-urlencoded',
|
||||||
|
'cookie': cookie,
|
||||||
|
'origin': 'https://h5platform.jd.com',
|
||||||
|
'referer': 'https://h5platform.jd.com/',
|
||||||
|
'user-agent': 'jdltapp;'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async function runningPageHome() {
|
||||||
|
return 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': cookie
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async function team(fn: string, body: object) {
|
||||||
|
let timestamp: number = Date.now(), h5st: string
|
||||||
|
h5st = h5stTool.__genH5st({
|
||||||
|
appid: "activities_platform",
|
||||||
|
body: JSON.stringify(body),
|
||||||
|
client: "ios",
|
||||||
|
clientVersion: "3.1.0",
|
||||||
|
functionId: fn,
|
||||||
|
t: timestamp.toString()
|
||||||
|
})
|
||||||
|
return await 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': cookie
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 秒转时分秒
|
||||||
|
function secondsToMinutes(seconds: number) {
|
||||||
|
let minutes: number = Math.floor(seconds / 60)
|
||||||
|
let second: number = Math.floor(seconds % 60)
|
||||||
|
return `${minutes}分${second}秒`
|
||||||
|
}
|
||||||
|
|
||||||
|
// 小数加法
|
||||||
|
function 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
|
||||||
|
}
|
||||||
40
jd_zjd.ts
40
jd_zjd.ts
@@ -1,16 +1,18 @@
|
|||||||
/**
|
/**
|
||||||
* v0.2
|
* const $ = new Env('赚喜豆-TS版');
|
||||||
* cron: 15,30,45 0 * * *
|
* cron: 15,30,45 0 * * *
|
||||||
* CK1 优先助力HW.ts
|
* 修改自HW大佬,默认开团前7,需要请自行修改
|
||||||
|
* 修改自HW大佬,纯内部助力,定时请自行修改,频繁跑火爆黑IP
|
||||||
|
* 修改自HW大佬,建议使用原作者版本,衰仔,明白了吗?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import {zjdInit, zjdH5st} from "./utils/jd_zjd_tool.js";
|
import {zjdInit, zjdH5st} from "./function/zjdtool.js";
|
||||||
import {o2s, wait, requireConfig, getshareCodeHW} from "./TS_USER_AGENTS";
|
import {o2s, wait, requireConfig} from "./function/TS_USER_AGENTS";
|
||||||
import {SHA256} from "crypto-js";
|
import {SHA256} from "crypto-js";
|
||||||
|
|
||||||
let cookie: string = '', res: any = '', UserName: string
|
let cookie: string = '', res: any = '', UserName: string
|
||||||
let shareCodeSelf: Tuan[] = [], shareCode: Tuan[] = [], shareCodeHW: any = []
|
let shareCodeSelf: Tuan[] = [], shareCode: Tuan[] = []
|
||||||
|
|
||||||
interface Tuan {
|
interface Tuan {
|
||||||
activityIdEncrypted: string, // id
|
activityIdEncrypted: string, // id
|
||||||
@@ -19,11 +21,13 @@ interface Tuan {
|
|||||||
}
|
}
|
||||||
|
|
||||||
!(async () => {
|
!(async () => {
|
||||||
let cookiesArr: string[] = await requireConfig()
|
let cookiesArr: string[] = await requireConfig(false)
|
||||||
for (let [index, value] of cookiesArr.entries()) {
|
for (let [index, value] of cookiesArr.entries()) {
|
||||||
try {
|
if(index < 7){
|
||||||
|
try {
|
||||||
await zjdInit()
|
await zjdInit()
|
||||||
cookie = value
|
cookie = value
|
||||||
|
|
||||||
UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
|
UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
|
||||||
console.log(`\n开始【京东账号${index + 1}】${UserName}\n`)
|
console.log(`\n开始【京东账号${index + 1}】${UserName}\n`)
|
||||||
|
|
||||||
@@ -73,33 +77,26 @@ interface Tuan {
|
|||||||
} else if (!res.data.canStartNewAssist) {
|
} else if (!res.data.canStartNewAssist) {
|
||||||
console.log('不可开团')
|
console.log('不可开团')
|
||||||
}
|
}
|
||||||
|
await wait(1000)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
await wait(1000)
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
o2s(shareCodeSelf)
|
console.log('内部助力:', shareCodeSelf)
|
||||||
await wait(2000)
|
|
||||||
|
|
||||||
for (let [index, value] of cookiesArr.entries()) {
|
for (let [index, value] of cookiesArr.entries()) {
|
||||||
if (shareCodeHW.length === 0) {
|
try {
|
||||||
shareCodeHW = await getshareCodeHW('zjd');
|
cookie = value
|
||||||
}
|
|
||||||
shareCode = index === 0
|
|
||||||
? Array.from(new Set([...shareCodeHW, ...shareCodeSelf]))
|
|
||||||
: Array.from(new Set([...shareCodeSelf, ...shareCodeHW]))
|
|
||||||
|
|
||||||
cookie = value
|
|
||||||
UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
|
UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
|
||||||
console.log(`\n开始【京东账号${index + 1}】${UserName}\n`)
|
console.log(`\n开始【京东账号${index + 1}】${UserName}\n`)
|
||||||
|
shareCode = Array.from(new Set([...shareCodeSelf]))
|
||||||
|
|
||||||
await zjdInit()
|
await zjdInit()
|
||||||
for (let code of shareCode) {
|
for (let code of shareCode) {
|
||||||
try {
|
try {
|
||||||
console.log(`账号${index + 1} ${UserName} 去助力 ${code.assistedPinEncrypted.replace('\n', '')}`)
|
console.log(`账号${index + 1} ${UserName} 去助力 ${code.assistedPinEncrypted.replace('\n', '')}`)
|
||||||
res = await api('vvipclub_distributeBean_assist', {"activityIdEncrypted": code.activityIdEncrypted, "assistStartRecordId": code.assistStartRecordId, "assistedPinEncrypted": code.assistedPinEncrypted, "channel": "FISSION_BEAN", "launchChannel": "undefined"})
|
res = await api('vvipclub_distributeBean_assist', {"activityIdEncrypted": code.activityIdEncrypted, "assistStartRecordId": code.assistStartRecordId, "assistedPinEncrypted": code.assistedPinEncrypted, "channel": "FISSION_BEAN", "launchChannel": "undefined"})
|
||||||
|
|
||||||
if (res.resultCode === '9200008') {
|
if (res.resultCode === '9200008') {
|
||||||
console.log('不能助力自己')
|
console.log('不能助力自己')
|
||||||
} else if (res.resultCode === '2400203' || res.resultCode === '90000014') {
|
} else if (res.resultCode === '2400203' || res.resultCode === '90000014') {
|
||||||
@@ -121,6 +118,9 @@ interface Tuan {
|
|||||||
await wait(2000)
|
await wait(2000)
|
||||||
}
|
}
|
||||||
await wait(2000)
|
await wait(2000)
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})()
|
})()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user