From dad3455930b833bc11249f4163b45a0d4337f714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=AF=E8=BE=BE=E9=B8=AD?= Date: Wed, 26 Feb 2025 23:59:40 +0800 Subject: [PATCH] . --- parse/jd/jd_task_farmNew.js | 692 +++++++++++++++++++++++++++++++++++ parse/jd/jd_task_shopGift.js | 105 ++++++ parse/jd/jd_task_videoHb.js | 288 +++++++++++++++ 3 files changed, 1085 insertions(+) create mode 100644 parse/jd/jd_task_farmNew.js create mode 100644 parse/jd/jd_task_shopGift.js create mode 100644 parse/jd/jd_task_videoHb.js diff --git a/parse/jd/jd_task_farmNew.js b/parse/jd/jd_task_farmNew.js new file mode 100644 index 0000000..95c5ba2 --- /dev/null +++ b/parse/jd/jd_task_farmNew.js @@ -0,0 +1,692 @@ +import {Template} from '../../template.js' + +export class Main extends Template { + constructor() { + super() + this.profile = { + title: '京东新农场', + help: 'main', + prompt: { + 'tenWater': '1 #每天只做20次浇水任务', + 'stock': "200 #保留水滴数", + 'tree': '1 #如果检测到没有种树,自动选择一个商品进行种植', + 'inviteJson': 'true #使用自定义助力码' + }, + headers: { + 'x-rp-client': "h5_1.0.0", + referer: 'https://h5.m.jd.com/pb/015686010/Bc9WX7MpCW7nW9QjZ5N3fFeJXMH/index.html' + }, + tempExpire: 86400000, + readme: `如要使用自定义助力码,请在框架目录/inviter创建jd_task_plantBean.json,按需修改[{"user":"a","inviteCode":"abc"},{"user":"b","inviteCode":"efg"}]`, + turn: 4, + crontab: 3, + interval: 1000 + } + } + + async prepare() { + } + + async middle() { + if (this.turnCount == 3) { + for (let inviter of this.inviter) { + inviter.category = 'inviteCode' + inviter.times = 35 + inviter.limit = 1 + this.shareCode(inviter) + } + for (let user of this.help) { + let inviteCode = await this.getTemp(user) + if (inviteCode) { + this.shareCode({ + user, + inviteCode, + category: 'inviteCode', + times: 35, + limit: 1 + }) + } + } + } + else if (this.turnCount == 1) { + this.shareCode({ + task: 'main' + }) + } + } + + async main(p) { + let user = p.data.user; + let context = p.context; + if (this.turnCount == 0) { + p.context.complete = true + } + if (this.turnCount == 0) { + if (this.turnCount == 0) { + let signIn = await this.curl({ + 'url': `https://api.m.jd.com/client.action`, + 'form': `functionId=dongDongFarmSignIn&body={"linkId":"LCH-fV7hSnChB-6i5f4ayw"}&t=1740546479554&appid=activities_platform&client=ios&clientVersion=15.0.20&&build=169736&screen=390*844&networkType=wifi&d_brand=iPhone&d_model=iPhone13,3&lang=zh_CN&osVersion=15.1.1&partner=-1&cthr=1`, + user, algo: { + appId: '65f9d' + } + } + ) + if (this.haskey(signIn, 'success')) { + p.log('签到成功') + } + else { + p.log(this.haskey(signIn, 'errMsg') || '签到失败') + } + } + let farmHome = await this.curl({ + 'url': `https://api.m.jd.com/client.action`, + 'form': `appid=signed_wh5&body={"version":9,"channelParam":"1"}&client=apple&clientVersion=15.0.11&functionId=farm_home`, + user, + algo: { + appId: 'c57f6', + expire: { + code: -30001 + } + } + } + ) + if (!farmHome) { + return + } + let home = this.haskey(farmHome, 'data.result') || {} + let bizCode = farmHome.data.bizCode + let treeFullStage = home.treeFullStage + if (bizCode == -1001) { + p.err('活动太火爆了, 请稍后再试~') + return + } + if (treeFullStage == 5) { + this.msg(`商品可兑换`) + } + if (treeFullStage == 5 && this.profile.tree) { + p.log('没有种树') + let board = await this.curl({ + 'url': `https://api.m.jd.com/client.action`, + 'form': `appid=signed_wh5&body={"version":10,"channelParam":"1","boardType":"level"}&client=apple&clientVersion=15.0.11&functionId=farm_tree_board`, + user, + } + ) + try { + let skus = board.data.result.farmTreeLevels[2].farmLevelTrees[0] + p.log("正在种树,选择商品:", skus.skuName) + await this.curl({ + 'url': `https://api.m.jd.com/client.action`, + 'form': `appid=signed_wh5&body=${this.dumps({ + "version": 10, + "channelParam": "1", + "uid": skus.uid, + "type": "plantSku" + })}&client=apple&clientVersion=15.0.11&functionId=farm_plant_tree`, + user, + } + ) + if (this.haskey(tree, 'data.success')) { + farmHome = await this.curl({ + 'url': `https://api.m.jd.com/client.action`, + 'form': `appid=signed_wh5&body={"version":10,"channelParam":"1"}&client=apple&clientVersion=15.0.11&functionId=farm_home`, + user, + algo: { + appId: 'c57f6', + } + } + ) + if (!farmHome) { + return + } + home = this.haskey(farmHome, 'data.result') || {} + } + else { + p.log("种树失败") + return + } + } catch (e) { + console.log(e) + p.log("种树失败2") + } + } + let inviteCode = home.farmHomeShare.inviteCode + let bottleWater = home.bottleWater + p.log("当前进度:", home.waterTips) + let taskList = await this.curl({ + 'url': `https://api.m.jd.com/client.action`, + 'form': `appid=signed_wh5&client=apple&clientVersion=15.0.15&screen=390*812&wqDefault=false&build=169720&osVersion=15.1.1&networkType=wifi&d_brand=iPhone&d_model=iPhone13,3&partner=&t=1740322939720&body={"version":10,"channelParam":"1","channel":0,"pushSwitch":false,"showSubscribe":true,"babelChannel":"ttt6","lbsSwitch":false}&functionId=farm_task_list&rfs=0000`, + user + } + ) + let waterConut = 0 + let status = 1 + for (let i of this.haskey(taskList, 'data.result.taskList')) { + if (i.mainTitle.includes("助力")) { + } + else if (i.mainTitle.includes("通知")) { + } + else if (i.mainTitle.includes("下单")) { + } + else if (i.mainTitle.includes("浇水")) { + if (i.taskDoTimes != i.taskLimitTimes) { + let isOk = 1 + status = 0 + for (let n of Array(parseInt((i.taskLimitTimes - i.taskDoTimes) / 5))) { + let water = await this.curl({ + 'url': `https://api.m.jd.com/client.action`, + 'form': `appid=signed_wh5&client=apple&clientVersion=15.0.20&screen=390*812&wqDefault=false&build=169736&osVersion=15.1.1&networkType=wifi&d_brand=iPhone&d_model=iPhone13,3&partner=&openudid=674ce0d97511f5ed054c3dc0af093b3b245ab68d&t=1740546580076&body={"version":10,"channelParam":"1","waterType":2,"babelChannel":"ttt6","lbsSwitch":false}&functionId=farm_water`, + user, + algo: { + appId: '28981' + } + } + ) + let bottleWater = this.haskey(water, 'data.result.bottleWater') + if (bottleWater) { + p.log("浇水中,剩余水滴:", bottleWater) + if (bottleWater<10) { + isOk = 0 + break + } + await this.wait(1000) + } + else { + p.log('浇水失败:', this.haskey(water, 'data.bizMsg')) + isOk = 0 + status = 0 + break + } + } + for (let n of Array(((i.taskLimitTimes - i.taskDoTimes) % 5))) { + let water = await this.curl({ + 'url': `https://api.m.jd.com/client.action`, + 'form': `appid=signed_wh5&client=apple&clientVersion=15.0.20&screen=390*812&wqDefault=false&build=169736&osVersion=15.1.1&networkType=wifi&d_brand=iPhone&d_model=iPhone13,3&partner=&openudid=674ce0d97511f5ed054c3dc0af093b3b245ab68d&t=1740546580076&body={"version":10,"channelParam":"1","waterType":1,"babelChannel":"ttt6","lbsSwitch":false}&functionId=farm_water`, + user, + algo: { + appId: '28981' + } + } + ) + let bottleWater = this.haskey(water, 'data.result.bottleWater') + if (bottleWater) { + p.log("浇水中,剩余水滴:", bottleWater) + if (bottleWater<10) { + isOk = 0 + break + } + await this.wait(1000) + } + else { + p.log('浇水失败:', this.haskey(water, 'data.bizMsg')) + isOk = 0 + break + } + } + if (isOk) { + let award = await this.curl({ + 'url': `https://api.m.jd.com/client.action`, + 'form': `appid=signed_wh5&client=apple&clientVersion=15.0.15&screen=390*812&wqDefault=false&build=169720&osVersion=15.1.1&networkType=wifi&d_brand=iPhone&d_model=iPhone13,3&partner=&openudid=674ce0d97511f5ed054c3dc0af093b3b245ab68d&t=1740323796058&body={"version":10,"channelParam":"1","taskType":"${i.taskType}","taskId":${i.taskId},"channel":0}&functionId=farm_task_receive_award`, + user, + algo: {'appId': '33e0f'}, + } + ) + if (this.haskey(award, 'data.result.taskAward')) { + status = 1 + // p.log("获得奖励:", award.data.result.taskAward) + for (let kk of award.data.result.taskAward) { + if (this.haskey(kk, 'awardType', 1)) { + bottleWater += kk.awardValue + p.log(`获得水滴:`, kk.awardValue) + } + } + } + else { + status = 0 + p.err("获取失败:", this.haskey(award, 'data.bizMsg')) + } + } + } + } + else if (i.taskDoTimes != i.taskLimitTimes) { + status = 0 + p.log("正在运行:", i.mainTitle) + let itemId = i.taskSourceUrl + let taskDetaiList = [] + if (itemId) { + taskDetaiList.push({'itemId': itemId}) + } + else { + let detail = await await this.curl({ + 'url': `https://api.m.jd.com/client.action`, + 'form': `appid=signed_wh5&client=apple&clientVersion=15.0.15&screen=390*812&wqDefault=false&build=169720&osVersion=15.1.1&networkType=wifi&d_brand=iPhone&d_model=iPhone13,3&partner=&body={"version":10,"channelParam":"1","taskType":"${i.taskType}","taskId":${i.taskId},"channel":0}&functionId=farm_task_detail`, + user + } + ) + if (this.haskey(detail, 'data.result.taskDetaiList')) { + taskDetaiList = detail.data.result.taskDetaiList + } + } + for (let kk of taskDetaiList) { + if (i.timePeriod) { + p.log("等待:", i.timePeriod, 's') + await this.wait(i.timePeriod * 1000) + } + let doTask = await this.curl({ + 'url': `https://api.m.jd.com/client.action`, + 'form': `appid=signed_wh5&client=apple&clientVersion=15.0.15&screen=390*812&wqDefault=false&build=169720&osVersion=15.1.1&networkType=wifi&d_brand=iPhone&d_model=iPhone13,3&partner=&openudid=674ce0d97511f5ed054c3dc0af093b3b245ab68d&t=1740323572547&body={"version":10,"channelParam":"1","taskType":"${i.taskType}","taskId":${i.taskId},"taskInsert":${kk.taskInsert || false},"itemId":"${new Buffer.from(kk.itemId).toString('base64')}","channel":0}&functionId=farm_do_task`, + user, + algo: { + appId: '28981' + } + } + ) + if (this.haskey(doTask, 'data.success')) { + let award = await this.curl({ + 'url': `https://api.m.jd.com/client.action`, + 'form': `appid=signed_wh5&client=apple&clientVersion=15.0.15&screen=390*812&wqDefault=false&build=169720&osVersion=15.1.1&networkType=wifi&d_brand=iPhone&d_model=iPhone13,3&partner=&openudid=674ce0d97511f5ed054c3dc0af093b3b245ab68d&t=1740323796058&body={"version":10,"channelParam":"1","taskType":"${i.taskType}","taskId":${i.taskId},"channel":0}&functionId=farm_task_receive_award`, + user, algo: {'appId': '33e0f'}, + } + ) + if (this.haskey(award, 'data.result.taskAward')) { + status = 1 + // p.log("获得奖励:", award.data.result.taskAward) + for (let kk of award.data.result.taskAward) { + if (this.haskey(kk, 'awardType', 1)) { + bottleWater += kk.awardValue + p.log(`获得水滴:`, kk.awardValue) + } + } + } + else { + p.err("获取失败:", this.haskey(award, 'data.bizMsg')) + } + } + else { + p.err("任务失败:", this.haskey(doTask, 'data.bizMsg')) + } + } + } + else if (i.taskStatus == 2) { + let award = await this.curl({ + 'url': `https://api.m.jd.com/client.action`, + 'form': `appid=signed_wh5&client=apple&clientVersion=15.0.15&screen=390*812&wqDefault=false&build=169720&osVersion=15.1.1&networkType=wifi&d_brand=iPhone&d_model=iPhone13,3&partner=&openudid=674ce0d97511f5ed054c3dc0af093b3b245ab68d&t=1740323796058&body={"version":10,"channelParam":"1","taskType":"${i.taskType}","taskId":${i.taskId},"channel":0}&functionId=farm_task_receive_award`, + user, + algo: {'appId': '33e0f'}, + } + ) + if (this.haskey(award, 'data.result.taskAward')) { + status = 1 + // p.log("获得奖励:", award.data.result.taskAward) + for (let kk of award.data.result.taskAward) { + if (this.haskey(kk, 'awardType', 1)) { + bottleWater += kk.awardValue + p.log(`获得水滴:`, kk.awardValue) + } + } + } + else { + status = 0 + p.err("获取失败:", this.haskey(award, 'data.bizMsg')) + } + await this.wait(4000) + } + else { + p.log("任务已完成:", i.mainTitle) + status = 1 + } + } + let s1 = 1 + if (this.profile.tenWater) { + p.log("跳过浇水: 检测到配置了tenWater参数,跳过浇水") + } + else { + let stock = parseInt(this.profile.stock || 200) + p.log("剩余水滴:", bottleWater, '保留水滴数:', stock) + if (bottleWater>stock) { + while (true) { + s1 = 0 + let water = await this.curl({ + 'url': `https://api.m.jd.com/client.action`, + 'form': + `appid=signed_wh5&client=apple&clientVersion=15.0.20&screen=390*812&wqDefault=false&build=169736&osVersion=15.1.1&networkType=wifi&d_brand=iPhone&d_model=iPhone13,3&partner=&openudid=674ce0d97511f5ed054c3dc0af093b3b245ab68d&t=1740546580076&body={"version":10,"channelParam":"1","waterType":2,"babelChannel":"ttt6","lbsSwitch":false}&functionId=farm_water`, + user, + algo: + { + appId: '28981' + } + } + ) + let bottleWater = this.haskey(water, 'data.result.bottleWater') + if (bottleWater) { + s1 = 1 + p.log("浇水中,剩余水滴:", bottleWater) + if (bottleWater index)) { + if (taskItemList[j] && taskItemList[j].itemId) { + if (i.timeLimitPeriod) { + let start = await this.curl({ + 'url': `https://api.m.jd.com/api?functionId=apStartTaskTime`, + 'form': `functionId=apStartTaskTime&body={"taskType":"${i.taskType}","taskId":${i.id},"channel":4,"checkVersion":true,"linkId":"${linkId}","pipeExt":${this.dumps({ + ...i.pipeExt, ...taskItemList[j].pipeExt + })},"taskInsert":false,"itemId":"${encodeURIComponent(taskItemList[j].itemId)}"}&t=1738483884373&appid=activity_platform_se&client=ios&clientVersion=15.0.11&platform=3&loginType=2&loginWQBiz=wegame`, + user, + algo: { + appId: 'acb1e' + } + } + ) + if (this.haskey(start, 'code', 1)) { + p.log("失败了") + break + } + p.log(`等待${i.timeLimitPeriod}秒...`) + await this.wait(i.timeLimitPeriod * 1000) + var doTask = await this.curl({ + 'url': `https://api.m.jd.com/api?functionId=apDoLimitTimeTask`, + 'form': `functionId=apDoLimitTimeTask&body={"linkId":"${linkId}"}&t=1738483906048&appid=activities_platform&client=ios&clientVersion=15.0.11&platform=3&loginType=2&loginWQBiz=wegame`, + user, + algo: { + appId: 'ebecc' + } + }) + } + else { + var doTask = await this.curl({ + 'url': `https://api.m.jd.com/api?functionId=apsDoTask`, + 'form': `functionId=apsDoTask&body={"taskType":"${i.taskType}","taskId":${i.id},"channel":4,"checkVersion":true,"linkId":"${linkId}","pipeExt":${this.dumps({ + ...i.pipeExt, ...taskItemList[j].pipeExt + })},"taskInsert":false,"itemId":"${encodeURIComponent(taskItemList[j].itemId)}"}&t=1738480908001&appid=activities_platform&client=ios&clientVersion=15.0.11`, + algo: {'appId': '54ed7'}, + user + } + ) + } + if (this.haskey(doTask, 'success')) { + p.log("任务完成", `[${parseInt(j) + 1}/${i.taskLimitTimes - i.taskDoTimes}]`) + } + else { + p.log("任务失败:", this.haskey(doTask, 'errMsg') || doTask) + } + if (i.canDrawAwardNum) { + let award = await this.curl({ + 'url': `https://api.m.jd.com/api?functionId=apTaskDrawAward`, + 'form': `functionId=apTaskDrawAward&body={"taskType":"${i.taskType}","taskId":${i.id},"channel":4,"checkVersion":true,"linkId":"${linkId}"}&t=1739360342034&appid=activities_platform&client=ios&clientVersion=15.0.11`, + user, + algo: { + appId: 'f0f3f' + } + } + ) + if (this.haskey(award, 'data')) { + p.log(`抽奖次数+1`) + } + else { + p.err("抽奖领取失败") + } + } + await this.wait(3000) + } + } + } + } + break + } + } + } + let home = await this.curl({ + 'url': `https://api.m.jd.com/api`, + 'form': `functionId=wheelsHome&body={"linkId":"${linkId}","inviteActId":"","inviterEncryptPin":"","inviteCode":""}&t=1739590571889&appid=activities_platform&client=ios&clientVersion=15.0.15&cthr=1&loginType=&loginWQBiz=wegame`, + user, + algo: {'appId': 'c06b7',}, + } + ) + let drawNum = this.haskey(home, 'data.lotteryChances') || 0 + p.log("可抽奖次数:", drawNum) + for (let i of Array(drawNum)) { + try { + let lottery = await this.curl({ + url: 'https://api.m.jd.com/api', + form: `functionId=wheelsLottery&body={"linkId":"${linkId}"}&t=1739590600753&appid=activities_platform&client=ios&clientVersion=15.0.15&cthr=1&loginType=&loginWQBiz=wegame`, + algo: { + 'appId': 'bd6c8', + expire: { + code: 1000 + }, + status: true + }, + referer: `https://lotterydraw-new.jd.com/?id=${linkId}`, + user + }) + if (this.haskey(lottery, 'code', 4000)) { + p.log('抽奖机会用完啦') + break + } + if (this.haskey(lottery, 'data')) { + drawNum-- + p.lottery(lottery) + } + else { + p.err("抽奖错误") + break + } + await this.wait(2000) + } catch (e) { + } + } + if (isOk && drawNum == 0) { + p.info.work = true + } + } + else if (this.turnCount == 1) { + let helpInfo = await this.curl({ + 'url': `https://api.m.jd.com/client.action`, + 'form': `appid=signed_wh5&client=apple&clientVersion=15.0.11&screen=820*1110&wqDefault=false&build=169714&osVersion=16.6&networkType=wifi&d_brand=iPhone&d_model=iPad13,18&partner=&t=1740556273015&body={"version":10,"channelParam":"1"}&functionId=farm_assist_init_info`, + user + } + ) + if (!helpInfo) { + p.err("没有获取到助力数据") + } + else { + p.log("正在领取助力奖励") + } + for (let i of this.haskey(helpInfo, 'data.result.assistStageList')) { + if (i.stageStaus == 2) { + let award = await this.curl({ + 'url': `https://api.m.jd.com/client.action`, + 'form': `appid=signed_wh5&client=apple&clientVersion=15.0.11&screen=820*1110&wqDefault=false&build=169714&osVersion=16.6&networkType=wifi&d_brand=iPhone&d_model=iPad13,18&partner=&t=1740556273015&body={"version":10,"channelParam":"1"}&functionId=farm_assist_receive_award`, + user, + algo: {'appId': 'c4332'}, + } + ) + if (this.haskey(award, 'data.success')) { + p.log("获取助力奖励成功:", award.data.result.amount) + } + else { + p.log("获取助力奖励失败") + } + await this.wait(4000) + } + } + } + } +} + diff --git a/parse/jd/jd_task_shopGift.js b/parse/jd/jd_task_shopGift.js new file mode 100644 index 0000000..a13cf11 --- /dev/null +++ b/parse/jd/jd_task_shopGift.js @@ -0,0 +1,105 @@ +import {Template} from '../../template.js' + +export class Main extends Template { + constructor() { + super() + this.profile = { + title: '京东关注店铺领京豆', + sync: 1, + display: true, + tempExpire: 8640000, + verify: 1, + crontab: `${this.rand(5, 10)},${this.rand(35, 40)} 9-23 * * *` + } + } + + async prepare() { + } + + async main(p) { + let user = p.data.user; + let context = p.context; + let shopId = context.shopId + let venderId = context.venderId + let headers = context.headers || {} + let algo = context.algo || {range: 6} + let body = { + "source": "app-shop", + "displayWidth": "1098.000000", + "sourceRpc": "shop_app_home_home", + venderId, + shopId + } + let activityId = context.activityId || await this.getTemp(context.venderId) + let status = 0 + if (!activityId) { + var s = await this.curl({ + 'url': `https://api.m.jd.com/client.action?functionId=getShopHomeActivityInfo`, + 'form': `avifSupport=0&body=${this.dumps(body)}&build=169736&client=apple&clientVersion=15.0.20&d_brand=apple`, + user, + algo: { + sign: true + } + } + ) + activityId = this.haskey(s, 'result.giftBagDataResult.activityId') || this.haskey(s, 'result.activityId') + if (activityId) { + await this.setTemp(venderId, activityId) + } + } + if (activityId) { + let body2 = { + "follow": 0, + "activityId": activityId.toString(), + "sourceRpc": "shop_app_home_window", + shopId: shopId.toString(), + venderId: venderId.toString() + } + let drawShopGift = await this.curl({ + 'url': 'https://api.m.jd.com/client.action?g_ty=ls&g_tk=518274330', + 'form': `functionId=whx_drawShopGift&body=${this.dumps(body2)}&t=1670345201521&appid=wx_mini_app&clientVersion=11.0.0&client=wh5&uuid=0040a1e96b5d357ae888a0f18bb23968`, + user, + headers: { + 'referer': 'https://servicewechat.com/wx91d27dbf599dff74/747/page-frame.html', + 'user-agnet': 'wechat' + } + }) + if (drawShopGift) { + status = 1 + p.log("正在关注", this.haskey(drawShopGift, 'result.giftDesc') || '没有领取到') + for (let g of this.haskey(drawShopGift, 'result.alreadyReceivedGifts') || []) { + if (g.prizeType == 4) { + this.msg(`京豆: ${g.redWord}`) + } + } + await this.curl({ + 'url': 'https://api.m.jd.com/client.action?g_ty=ls&g_tk=518274330', + 'form': `functionId=whx_followShop&body={"shopId":"${context.shopId}","follow":"false"}&t=1670345201521&appid=wx_mini_app&clientVersion=11.0.0&client=wh5&uuid=0040a1e96b5d357ae888a0f18bb23968`, + user, + algo, + headers: { + 'referer': 'https://servicewechat.com/wx91d27dbf599dff74/747/page-frame.html', + 'user-aget': 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_1_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.28(0x18001c2e) NetType/WIFI Language/zh_CN' + } + }) + } + } + else { + p.log("没获取到...") + let unfollow = await this.curl({ + 'url': 'https://api.m.jd.com/client.action?g_ty=ls&g_tk=518274330', + 'form': `functionId=whx_followShop&body={"shopId":"${context.shopId}","follow":"false"}&t=1670345201521&appid=wx_mini_app&clientVersion=11.0.0&client=wh5&uuid=0040a1e96b5d357ae888a0f18bb23968`, + user, + algo, + headers: { + 'referer': 'https://servicewechat.com/wx91d27dbf599dff74/747/page-frame.html', + 'user-aget': 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_1_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.28(0x18001c2e) NetType/WIFI Language/zh_CN' + } + }) + } + if (status) { + p.info.work = true + } + } +} + diff --git a/parse/jd/jd_task_videoHb.js b/parse/jd/jd_task_videoHb.js new file mode 100644 index 0000000..c1a69ed --- /dev/null +++ b/parse/jd/jd_task_videoHb.js @@ -0,0 +1,288 @@ +import {Template} from '../../template.js' + +export class Main extends Template { + constructor() { + super() + this.profile = { + title: '京东视频红包', + interval: 3000, + round: 4, + verify: 2, + crontab: 3 + } + } + + async prepare() { + let html = await this.curl({ + 'url': `https://pro.m.jd.com/mall/active/4VRY8pVY1KRhYkVPgywV5Qa9Rovp/index.html?tttparams=i2c4MeyJnTGF0IjoiMjMuOTM5MTkyIiwidW5fYXJlYSI6IjE2XzEzNDFfMTM0N180NDc1MCIsImRMYXQiOiIiLCJwcnN0YXRlIjoiMCIsImFkZHJlc3NJZCI6Ijc2NTc3NTQ4ODIiLCJsYXQiOiIiLCJwb3NMYXQiOiIyMy45MzkxOTIiLCJwb3NMbmciOiIxMTcuNjExMjMiLCJncHNfYXJlYSI6IjBfMF8wXzAiLCJsbmciOiIiLCJ1ZW1wcyI6IjAtMC0yIiwiZ0xuZyI6IjExNy42MTEyMyIsIm1vZGVsIjoiaVBob25lMTMsMyIsImRMbmciOiIifQ5%3D%3D`, + user: this.tester() + } + ) + // console.log(html) + let code = this.matchAll(/"scanTaskCode(?:_\d+)*"\s*:\s*"(\w+)"/g, html) + if (code) { + this.code = code.map(d => { + return { + "type": "20", + "assignmentId": d, + "scanTaskCodeIndex": "2", + "activitySource": "1", + "realClient": "ios", + "taskRewardType": "1" + } + }) + // for (let d of this.matchAll(/"signInTaskCode(?:_\d+)*"\s*:\s*"(\w+)"/g, html)) { + // this.code.push({ + // "type": "21", + // "assignmentId": d, + // "activitySource": "1", "realClient": "ios", "floatType": "1" + // }) + // } + for (let d of this.matchAll(/"liveFollowTaskCode(?:_\d+)*"\s*:\s*"(\w+)"/g, html)) { + this.code.push({ + "type": "24", + "assignmentId": d, + "activitySource": "1", + "realClient": "ios", + "floatType": "1", + "subPlayType": "-100" + }) + } + for (let d of this.matchAll(/"secondsTaskCode(?:_\d+)*"\s*:\s*"(\w+)"/g, html)) { + this.code.push({ + "type": "25", + "assignmentId": d, + "activitySource": "1", + "realClient": "ios", + "floatType": "1", + "subPlayType": "-100" + }) + } + for (let d of this.matchAll(/"fissionTaskCode(?:_\d+)*"\s*:\s*"(\w+)"/g, html)) { + this.code.push({ + "type": "29", "assignmentId": d, "activitySource": "1", "realClient": "ios", "floatType": "1" + }) + } + } + } + + async main(p) { + let user = p.data.user; + let context = p.context; + let status = 1 + p.info.list = p.info.list || [] + if (context.round == 0) { + let info = await this.curl({ + 'url': `https://api.m.jd.com/videoRedPacketHomePage_info`, + 'form': `functionId=videoRedPacketHomePage_info&appid=video-redbag-h5&body=${this.dumps(this.code)}&client=wh5&t=1699156906324&clientVersion=12.3.1`, + user, + algo: { + appId: 'd51cc', + expire: { + busiCode: '3' + } + } + } + ) + let sign = await this.curl({ + 'url': `https://api.m.jd.com/videoHb_sign`, + 'form': `functionId=videoHb_sign&appid=video-redbag-h5&body={}&client=wh5&t=1704344655057&clientVersion=12.3.1`, + user, + algo: {appId: '2023f'} + } + ) + for (let i of this.haskey(info, 'data')) { + if (i.status == 2) { + p.log("已完成:", i.assignmentName) + } + else { + status = 0 + p.log("正在运行:", i.assignmentName) + let accept = await this.curl({ + 'url': `https://api.m.jd.com/videoRedPacketHomePage_accept`, + 'form': `functionId=videoRedPacketHomePage_accept&appid=video-redbag-h5&body={"type":"20","assignmentId":"${i.assignmentId}","itemId":"${i.itemId}"}&client=wh5&t=1699157368652&clientVersion=12.3.1`, + user, + algo: {appId: '57a9c'} + } + ) + if (this.haskey(accept, 'success')) { + if (i.waitDuration) { + p.log("预等待:", i.waitDuration) + } + p.info.list.push({ + "assignmentId": i.assignmentId, "itemId": i.itemId, + 'time': new Date().getTime() / 1000 + parseInt(i.waitDuration), + 'title': i.assignmentName + }) + await this.wait(1000) + } + else { + if (this.haskey(accept, 'busiCode', '8014')) { + p.log('活动太火爆,等会再来吧~') + p.info.jump = 1 + return + } + p.log(accept) + } + } + } + if (status) { + p.info.work = true + } + } + else if (context.round == 1) { + for (let i of p.info.list) { + let wait = i.time - new Date().getTime() / 1000 + p.log("正在获取:", i.title) + if (wait>0) { + p.log("正在等待:", wait) + await this.wait(wait * 1000) + } + let done = await this.curl({ + 'url': `https://api.m.jd.com/videoRedPacketHomePage_done`, + 'form': `functionId=videoRedPacketHomePage_done&appid=video-redbag-h5&body={"type":"20","assignmentId":"${i.assignmentId}","itemId":"${i.itemId}"}&client=wh5&t=1699157368652&clientVersion=12.3.1`, + user, + algo: {appId: '12bf2'} + } + ) + if (this.haskey(done, 'success')) { + p.log(done.data.rewardMsg) + status = 1 + } + else { + status = 0 + p.log(done) + } + await this.wait(1000) + } + if (p.info.list.length && status) { + p.info.work = true + } + else { + p.log("没有可执行的任务") + p.info.work = true + } + } + else if (context.round == 2) { + let exchange = await this.curl({ + 'url': `https://api.m.jd.com/videoRedPacketHomePage_exchangeCash`, + 'form': `functionId=videoRedPacketHomePage_exchangeCash&appid=video-redbag-h5&body={}&client=wh5&t=1699157963924&clientVersion=12.3.1`, + user, + algo: {appId: "8c80c"} + } + ) + if (this.haskey(exchange, 'success')) { + p.log('金币兑换成功') + } + let home = await this.curl({ + 'url': `https://api.m.jd.com/videoHbCw_homePage`, + 'form': `functionId=videoHbCw_homePage&appid=video-redbag-h5&body=%7B%7D&client=wh5&t=1699156595761&clientVersion=12.3.1`, + user, + algo: {appId: '7f9c4'} + } + ) + if (this.haskey(home, 'success')) { + let data = this.haskey(home, 'data') + let amount = data.cashBalanceFloor.amount + p.log('现有奖金:', amount) + let status = 1 + for (let i of data.cwCardFloor.cards.reverse()) { + if (i.topDesc == '已连续来访0天' && i.amount == 0.88) { + let init = await this.curl(this.modules.jdUrl.app('videoHb_newCustomerHbLayer', {}, 'post', user) + ) + p.log(init) + if (this.haskey(init, 'data.popAlertInfo.hbAmount')) { + p.log("初始化成功,获得:", init.data.popAlertInfo.hbAmount) + } + } + if (i.cwStatus == 0) { + p.log("正在提款至京东余额:", i.amountStr) + let cash = await this.curl({ + 'url': `https://api.m.jd.com/videoHbCw_doCw`, + 'form': `functionId=videoHbCw_doCw&appid=video-redbag-h5&body={"bizTraceId":"${i.bizTraceId}","amount":${i.amountStr}}&client=wh5&t=1699156604242&clientVersion=12.3.1`, + user, + algo: {appId: 'c5b74'} + } + ) + if (this.haskey(cash, 'success')) { + p.msg(`提款成功: ${i.amountStr}`) + } + else { + status = 0 + p.log(cash) + } + await this.wait(5000) + } + else if (i.cwStatus == 1) { + status = 1 + } + } + if (status) { + p.info.work = true + } + } + else { + p.log(home) + } + } + else { + var lists = ['740963579', + '419744560', '419744560', '419744560', '419744560', '419744560', '590181549', '626885205' + ] + if (!context.list) { + let videoDetail = await this.curl({ + 'url': `https://api.m.jd.com/video_videoDetail?g_ty=ls&g_tk=2107606655`, + 'form': `appid=mini_content&body={"id":"711886908","offset":"5_41","playtype":"9999","modeid":"1","style":"11","projectid":"100967","adid":"","pi":"","mpplaytype":"11","extParam":"{\\"activityId\\":\\"BPC-20240513-0019\\"}","skuId":""}&client=wxapp&clientVersion=10.14.200&functionId=video_videoDetail`, + user, + algo: { + appId: 'd734e' + } + } + ) + if (this.haskey(videoDetail, 'list')) { + lists = this.column(videoDetail.list, 'id') + context.list = lists + } + } + else { + lists = context.list + } + let jsLable = [ + "Q/g3kHW+Z0OYavMQtYHrNA7LYwslHVatolqZKq0h/nbpuOtrMZKpsSx6AY1fvblBiQLM/X3mONW05GImZM/KBH7CINMd/iXLDxurzYcNmVVPsPYyuq6ZgPn/28UD24t+rY08yVLZu6yhlhVUjWCjkg==", "4Nc6P/zwB+60A2aTvNSx9w7LYwslHVatolqZKq0h/nbpuOtrMZKpsSx6AY1fvblBiQLM/X3mONW05GImZM/KBH7CINMd/iXLDxurzYcNmVVPsPYyuq6ZgPn/28UD24t+rY08yVLZu6yhlhVUjWCjkg==", "gF1/9jdFDopw6w6LGhzbeQ7LYwslHVatolqZKq0h/nbpuOtrMZKpsSx6AY1fvblBiQLM/X3mONW05GImZM/KBH7CINMd/iXLDxurzYcNmVVPsPYyuq6ZgPn/28UD24t+rY08yVLZu6yhlhVUjWCjkg==", "27ulfi2CH8N0JwjosX1ulg7LYwslHVatolqZKq0h/nbpuOtrMZKpsSx6AY1fvblBiQLM/X3mONW05GImZM/KBH7CINMd/iXLDxurzYcNmVVPsPYyuq6ZgPn/28UD24t+rY08yVLZu6yhlhVUjWCjkg==", "zM36K2DPt0ARtmy6GComUQ7LYwslHVatolqZKq0h/nbpuOtrMZKpsSx6AY1fvblBiQLM/X3mONW05GImZM/KBH7CINMd/iXLDxurzYcNmVVPsPYyuq6ZgPn/28UD24t+rY08yVLZu6yhlhVUjWCjkg==", + "VStpTFFcPyNVMZXHhdgYdQ7LYwslHVatolqZKq0h/nbpuOtrMZKpsSx6AY1fvblBdFtCn/2sVW4/51duXMv5DX7CINMd/iXLDxurzYcNmVVPsPYyuq6ZgPn/28UD24t+rY08yVLZu6yhlhVUjWCjkg==", + "t6XttZjgZni/znFvFXvlUg7LYwslHVatolqZKq0h/nbpuOtrMZKpsSx6AY1fvblBdFtCn/2sVW4/51duXMv5DX7CINMd/iXLDxurzYcNmVVPsPYyuq6ZgPn/28UD24t+rY08yVLZu6yhlhVUjWCjkg==", + "78kfI5MBs8LDtC0gTr7Xdw7LYwslHVatolqZKq0h/nbpuOtrMZKpsSx6AY1fvblBdFtCn/2sVW4/51duXMv5DX7CINMd/iXLDxurzYcNmVVPsPYyuq6ZgPn/28UD24t+rY08yVLZu6yhlhVUjWCjkg==", + "Vnwf2U7YFC71f6bqRet05A7LYwslHVatolqZKq0h/nbpuOtrMZKpsSx6AY1fvblBdFtCn/2sVW4/51duXMv5DX7CINMd/iXLDxurzYcNmVVPsPYyuq6ZgPn/28UD24t+rY08yVLZu6yhlhVUjWCjkg==", + "iQX3z0f5Gt9z3+kVgwKnSQ7LYwslHVatolqZKq0h/nbpuOtrMZKpsSx6AY1fvblBdFtCn/2sVW4/51duXMv5DX7CINMd/iXLDxurzYcNmVVPsPYyuq6ZgPn/28UD24t+rY08yVLZu6yhlhVUjWCjkg==", "m0M0jZT19vGManJFn6JUtw7LYwslHVatolqZKq0h/nbpuOtrMZKpsSx6AY1fvblBM4R7PDP6fNrkpORnefS1PX7CINMd/iXLDxurzYcNmVVPsPYyuq6ZgPn/28UD24t+rY08yVLZu6yhlhVUjWCjkg==", + "AjmJ8sS/Z9lcMhvwONeMGw7LYwslHVatolqZKq0h/nbpuOtrMZKpsSx6AY1fvblBM4R7PDP6fNrkpORnefS1PX7CINMd/iXLDxurzYcNmVVPsPYyuq6ZgPn/28UD24t+rY08yVLZu6yhlhVUjWCjkg==", + "ZBQB4MvvDkmjDdq2n5qX2Q7LYwslHVatolqZKq0h/nbpuOtrMZKpsSx6AY1fvblBM4R7PDP6fNrkpORnefS1PX7CINMd/iXLDxurzYcNmVVPsPYyuq6ZgPn/28UD24t+rY08yVLZu6yhlhVUjWCjkg==", + "DYG1oqdj0YcKMrFS+Uj3OQ7LYwslHVatolqZKq0h/nbpuOtrMZKpsSx6AY1fvblBM4R7PDP6fNrkpORnefS1PX7CINMd/iXLDxurzYcNmVVPsPYyuq6ZgPn/28UD24t+rY08yVLZu6yhlhVUjWCjkg==", + "lDbJke38X/LYwQ4NXzjcXw7LYwslHVatolqZKq0h/nbpuOtrMZKpsSx6AY1fvblBM4R7PDP6fNrkpORnefS1PX7CINMd/iXLDxurzYcNmVVPsPYyuq6ZgPn/28UD24t+rY08yVLZu6yhlhVUjWCjkg==", + "m0M0jZT19vGManJFn6JUtw7LYwslHVatolqZKq0h/nbpuOtrMZKpsSx6AY1fvblBM4R7PDP6fNrkpORnefS1PX7CINMd/iXLDxurzYcNmVVPsPYyuq6ZgPn/28UD24t+rY08yVLZu6yhlhVUjWCjkg==", + ] + for (let i of lists.slice(0, 5)) { + let coin = await this.curl({ + 'url': `https://api.m.jd.com/client.action?functionId=videoHbGoldCoin_done`, + 'form': `avifSupport=0&body={"contentId":"${i}","playType":"163","jsLabel":"${this.random(jsLable)}","activitySource":"1"}&build=169736&client=apple&clientVersion=15.0.20`, + user, + algo: { + sign: true + } + } + ) + if (this.haskey(coin, 'success')) { + p.log('获得金币:', coin.data.rewardValue) + if (!coin.data.rewardValue) { + break + } + } + else { + p.log(coin) + break + } + await this.wait(2000) + } + } + } +} +