This commit is contained in:
Faker 2022-08-29 11:27:07 +08:00
parent 092c743bde
commit 254cbd7d6e
12 changed files with 667 additions and 271 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

229
jd_joy_joy_run.ts Normal file
View File

@ -0,0 +1,229 @@
/**
-
0.01
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.01')
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
}

File diff suppressed because one or more lines are too long

24
jd_prodev.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,15 +1,16 @@
/*
* 2022-07-20 修复获取试用列表风控问题
* 2022-08-12 修复申请试用风控更换nolan接口
* By https://github.com/6dylan6/jdpro/
* 基于X1a0He版本修改
* @Address: https://github.com/X1a0He/jd_scripts_fixed/blob/main/jd_try_xh.js
* 如需运行请自行添加环境变量JD_TRY值填 true 即可运行
* 上一作者说了每天最多300个商店总上限为500个jd_unsubscribe.js我已更新为批量取关版
* 请提前取关至少250个商店确保京东试用脚本正常运行
如需运行请自行添加环境变量JD_TRY="true" 即可运行
脚本是否耗时只看args_xh.maxLength的大小申请数量默认50个申请100个差不多15分钟
上一作者说每天申请上限300个自测没有申请过上限关注店铺上限500个
关注店铺满了就无法继续申请可用批量取关店铺取消关注
部分环境变量说明详细请参考58行往下
export JD_TRY="true"是否允许默认false
export JD_TRY_PASSZC="false" #不过滤种草官类试用默认true过滤
export JD_TRY_MAXLENGTH="50" #商品数组的最大长度默认50个
export JD_TRY_PRICE="XX"#商品原价格大于XX才申请默认20
@ -18,13 +19,13 @@ export JD_TRY_APPLYNUMFILTER="10000" #过滤大于设定值的已申请人数
export JD_TRY_MINSUPPLYNUM="1" #最小提供数量
export JD_TRY_SENDNUM="10" #每隔多少账号发送一次通知默认为4
export JD_TRY_UNIFIED="false" 默认采用不同试用组
export JD_TRY_NUM="5" 最多跑多少个CK默认10
export JD_TRY_NUM="7" 最多跑多少个CK默认10
定时自定义能用多久随缘了
cron "1 1 1 1 1" jd_try.js
*/
const $ = new Env('京东试用')
const URL = 'https://api.m.jd.com/client.action'
let trialActivityIdList = []
let trialActivityTitleList = []
let notifyMsg = ''
@ -40,19 +41,18 @@ $.getNum = 0;
$.try = true;
$.sentNum = 0;
$.cookiesArr = []
//默认的过滤关键词
$.innerKeyWords =
[
"幼儿园", "教程", "英语", "辅导", "培训",
"孩子", "小学", "成人用品", "套套", "情趣",
"自慰", "阳具", "飞机杯", "男士用品", "女士用品",
"内衣", "高潮", "避孕", "乳腺", "肛塞", "肛门",
"宝宝", "芭比", "娃娃", "男用",
"宝宝", "玩具", "芭比", "娃娃", "男用",
"女用", "神油", "足力健", "老年", "老人",
"宠物", "饲料", "丝袜", "黑丝", "磨脚",
"脚皮", "除臭", "性感", "内裤", "跳蛋",
"安全套", "龟头", "阴道", "阴部", "手机卡", "电话卡", "流量卡",
"习题", "试卷",
"玉坠","和田玉","习题","试卷","手机壳","钢化膜"
]
//下面很重要,遇到问题请把下面注释看一遍再来问
let args_xh = {
@ -187,114 +187,113 @@ let args_xh = {
!(async () => {
await $.wait(500)
// 如果你要运行京东试用这个脚本,麻烦你把环境变量 JD_TRY 设置为 true
if (process.env.JD_TRY && process.env.JD_TRY === 'true') {
$.log('\n遇到问题请先看脚本内注释解决不了可联系https://t.me/dylan_jdpro\n');
await requireConfig()
if (!$.cookiesArr[0]) {
$.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {
"open-url": "https://bean.m.jd.com/"
})
return
}
args_xh.tabId = args_xh.tabId.sort(() => 0.5 - Math.random())
for (let i = 0; i < args_xh.try_num; i++) {
if ($.cookiesArr[i]) {
$.cookie = $.cookiesArr[i];
$.UserName = decodeURIComponent($.cookie.match(/pt_pin=(.+?);/) && $.cookie.match(/pt_pin=(.+?);/)[1])
$.index = i + 1;
$.isLogin = true;
$.nickName = '';
await totalBean();
console.log(`\n开始【京东账号${$.index}${$.nickName || $.UserName}\n`);
$.except = false;
if (args_xh.except.includes($.UserName)) {
console.log(`跳过账号:${$.nickName || $.UserName}`)
$.except = true;
continue
}
if (!$.isLogin) {
$.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {
"open-url": "https://bean.m.jd.com/bean/signIndex.action"
});
await $.notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
continue
}
$.totalTry = 0
$.totalSuccess = 0
$.nowTabIdIndex = 0;
$.nowPage = 1;
$.nowItem = 1;
$.retrynum = 0
$.jda = '__jda=' + _jda('1xxxxxxxx.164xxxxxxxxxxxxxxxxxxx.164xxxxxxx.165xxxxxx.165xxxxxx.1xx')
if (!args_xh.unified) {
trialActivityIdList = []
trialActivityTitleList = []
}
$.isLimit = false;
// 获取tabList的不知道有哪些的把这里的注释解开跑一遍就行了
//await try_tabList();
// return;
$.isForbidden = false
$.wrong = false
size = 1
if (1) {
await requireConfig()
if (!$.cookiesArr[0]) {
$.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {
"open-url": "https://bean.m.jd.com/"
})
return
}
args_xh.tabId = args_xh.tabId.sort(() => 0.5 - Math.random())
for (let i = 0; i < args_xh.try_num; i++) {
if ($.cookiesArr[i]) {
$.cookie = $.cookiesArr[i];
$.UserName = decodeURIComponent($.cookie.match(/pt_pin=(.+?);/) && $.cookie.match(/pt_pin=(.+?);/)[1])
$.index = i + 1;
$.isLogin = true;
$.nickName = '';
//await totalBean();
console.log(`\n开始【京东账号${$.index}${$.nickName || $.UserName}\n`);
$.except = false;
if(args_xh.except.includes($.UserName)){
console.log(`跳过账号:${$.nickName || $.UserName}`)
$.except = true;
continue
}
if(!$.isLogin){
$.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {
"open-url": "https://bean.m.jd.com/bean/signIndex.action"
});
await $.notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
continue
}
$.totalTry = 0
$.totalSuccess = 0
$.nowTabIdIndex = 0;
$.nowPage = 1;
$.nowItem = 1;
$.retrynum = 0
$.jda='__jda='+_jda('1xxxxxxxx.164xxxxxxxxxxxxxxxxxxx.164xxxxxxx.165xxxxxx.165xxxxxx.1xx')
if (!args_xh.unified) {
trialActivityIdList = []
trialActivityTitleList = []
}
$.isLimit = false;
// 获取tabList的不知道有哪些的把这里的注释解开跑一遍就行了
//await try_tabList();
// return;
$.isForbidden = false
$.wrong = false
size = 1
while (trialActivityIdList.length < args_xh.maxLength && $.retrynum < 3) {
if ($.nowTabIdIndex === args_xh.tabId.length) {
console.log(`tabId组已遍历完毕不在获取商品\n`);
break;
} else {
await try_feedsList(args_xh.tabId[$.nowTabIdIndex], $.nowPage) //获取对应tabId的试用页面
while (trialActivityIdList.length < args_xh.maxLength && $.retrynum < 3) {
if ($.nowTabIdIndex === args_xh.tabId.length) {
console.log(`tabId组已遍历完毕不在获取商品\n`);
break;
} else {
await try_feedsList(args_xh.tabId[$.nowTabIdIndex], $.nowPage) //获取对应tabId的试用页面
}
if (trialActivityIdList.length < args_xh.maxLength) {
console.log(`间隔等待中请等待3秒 \n`)
await $.wait(3000);
}
}
if (trialActivityIdList.length < args_xh.maxLength) {
console.log(`间隔等待中请等待3秒 \n`)
await $.wait(3000);
if ($.isForbidden === false && $.isLimit === false) {
console.log(`稍后将执行试用申请,请等待 2 秒\n`)
await $.wait(2000);
for (let i = 0; i < trialActivityIdList.length && $.isLimit === false; i++) {
if ($.isLimit) {
console.log("试用上限")
break
}
if ($.isForbidden) { console.log('403了跳出'); break }
await try_apply(trialActivityTitleList[i], trialActivityIdList[i])
//console.log(`间隔等待中,请等待 ${args_xh.applyInterval} ms\n`)
const waitTime = generateRandomInteger(args_xh.applyInterval, 9000);
console.log(`随机等待${waitTime}ms后继续`);
await $.wait(waitTime);
}
console.log("试用申请执行完毕...")
// await try_MyTrials(1, 1) //申请中的商品
$.giveupNum = 0;
$.successNum = 0;
$.getNum = 0;
$.completeNum = 0;
await try_MyTrials(1, 2) //申请成功的商品
// await try_MyTrials(1, 3) //申请失败的商品
await showMsg()
}
}
if ($.isForbidden === false && $.isLimit === false) {
console.log(`稍后将执行试用申请,请等待 2 秒\n`)
await $.wait(2000);
for (let i = 0; i < trialActivityIdList.length && $.isLimit === false; i++) {
if ($.isLimit) {
console.log("试用上限")
break
}
if ($.isForbidden) { console.log('403了跳出'); break }
await try_apply(trialActivityTitleList[i], trialActivityIdList[i])
//console.log(`间隔等待中,请等待 ${args_xh.applyInterval} ms\n`)
const waitTime = generateRandomInteger(args_xh.applyInterval, 9000);
console.log(`随机等待${waitTime}ms后继续`);
await $.wait(waitTime);
if ($.isNode()) {
if ($.index % args_xh.sendNum === 0) {
$.sentNum++;
console.log(`正在进行第 ${$.sentNum} 次发送通知,发送数量:${args_xh.sendNum}`)
await $.notify.sendNotify(`${$.name}`, `${notifyMsg}`)
notifyMsg = "";
}
console.log("试用申请执行完毕...")
// await try_MyTrials(1, 1) //申请中的商品
$.giveupNum = 0;
$.successNum = 0;
$.getNum = 0;
$.completeNum = 0;
await try_MyTrials(1, 2) //申请成功的商品
// await try_MyTrials(1, 3) //申请失败的商品
await showMsg()
}
}
if ($.isNode()) {
if ($.index % args_xh.sendNum === 0) {
$.sentNum++;
console.log(`正在进行第 ${$.sentNum} 次发送通知,发送数量:${args_xh.sendNum}`)
if ($.isNode() && $.except === false) {
if (($.cookiesArr.length - ($.sentNum * args_xh.sendNum)) < args_xh.sendNum && notifyMsg.length != 0) {
console.log(`正在进行最后一次发送通知,发送数量:${($.cookiesArr.length - ($.sentNum * args_xh.sendNum))}`)
await $.notify.sendNotify(`${$.name}`, `${notifyMsg}`)
notifyMsg = "";
}
}
}
if ($.isNode() && $.except === false) {
if (($.cookiesArr.length - ($.sentNum * args_xh.sendNum)) < args_xh.sendNum && notifyMsg.length != 0) {
console.log(`正在进行最后一次发送通知,发送数量:${($.cookiesArr.length - ($.sentNum * args_xh.sendNum))}`)
await $.notify.sendNotify(`${$.name}`, `${notifyMsg}`)
notifyMsg = "";
}
}
} else {
console.log(`\n您未设置变量export JD_TRY="true"运行【京东试用】脚本, 结束运行!\n`)
}
console.log(`\n您未设置变量export JD_TRY="true"运行【京东试用】脚本, 结束运行!\n`)
}
})().catch((e) => {
console.error(`❗️ ${$.name} 运行错误!\n${e}`)
}).finally(() => $.done())
@ -510,19 +509,19 @@ function try_apply(title, activityId) {
body = await geth5st(body);
if(!body) return;
let opt =
{
"url": `${URL}?${body}}`,
'headers': {
'Cookie': $.cookie + $.jda,
'user-agent': 'jdapp;iPhone;10.1.2;15.0;ff2caa92a8529e4788a34b3d8d4df66d9573f499;network/wifi;model/iPhone13,4;addressid/2074196292;appBuild/167802;jdSupportDarkMode/1;Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'Referer': 'https://prodev.m.jd.com/',
'origin': 'https://prodev.m.jd.com/',
'Accept': 'application/json,text/plain,*/*',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-cn',
'Content-Type': 'application/x-www-form-urlencoded',
},
}
{
"url": `${URL}?${body}}`,
'headers': {
'Cookie': $.cookie + $.jda,
'user-agent': 'jdapp;iPhone;10.1.2;15.0;ff2caa92a8529e4788a34b3d8d4df66d9573f499;network/wifi;model/iPhone13,4;addressid/2074196292;appBuild/167802;jdSupportDarkMode/1;Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'Referer': 'https://prodev.m.jd.com/',
'origin': 'https://prodev.m.jd.com/',
'Accept': 'application/json,text/plain,*/*',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-cn',
'Content-Type': 'application/x-www-form-urlencoded',
},
}
$.get(opt, (err, resp, data) => {
try {
if (err) {
@ -974,7 +973,7 @@ function Env(name, opts) {
if (!Array.isArray(path)) path = path.toString().match(/[^.[\]]+/g) || []
path.slice(0, -1).reduce((a, c, i) => (Object(a[c]) === a[c] ? a[c] : (a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1] ? [] : {})), obj)[
path[path.length - 1]
] = value
] = value
return obj
}
@ -1344,4 +1343,4 @@ function Env(name, opts) {
}
}
})(name, opts)
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

42
jd_wxShareActivity.js Executable file

File diff suppressed because one or more lines are too long

8
jd_wxSignRed.js Normal file

File diff suppressed because one or more lines are too long