diff --git a/shangtuo.jpg b/bak/shangtuo.jpg similarity index 100% rename from shangtuo.jpg rename to bak/shangtuo.jpg diff --git a/shangtuo.js b/bak/shangtuo.js similarity index 96% rename from shangtuo.js rename to bak/shangtuo.js index 41664f4..e19ed6a 100644 --- a/shangtuo.js +++ b/bak/shangtuo.js @@ -3,13 +3,13 @@ 下载地址: 复制链接后,在微信里打开: -https://shatuvip.com/pages/login/register?recom_code=5290130 +https://shatuvip.com/pages/login/register?recom_code=7755074 或微信扫描二维码下载 https://raw.githubusercontent.com/leafxcy/JavaScript/main/shangtuo.jpg -推荐码: 5290130 -抢券时段为7:00到23:59,建议在8点后跑脚本,7点有可能会卡 +推荐码: 7755074 +抢券时段为7:00到23:59,建议在9点后跑脚本,7点有可能会卡 玩法:进APP后,先手动去全球分红->提取分红金,然后在个人中心->分红余额->提现一次0.03元(需要上传支付宝和微信收款码),就可以跑脚本了 脚本会自动看广告得分红金,抢券,提现 @@ -19,6 +19,9 @@ https://raw.githubusercontent.com/leafxcy/JavaScript/main/shangtuo.jpg 脚本默认红包余额满0.5自动提现,可以自己新建一个环境变量 stCash 设定红包余额提现金额,export stCash=20 !!!但是不建议提现20块以下,因为手续费高,只有0.5手续费低!!! +脚本会自动把红包余额转换为消费余额来抢更高面额的券,如果不想换的自己建一个环境变量 stExchange 设为0,export stExchange=0 +青龙环境下会有推送,不想要推送的建一个环境变量 stNotify 设为0,export stNotify=0 + CK有效期较短,可能几天后需要重新捉 只测试了IOS,测试过V2P,青龙可以跑 @@ -56,6 +59,8 @@ let userNum = 0 let userInfo = "" var packWithdrawAmount = ($.isNode() ? (process.env.stCash) : ($.getval('stCash'))) || 0.5; +var autoExchange = ($.isNode() ? (process.env.stExchange) : ($.getval('stExchange'))) || 1; +var nodeNotify = ($.isNode() ? (process.env.stNotify) : ($.getval('stNotify'))) || 1; let secretCode @@ -65,6 +70,9 @@ let grabCount let getBondListFlag let quanList +let retryLimit = 5 +let retryTime + let logDebug = 0 let logCaller = 0 @@ -95,8 +103,12 @@ const notify = $.isNode() ? require('./sendNotify') : ''; if(accountStatus) { //看广告得分红金 + retryTime = 0 + compTaskFlag = 1 await getAdvertPage(1); await $.wait(1000); + await getAdvertPage(2); + await $.wait(1000); //提取分红金 await changeDividendBonusToBalance(); @@ -146,7 +158,7 @@ const notify = $.isNode() ? require('./sendNotify') : ''; } $.msg(userInfo) - if($.isNode()) await notify.sendNotify($.name, userInfo) + if(nodeNotify == 1 && $.isNode()) await notify.sendNotify($.name, userInfo) } } @@ -292,6 +304,7 @@ function getUserInfoData(checkStatus,timeout = 0) { //广告列表id function getAdvertPage(pageNo,timeout = 0) { if(logCaller) console.log("call "+ printCaller()) + retryTime++ return new Promise((resolve) => { let request = { url: `https://api.shatuvip.com/advert/getAdvertPage?type=1&pageNo=${pageNo}&column_id=1`, @@ -314,6 +327,9 @@ function getAdvertPage(pageNo,timeout = 0) { if (err) { console.log("API请求失败"); console.log(err + " at function " + printCaller()); + if(retryTime < retryLimit) { + await getAdvertPage(pageNo) + } } else { if (safeGet(data)) { let result = JSON.parse(data) @@ -321,9 +337,7 @@ function getAdvertPage(pageNo,timeout = 0) { if (result.code == 0) { console.log(`获取分红金广告任务列表成功`) adNum = result.result.length - compTaskFlag = 1 for(let i=0; i= 88) { console.log(`\n分红金余额:${result.result.balance},开始尝试提现`) + retryTime = 0 await getBalanceWithdrawalData(0,result.result.balance) } else { console.log(`\n分红金余额:${result.result.balance},不执行提现`) @@ -1096,6 +1111,7 @@ function getPopularizeBalance(timeout = 0) { await $.wait(1000); if(result.result.balance >= 1) { console.log(`\n推广余额:${result.result.balance},开始尝试提现`) + retryTime = 0 await getBalanceWithdrawalData(2,result.result.balance) } else { console.log(`\n推广余额:${result.result.balance},不执行提现`) @@ -1147,12 +1163,20 @@ function getPackBalance(move,timeout = 0) { if(result.code == 0) { await $.wait(1000); if(move == 0) { - if(result.result.balance > 0) { - console.log(``) - await balancePackChangeBalance(result.result.balance) + if(autoExchange >0) { + console.log(`\n您当前设置为自动转换消费余额,当前红包余额${result.result.balance}`) + if(result.result.balance > 0.5) { + let exchangeAmount = Math.floor((result.result.balance-0.5)*100) / 100 + await balancePackChangeBalance(exchangeAmount) + } else { + console.log(`\n红包余额${result.result.balance},少于0.5,不转换消费余额`) + } + } else { + console.log(`\n您当前设置为不转换消费余额`) } } else { if(result.result.balance >= packWithdrawAmount) { + retryTime = 0 console.log(`\n红包余额${result.result.balance},尝试为你提现${packWithdrawAmount}`) await getBalanceWithdrawalData(1,result.result.balance,packWithdrawAmount) } else { @@ -1341,6 +1365,7 @@ function queryWithdrawId(id,balance,timeout = 0) { //提现 function balanceWithdrawal(id,withdrawMoney,timeout = 0) { if(logCaller) console.log("call "+ printCaller()) + retryTime++ return new Promise((resolve, reject) => { let request = { url: `https://api.shatuvip.com/withdrawal/balanceWithdrawal`, @@ -1364,6 +1389,9 @@ function balanceWithdrawal(id,withdrawMoney,timeout = 0) { if (err) { console.log("API请求失败"); console.log(err + " at function " + printCaller()); + if(retryTime < retryLimit) { + await balanceWithdrawal(id,withdrawMoney) + } } else { if (safeGet(data)) { await $.wait(1000); diff --git a/blackUnique.jpg b/blackUnique.jpg new file mode 100644 index 0000000..cb29696 Binary files /dev/null and b/blackUnique.jpg differ diff --git a/blackUnique.js b/blackUnique.js new file mode 100644 index 0000000..54e0e08 --- /dev/null +++ b/blackUnique.js @@ -0,0 +1,1652 @@ +/* +APP:全球购骑士特权 + +直接appstore搜索下载,方便的话可以微信扫下面图片二维码走邀请注册,谢谢 +https://raw.githubusercontent.com/leafxcy/JavaScript/main/blackUnique.jpg + +定时为每小时一次,务必在0分到5分之间运行,目前每天大概1毛7 +提现需要关注微信公众号,在公众号里申请提现 +请手动点一下签到页面的【收零花钱】领一次金币,去【果园】里选择水果种子 + +青龙: +捉https://market.chuxingyouhui.com/promo-bargain-api/activity/mqq/api/indexTopInfo的包 +然后填在blackJSON里面,注意按照JSON格式填写。用青龙面板的环境变量或者外面用双引号的,字符串内需要用\"转义 +export blackJSON='{"black-token":"", "token":"", "User-Agent":"", "appId":""}' + +V2P,圈X:重写方法 -- 点击右下角【我的】-> 【每日签到赚现金】 +[task_local] +#全球购骑士特权 +0 * * * * https://raw.githubusercontent.com/leafxcy/JavaScript/main/blackUnique.js, tag=全球购骑士特权, enabled=true +[rewrite_local] +https://market.chuxingyouhui.com/promo-bargain-api/activity/mqq/api/indexTopInfo? url script-request-header https://raw.githubusercontent.com/leafxcy/JavaScript/main/blackUnique.js +[MITM] +hostname = market.chuxingyouhui.com + +*/ + +const jsname = '全球购骑士特权' +const $ = Env(jsname) +const notifyFlag = 1; //0为关闭通知,1为打开通知,默认为1 +const logDebug = 0 + +//const notify = $.isNode() ? require('./sendNotify') : ''; +let notifyStr = '' + +let blackJSON = ($.isNode() ? (process.env.blackJSON) : ($.getval('blackJSON'))) || '' +let blackArr = [] + +let userIdx = 0 +let reqTime = '' +let userSign = '' +let redPacketId = '' +let fruitId = '' +let userFruitId = '' +let activityId = '' +let redPacketCount = 0 +let waterCount = 0 +let fertilizerCount = 0 +let clickTreeTimes = 1 +let signRetryTimes = 3 +let signRetryCount = 0 + +var todayDate = formatDateTime(new Date()); +let bussinessInfo = '{}' + +let rndtime = "" //毫秒 + +/////////////////////////////////////////////////////////////////// + +!(async () => { + + if(typeof $request !== "undefined") + { + await getRewrite() + } + else + { + //检查环境变量 + if(!(await checkEnv())){ + return + } + + console.log('\n提现需要关注微信公众号,在公众号里申请提现') + + for(userIdx=0; userIdx $.logErr(e)) +.finally(() => $.done()) + +//通知 +async function showmsg() { + + notifyBody = jsname + "运行通知\n\n" + notifyStr + + if (notifyFlag != 1) { + console.log(notifyBody); + } + + if (notifyFlag == 1) { + $.msg(notifyBody); + //if ($.isNode()){await notify.sendNotify($.name, notifyBody );} + } +} + +async function getRewrite() +{ + if($request.url.indexOf("mqq/api/indexTopInfo?appId=") > -1) { + let blackCk = {"black-token":"", "token":"", "User-Agent":"", "appId":""} + let msgStr = '' + + let matchItem = $request.url.match(/appId=([\w]+)/) + blackCk['appId'] = matchItem[1] + msgStr += `获取到appId: ${blackCk['appId']}\n` + + blackCk['black-token'] = $request.headers['black-token'] + msgStr += `获取到black-token: ${blackCk['black-token']}\n` + + blackCk['token'] = $request.headers['token'] + msgStr += `获取到token: ${blackCk['token']}\n` + + blackCk['User-Agent'] = $request.headers['User-Agent'] + msgStr += `获取到User-Agent: ${blackCk['User-Agent']}\n` + + if(blackCk['black-token']) { + if(blackJSON) { + if(blackJSON.indexOf(blackCk['black-token']) == -1) { + blackJSON = blackJSON + '@' + JSON.stringify(blackCk) + numUser = blackJSON.split('@') + msgStr = `获取到第${numUser.length}个账户ck\n` + msgStr + $.setdata(blackJSON,'blackJSON') + $.msg(msgStr) + } else { + $.log('检测到重复的账户ck') + } + } else { + msgStr = `获取到第一个账户ck\n` + msgStr + $.setdata(JSON.stringify(blackCk),'blackJSON') + $.msg(msgStr) + } + } + } +} + +async function checkEnv() +{ + if(blackJSON) { + for(let users of blackJSON.split('@')) { + blackArr.push(JSON.parse(users)) + } + } else { + console.log('未找到blackJSON') + return false + } + + if(blackArr.length == 0) { + console.log('未找到有效的blackJSON') + return false + } + + console.log(`共找到${blackArr.length}个用户`) + return true +} + +//========================================================================== +//获取视频信息 +async function getBussinessInfo(adId,activityType,bussinessType,version) { + let caller = printCaller() + //rndtime = Math.round(new Date().getTime()) + reqBody = `{"adId":"${adId}","activityType":${activityType},"bussinessType":"${bussinessType}","version":"${version}"}` + encodeBody = encodeURIComponent(reqBody) + return new Promise((resolve) => { + let url = { + url: 'https://market.chuxingyouhui.com/promo-bargain-api/video/api/v1_0/getBussinessInfo', + headers: { + 'Host' : 'market.chuxingyouhui.com', + 'request-body' : encodeBody, + 'Accept' : 'application/json, text/plain, */*', + 'Accept-Language' : 'zh-CN,zh-Hans;q=0.9', + 'Accept-Encoding' : 'gzip, deflate, br', + 'token' : blackArr[userIdx]['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackArr[userIdx]['User-Agent'], + 'black-token' : blackArr[userIdx]['black-token'], + 'Referer' : 'https://m.black-unique.com/', + 'Connection' : 'keep-alive', + }, + body: reqBody + }; + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log("Fucntion " + caller + ": API请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + let result = JSON.parse(data); + if(logDebug) console.log(result); + if(result.code == 200) { + bussinessInfo = result.data ? JSON.stringify(result.data) : '{}' + } else { + console.log(`获取视频信息失败:${result.msg}`) + } + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +//获取签到状态 +async function querySignStatus() { + let caller = printCaller() + //rndtime = Math.round(new Date().getTime()) + return new Promise((resolve) => { + let url = { + url: 'https://market.chuxingyouhui.com/promo-bargain-api/activity/weekSign/api/v1_0/calendar?appId='+blackArr[userIdx]['appId'], + headers: { + 'Host' : 'market.chuxingyouhui.com', + 'Origin' : 'https://m.black-unique.com', + 'Accept-Encoding' : 'gzip, deflate, br', + 'Connection' : 'keep-alive', + 'black-token' : blackArr[userIdx]['black-token'], + 'Accept' : 'application/json, text/plain, */*', + 'User-Agent' : blackArr[userIdx]['User-Agent'], + 'Referer' : 'https://m.black-unique.com/', + 'token' : blackArr[userIdx]['token'], + 'Accept-Language' : 'zh-CN,zh-Hans;q=0.9', + }, + }; + $.get(url, async (err, resp, data) => { + try { + if (err) { + console.log("Fucntion " + caller + ": API请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + let result = JSON.parse(data); + if(logDebug) console.log(result); + if(result.code == 200) { + if(result.data && result.data.calendar && Array.isArray(result.data.calendar)) { + for(let i=0; i< result.data.calendar.length; i++) { + let signItem = result.data.calendar[i] + if(signItem.isToday == true) { + if(signItem.signStyle == 0) { + await doSign() + } else { + console.log(`\n今日已签到\n`) + } + } + } + } + } else { + console.log(`\n获取签到状态失败:${result.msg}\n`) + } + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +//签到 +async function doSign() { + let caller = printCaller() + //rndtime = Math.round(new Date().getTime()) + reqBody = `{}` + encodeBody = encodeURIComponent(reqBody) + return new Promise((resolve) => { + let url = { + url: 'https://market.chuxingyouhui.com/promo-bargain-api/activity/weekSign/api/v1_0/sign?appId='+blackArr[userIdx]['appId'], + headers: { + 'Host' : 'market.chuxingyouhui.com', + 'request-body' : encodeBody, + 'Accept' : 'application/json, text/plain, */*', + 'Accept-Language' : 'zh-CN,zh-Hans;q=0.9', + 'Accept-Encoding' : 'gzip, deflate, br', + 'token' : blackArr[userIdx]['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackArr[userIdx]['User-Agent'], + 'black-token' : blackArr[userIdx]['black-token'], + 'Referer' : 'https://m.black-unique.com/', + 'Connection' : 'keep-alive', + }, + body: reqBody + }; + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log("Fucntion " + caller + ": API请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + let result = JSON.parse(data); + if(logDebug) console.log(result); + if(result.code == 200) { + console.log(`\n签到成功获得:${result.data.reward}金币,已连续签到${result.data.continuouslyDay}天\n`) + } else { + console.log(`\n签到失败:${result.msg}\n`) + } + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +//日常-任务列表 +async function listUserTask() { + let caller = printCaller() + rndtime = Math.round(new Date().getTime()) + reqBody = `{"activityType":13}` + encodeBody = encodeURIComponent(reqBody) + return new Promise((resolve) => { + let url = { + url: 'https://market.chuxingyouhui.com/promo-bargain-api/activity/task/api/list_user_task', + headers: { + 'Host' : 'market.chuxingyouhui.com', + 'request-body' : encodeBody, + 'Accept' : 'application/json, text/plain, */*', + 'Accept-Language' : 'zh-CN,zh-Hans;q=0.9', + 'Accept-Encoding' : 'gzip, deflate, br', + 'token' : blackArr[userIdx]['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackArr[userIdx]['User-Agent'], + 'black-token' : blackArr[userIdx]['black-token'], + 'Referer' : 'https://m.black-unique.com/', + 'Connection' : 'keep-alive', + }, + body: reqBody + }; + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log("Fucntion " + caller + ": API请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + let result = JSON.parse(data); + if(logDebug) console.log(result); + if(result.code == 200) { + if(result.data && Array.isArray(result.data)) { + for(let i=0; i -1 && (rndtime < taskItem.receiveStartTime || rndtime > taskItem.receiveEndTime)) { + //非整点领勋章时间 + continue + } else if(taskItem.taskType.indexOf('SHOPPING') > -1) { + //跳过购物任务 + continue + } + await $.wait(1000) + await doTask(taskItem.taskType,taskItem.userTaskId,taskItem.taskTitle) + } + + } + } + } else { + console.log(`查询任务列表失败:${result.msg}`) + } + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +//日常-完成任务 +async function doTask(taskType,userTaskId,taskTitle) { + let caller = printCaller() + //rndtime = Math.round(new Date().getTime()) + reqBody = `{"activityType":13,"taskType":"${taskType}","userTaskId":"${userTaskId}"}` + encodeBody = encodeURIComponent(reqBody) + return new Promise((resolve) => { + let url = { + url: 'https://market.chuxingyouhui.com/promo-bargain-api/activity/task/api/doTask', + headers: { + 'Host' : 'market.chuxingyouhui.com', + 'request-body' : encodeBody, + 'Accept' : 'application/json, text/plain, */*', + 'Accept-Language' : 'zh-CN,zh-Hans;q=0.9', + 'Accept-Encoding' : 'gzip, deflate, br', + 'token' : blackArr[userIdx]['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackArr[userIdx]['User-Agent'], + 'black-token' : blackArr[userIdx]['black-token'], + 'Referer' : 'https://m.black-unique.com/', + 'Connection' : 'keep-alive', + }, + body: reqBody + }; + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log("Fucntion " + caller + ": API请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + let result = JSON.parse(data); + if(logDebug) console.log(result); + if(result.code == 200) { + console.log(`完成任务【${result.data.taskTitle}】:获得${result.data.rewardScore}勋章`) + } else { + console.log(`完成任务【${taskTitle}】失败:${result.msg}`) + } + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +//存钱罐状态 +async function queryPiggyInfo() { + let caller = printCaller() + //rndtime = Math.round(new Date().getTime()) + return new Promise((resolve) => { + let url = { + url: 'https://market.chuxingyouhui.com/promo-bargain-api/activity/golden/api/queryUserAccountInfo?appId='+blackArr[userIdx]['appId'], + headers: { + 'Host' : 'market.chuxingyouhui.com', + 'Origin' : 'https://m.black-unique.com', + 'Accept-Encoding' : 'gzip, deflate, br', + 'Connection' : 'keep-alive', + 'black-token' : blackArr[userIdx]['black-token'], + 'Accept' : 'application/json, text/plain, */*', + 'User-Agent' : blackArr[userIdx]['User-Agent'], + 'Referer' : 'https://m.black-unique.com/', + 'token' : blackArr[userIdx]['token'], + 'Accept-Language' : 'zh-CN,zh-Hans;q=0.9', + }, + }; + $.get(url, async (err, resp, data) => { + try { + if (err) { + console.log("Fucntion " + caller + ": API请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + let result = JSON.parse(data); + if(logDebug) console.log(result); + if(result.code == 200) { + if(parseFloat(result.data.goldenAmount) < parseFloat(result.data.dayCeil)) { + if(parseFloat(result.data.piggyAmount) >= 1) { + await getBussinessInfo(946088114,7,'GOLDEN_CLICK','v3') + await clickPiggy() + } + } else { + console.log(`\n存钱罐提取已达到当天上限:${result.data.dayCeil}\n`) + } + } else { + console.log(`\n查询存钱罐状态失败:${result.msg}\n`) + } + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +//提取存钱罐金币 +async function clickPiggy() { + let caller = printCaller() + //rndtime = Math.round(new Date().getTime()) + reqBody = `{"appId":"${blackArr[userIdx]['appId']}","extraReq":${bussinessInfo}}` + encodeBody = encodeURIComponent(reqBody) + return new Promise((resolve) => { + let url = { + url: 'https://market.chuxingyouhui.com/promo-bargain-api/activity/golden/api/v1_0/click', + headers: { + 'Host' : 'market.chuxingyouhui.com', + 'request-body' : encodeBody, + 'Accept' : 'application/json, text/plain, */*', + 'Accept-Language' : 'zh-CN,zh-Hans;q=0.9', + 'Accept-Encoding' : 'gzip, deflate, br', + 'token' : blackArr[userIdx]['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackArr[userIdx]['User-Agent'], + 'black-token' : blackArr[userIdx]['black-token'], + 'Referer' : 'https://m.black-unique.com/', + 'Connection' : 'keep-alive', + }, + body: reqBody + }; + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log("Fucntion " + caller + ": API请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + let result = JSON.parse(data); + if(logDebug) console.log(result); + if(result.code == 200) { + console.log(`\n提取存钱罐金币成功,金币余额${result.data.goldenAmount}\n`) + } else { + console.log(`\n提取存钱罐金币失败:${result.msg}\n`) + } + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +//查询翻牌领提现额度 +async function getUserFlopRecord() { + let caller = printCaller() + //rndtime = Math.round(new Date().getTime()) + reqBody = `{"appId":"${blackArr[userIdx]['appId']}","queryDay":"${todayDate}"}` + encodeBody = encodeURIComponent(reqBody) + return new Promise((resolve) => { + let url = { + url: 'https://market.chuxingyouhui.com/promo-bargain-api/activity/flop/api/getUserFlopRecord', + headers: { + 'Host' : 'market.chuxingyouhui.com', + 'request-body' : encodeBody, + 'Accept' : 'application/json, text/plain, */*', + 'Accept-Language' : 'zh-CN,zh-Hans;q=0.9', + 'Accept-Encoding' : 'gzip, deflate, br', + 'token' : blackArr[userIdx]['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackArr[userIdx]['User-Agent'], + 'black-token' : blackArr[userIdx]['black-token'], + 'Referer' : 'https://m.black-unique.com/', + 'Connection' : 'keep-alive', + }, + body: reqBody + }; + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log("Fucntion " + caller + ": API请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + let result = JSON.parse(data); + if(logDebug) console.log(result); + if(result.code == 200) { + if(result.data && result.data.recordList && Array.isArray(result.data.recordList)) { + for (let i=0; i { + let url = { + url: 'https://market.chuxingyouhui.com/promo-bargain-api/activity/flop/api/flop', + headers: { + 'Host' : 'market.chuxingyouhui.com', + 'request-body' : encodeBody, + 'Accept' : 'application/json, text/plain, */*', + 'Accept-Language' : 'zh-CN,zh-Hans;q=0.9', + 'Accept-Encoding' : 'gzip, deflate, br', + 'token' : blackArr[userIdx]['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackArr[userIdx]['User-Agent'], + 'black-token' : blackArr[userIdx]['black-token'], + 'Referer' : 'https://m.black-unique.com/', + 'Connection' : 'keep-alive', + }, + body: reqBody + }; + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log("Fucntion " + caller + ": API请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + let result = JSON.parse(data); + if(logDebug) console.log(result); + if(result.code == 200) { + console.log(`翻牌获得提现额度:${result.data.amount}元`) + } else { + console.log(`翻牌获得提现额度失败:${result.msg}`) + } + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +//定点红包列表 +async function listRedPacket() { + let caller = printCaller() + //rndtime = Math.round(new Date().getTime()) + curTime = new Date() + currentHour = curTime.getHours() + let isGetRedTime = ((currentHour < 23) && (currentHour > 6)) ? 1 : 0 + return new Promise((resolve) => { + let url = { + url: 'https://fanxian-api.chuxingyouhui.com/api/redPacketIncome/v1_0/listRedPacket', + headers: { + 'Host' : 'fanxian-api.chuxingyouhui.com', + 'Accept-Language' : 'zh-CN,zh-Hans;q=0.9', + 'newcomer' : 'true', + 'Accept-Encoding' : 'gzip, deflate, br', + 'token' : blackArr[userIdx]['token'], + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackArr[userIdx]['User-Agent'], + 'Referer' : 'https://m.black-unique.com/', + 'Content-Length' : '0', + 'Connection' : 'keep-alive', + 'Accept' : 'application/json, text/plain, */*', + }, + }; + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log("Fucntion " + caller + ": API请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + let result = JSON.parse(data); + if(logDebug) console.log(result); + if(result.code == 200) { + if(isGetRedTime == 1 && result.data && result.data.redPacketList && Array.isArray(result.data.redPacketList)) { + redPacketCount = 0 + for(let i=0; i 0) { + redPacketCount++ + } + if(redItem.status == 2 && redItem.money == 0 && redPacketCount < 7) { + signRetryCount = 0 + await getSignInfo('open') + await $.wait(500) + await openRedPacket() + } + } + } + } else { + console.log(`查询红包列表失败:${result.msg}`) + } + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +//开定点红包 +async function openRedPacket() { + let caller = printCaller() + //rndtime = Math.round(new Date().getTime()/1000) + return new Promise((resolve) => { + let url = { + url: 'https://pyp-api.chuxingyouhui.com/api/knightCard/redPacket/v1_0/openRedPacket', + headers: { + 'Host' : 'pyp-api.chuxingyouhui.com', + 'Accept' : 'application/json, text/plain, */*', + 'ymd' : '0', + 'newcomer' : 'true', + 'token' : blackArr[userIdx]['token'], + 'Accept-Language' : 'zh-CN,zh-Hans;q=0.9', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackArr[userIdx]['User-Agent'], + 'Referer' : 'https://m.black-unique.com/', + 'Accept-Encoding' : 'gzip, deflate, br', + 'Connection' : 'keep-alive', + 'Content-Type' : 'application/json;charset=utf-8', + }, + body: `{"click":false,"sign":"${userSign}","ts":"${reqTime}"}` + }; + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log("Fucntion " + caller + ": API请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + let result = JSON.parse(data); + if(logDebug) console.log(result); + if(result.code == 200) { + console.log(`打开红包获得:${result.data.money}现金`) + signRetryCount = 0 + await getSignInfo('boom') + await $.wait(2000) + await boomRedPacket() + } else { + console.log(`打开红包失败:${result.msg}`) + } + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +//定点红包翻倍 +async function boomRedPacket() { + let caller = printCaller() + //rndtime = Math.round(new Date().getTime()/1000) + return new Promise((resolve) => { + let url = { + url: 'https://fanxian-api.chuxingyouhui.com/api/redPacket/increase/v1_0/boom', + headers: { + 'Host' : 'fanxian-api.chuxingyouhui.com', + 'Accept' : 'application/json, text/plain, */*', + 'Accept-Language' : 'zh-CN,zh-Hans;q=0.9', + 'token' : blackArr[userIdx]['token'], + 'Accept-Encoding' : 'gzip, deflate, br', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackArr[userIdx]['User-Agent'], + 'Referer' : 'https://m.black-unique.com/', + 'Connection' : 'keep-alive', + 'Content-Type' : 'application/json;charset=utf-8', + }, + body: `{"redPacketId":"${redPacketId}","sign":"${userSign}","ts":"${reqTime}"}`, + }; + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log("Fucntion " + caller + ": API请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + let result = JSON.parse(data); + if(logDebug) console.log(result); + if(result.code == 200) { + console.log(`红包翻倍获得:${result.data.redPacketIncreaseAmount}现金`) + } else { + console.log(`红包翻倍失败:${result.msg}`) + } + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +//果园状态 +async function userFruitDetail() { + let caller = printCaller() + //rndtime = Math.round(new Date().getTime()/1000) + reqBody = `{"appId":"${blackArr[userIdx]['appId']}","isMiniProgram":false}` + encodeBody = encodeURIComponent(reqBody) + return new Promise((resolve) => { + let url = { + url: 'https://market.chuxingyouhui.com/promo-bargain-api/garden/api/v1_0/userFruitDetail', + headers: { + 'Host' : 'market.chuxingyouhui.com', + 'request-body' : encodeBody, + 'Accept' : 'application/json, text/plain, */*', + 'Accept-Language' : 'zh-CN,zh-Hans;q=0.9', + 'Accept-Encoding' : 'gzip, deflate, br', + 'token' : blackArr[userIdx]['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackArr[userIdx]['User-Agent'], + 'black-token' : blackArr[userIdx]['black-token'], + 'Connection' : 'keep-alive', + }, + body: reqBody, + }; + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log("Fucntion " + caller + ": API请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + let result = JSON.parse(data); + if(logDebug) console.log(result); + if(result.code == 200) { + console.log(`你现在种的水果是 ${result.data.fruitName} ${result.data.specification},${result.data.progressWord}`) + console.log(`今天已浇水${result.data.wateredTimes}次,剩余水滴数量:${result.data.remainAmount}`) + fruitId = result.data.fruitId + userFruitId = result.data.userFruitId + activityId = result.data.activityId + if(result.data.canReceiveStatus == 1 && result.data.canReceiveAmount > 0) { + await receiveWaterDrop('TOMORROW_REWARD','null','每日水滴') + } + if(result.data.gardenStageRewardResp && result.data.gardenStageRewardResp.status == 1) { + await fruitStageReward() + } + if(result.data.remainAmount >= 10) { + waterCount = 0 + console.log(`开始浇水,请等候......`) + await wateringFruit() + console.log(`浇水结束,本次共浇水${waterCount}次`) + } + } else { + console.log(`查询果园状态失败:${result.msg}`) + } + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +//果园水果进度奖励 +async function fruitStageReward() { + let caller = printCaller() + //rndtime = Math.round(new Date().getTime()/1000) + reqBody = `{"userFruitId":"${userFruitId}","appId":"${blackArr[userIdx]['appId']}"}` + encodeBody = encodeURIComponent(reqBody) + return new Promise((resolve) => { + let url = { + url: 'https://market.chuxingyouhui.com/promo-bargain-api/garden/api/v1_0/receiveStageReward', + headers: { + 'Host' : 'market.chuxingyouhui.com', + 'request-body' : encodeBody, + 'Accept' : 'application/json, text/plain, */*', + 'Accept-Language' : 'zh-CN,zh-Hans;q=0.9', + 'Accept-Encoding' : 'gzip, deflate, br', + 'token' : blackArr[userIdx]['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackArr[userIdx]['User-Agent'], + 'black-token' : blackArr[userIdx]['black-token'], + 'Connection' : 'keep-alive', + }, + body: reqBody, + }; + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log("Fucntion " + caller + ": API请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + let result = JSON.parse(data); + if(logDebug) console.log(result); + if(result.code == 200) { + console.log(`领取水果进度奖励:${result.data.rewardNum}水滴`) + } else { + console.log(`领取水果进度奖励失败:${result.msg}`) + } + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +//果园浇水 +async function wateringFruit() { + let caller = printCaller() + //rndtime = Math.round(new Date().getTime()/1000) + reqBody = `{"userFruitId":"${userFruitId}"}` + encodeBody = encodeURIComponent(reqBody) + return new Promise((resolve) => { + let url = { + url: 'https://market.chuxingyouhui.com/promo-bargain-api/garden/api/v1_0/watering', + headers: { + 'Host' : 'market.chuxingyouhui.com', + 'request-body' : encodeBody, + 'Accept' : 'application/json, text/plain, */*', + 'Accept-Language' : 'zh-CN,zh-Hans;q=0.9', + 'Accept-Encoding' : 'gzip, deflate, br', + 'token' : blackArr[userIdx]['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackArr[userIdx]['User-Agent'], + 'black-token' : blackArr[userIdx]['black-token'], + 'Connection' : 'keep-alive', + }, + body: reqBody, + }; + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log("Fucntion " + caller + ": API请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + let result = JSON.parse(data); + if(logDebug) console.log(result); + if(result.code == 200) { + if(result.data.level && !result.data.remindType) { + if(result.data.upgrade == true) { + console.log(`果树升级到 ${result.data.level} 获得:${result.data.upgradeReward}水滴`) + } + waterCount++ + await $.wait(500) + await wateringFruit() + } + } else { + console.log(`浇水失败:${result.msg}`) + } + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +//果园水滴任务 +async function waterTaskList() { + let caller = printCaller() + //rndtime = Math.round(new Date().getTime()/1000) + reqBody = `{"activityId":"${activityId}","userFruitId":"${userFruitId}","clientType":1}` + encodeBody = encodeURIComponent(reqBody) + return new Promise((resolve) => { + let url = { + url: 'https://market.chuxingyouhui.com/promo-bargain-api/garden/api/v1_0/userTaskList', + headers: { + 'Host' : 'market.chuxingyouhui.com', + 'request-body' : encodeBody, + 'Accept' : 'application/json, text/plain, */*', + 'Accept-Language' : 'zh-CN,zh-Hans;q=0.9', + 'Accept-Encoding' : 'gzip, deflate, br', + 'token' : blackArr[userIdx]['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackArr[userIdx]['User-Agent'], + 'black-token' : blackArr[userIdx]['black-token'], + 'Connection' : 'keep-alive', + }, + body: reqBody, + }; + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log("Fucntion " + caller + ": API请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + let result = JSON.parse(data); + if(logDebug) console.log(result); + if(result.code == 200) { + if(result.data && result.data.taskList && Array.isArray(result.data.taskList)) { + for(let i=0; i -1 || + taskItem.taskType.indexOf('WATCH_VIDEO') > -1 || + taskItem.taskType.indexOf('APP_LOGIN') > -1) { + if(taskItem.status == 0) { + await doWaterTask(taskItem.taskType,taskItem.taskId,taskItem.title) + } else if(taskItem.status == 1) { + await receiveWaterDrop(taskItem.taskType,taskItem.userTaskId,taskItem.title) + } + } else if(taskItem.taskType.indexOf('EVERY_DAY_WATERING_REWARD') > -1 || + taskItem.taskType.indexOf('OPEN_CHEST') > -1) { + if(taskItem.status == 1) { + await receiveWaterDrop(taskItem.taskType,taskItem.userTaskId,taskItem.title) + } + } else { + if(taskItem.status == 0) { + await receiveWaterDrop(taskItem.taskType,taskItem.userTaskId,taskItem.title) + } + } + } + } + } else { + console.log(`获取果园水滴任务失败:${result.msg}`) + } + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +//果园-完成水滴任务 +async function doWaterTask(taskType,taskId,taskTitle) { + let caller = printCaller() + //rndtime = Math.round(new Date().getTime()) + reqBody = `{"userFruitId":"${userFruitId}","taskType":"${taskType}","taskId":"${taskId}"}` + encodeBody = encodeURIComponent(reqBody) + return new Promise((resolve) => { + let url = { + url: 'https://market.chuxingyouhui.com/promo-bargain-api/garden/api/v1_0/doTask', + headers: { + 'Host' : 'market.chuxingyouhui.com', + 'request-body' : encodeBody, + 'Accept' : 'application/json, text/plain, */*', + 'Accept-Language' : 'zh-CN,zh-Hans;q=0.9', + 'Accept-Encoding' : 'gzip, deflate, br', + 'token' : blackArr[userIdx]['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackArr[userIdx]['User-Agent'], + 'black-token' : blackArr[userIdx]['black-token'], + 'Referer' : 'https://m.black-unique.com/', + 'Connection' : 'keep-alive', + }, + body: reqBody + }; + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log("Fucntion " + caller + ": API请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + let result = JSON.parse(data); + if(logDebug) console.log(result); + if(result.code == 200) { + console.log(`完成水滴任务【${taskTitle}】成功`) + } else { + console.log(`完成水滴任务【${taskTitle}】失败:${result.msg}`) + } + await $.wait(1000) + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +//果园-领取水滴 +async function receiveWaterDrop(taskType,userTaskId,taskTitle) { + let caller = printCaller() + //rndtime = Math.round(new Date().getTime()) + reqBody = `{"userFruitId":"${userFruitId}","taskType":"${taskType}","userTaskId":${userTaskId}}` + encodeBody = encodeURIComponent(reqBody) + return new Promise((resolve) => { + let url = { + url: 'https://market.chuxingyouhui.com/promo-bargain-api/garden/api/v1_0/receiveWaterDrop', + headers: { + 'Host' : 'market.chuxingyouhui.com', + 'request-body' : encodeBody, + 'Accept' : 'application/json, text/plain, */*', + 'Accept-Language' : 'zh-CN,zh-Hans;q=0.9', + 'Accept-Encoding' : 'gzip, deflate, br', + 'token' : blackArr[userIdx]['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackArr[userIdx]['User-Agent'], + 'black-token' : blackArr[userIdx]['black-token'], + 'Referer' : 'https://m.black-unique.com/', + 'Connection' : 'keep-alive', + }, + body: reqBody + }; + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log("Fucntion " + caller + ": API请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + let result = JSON.parse(data); + if(logDebug) console.log(result); + if(result.code == 200) { + console.log(`领取水滴任务【${taskTitle}】奖励:${result.data.reward}水滴`) + } else { + console.log(`领取水滴任务【${taskTitle}】奖励失败:${result.msg}`) + } + await $.wait(1000) + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +//果园肥料任务 +async function nutrientTaskList() { + let caller = printCaller() + //rndtime = Math.round(new Date().getTime()/1000) + reqBody = `{"activityId":"${activityId}","userFruitId":"${userFruitId}"}` + encodeBody = encodeURIComponent(reqBody) + return new Promise((resolve) => { + let url = { + url: 'https://market.chuxingyouhui.com/promo-bargain-api/garden/api/v1_0/getUserNutrientTaskList', + headers: { + 'Host' : 'market.chuxingyouhui.com', + 'request-body' : encodeBody, + 'Accept' : 'application/json, text/plain, */*', + 'Accept-Language' : 'zh-CN,zh-Hans;q=0.9', + 'Accept-Encoding' : 'gzip, deflate, br', + 'token' : blackArr[userIdx]['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackArr[userIdx]['User-Agent'], + 'black-token' : blackArr[userIdx]['black-token'], + 'Connection' : 'keep-alive', + }, + body: reqBody, + }; + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log("Fucntion " + caller + ": API请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + let result = JSON.parse(data); + if(logDebug) console.log(result); + if(result.code == 200) { + if(result.data && result.data.gardenFertilizerTaskDtoList && Array.isArray(result.data.gardenFertilizerTaskDtoList)) { + for(let i=0; i { + let url = { + url: 'https://market.chuxingyouhui.com/promo-bargain-api/garden/api/v1_0/doTaskForNutrient', + headers: { + 'Host' : 'market.chuxingyouhui.com', + 'request-body' : encodeBody, + 'Accept' : 'application/json, text/plain, */*', + 'Accept-Language' : 'zh-CN,zh-Hans;q=0.9', + 'Accept-Encoding' : 'gzip, deflate, br', + 'token' : blackArr[userIdx]['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackArr[userIdx]['User-Agent'], + 'black-token' : blackArr[userIdx]['black-token'], + 'Referer' : 'https://m.black-unique.com/', + 'Connection' : 'keep-alive', + }, + body: reqBody + }; + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log("Fucntion " + caller + ": API请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + let result = JSON.parse(data); + if(logDebug) console.log(result); + if(result.code == 200) { + console.log(`完成肥料任务【${taskTitle}】成功`) + } else { + console.log(`完成肥料任务【${taskTitle}】失败:${result.msg}`) + } + await $.wait(1000) + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +//果园肥料状态 +async function userFertilizerDetail(taskType,taskId,taskTitle) { + let caller = printCaller() + //rndtime = Math.round(new Date().getTime()) + reqBody = `{"activityId":"${activityId}","userFruitId":"${userFruitId}"}` + encodeBody = encodeURIComponent(reqBody) + return new Promise((resolve) => { + let url = { + url: 'https://market.chuxingyouhui.com/promo-bargain-api/garden/api/v1_0/getUserFertilizerTool', + headers: { + 'Host' : 'market.chuxingyouhui.com', + 'request-body' : encodeBody, + 'Accept' : 'application/json, text/plain, */*', + 'Accept-Language' : 'zh-CN,zh-Hans;q=0.9', + 'Accept-Encoding' : 'gzip, deflate, br', + 'token' : blackArr[userIdx]['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackArr[userIdx]['User-Agent'], + 'black-token' : blackArr[userIdx]['black-token'], + 'Referer' : 'https://m.black-unique.com/', + 'Connection' : 'keep-alive', + }, + body: reqBody + }; + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log("Fucntion " + caller + ": API请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + let result = JSON.parse(data); + if(logDebug) console.log(result); + if(result.code == 200) { + fertilizerCount = 0 + if(result.data.userSmallFertilizerTool.remainNum > 0 || result.data.userFertilizerTool.remainNum > 0) { + for(let i=0; i { + let url = { + url: 'https://market.chuxingyouhui.com/promo-bargain-api/garden/api/v1_0/useFertilizer', + headers: { + 'Host' : 'market.chuxingyouhui.com', + 'request-body' : encodeBody, + 'Accept' : 'application/json, text/plain, */*', + 'Accept-Language' : 'zh-CN,zh-Hans;q=0.9', + 'Accept-Encoding' : 'gzip, deflate, br', + 'token' : blackArr[userIdx]['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackArr[userIdx]['User-Agent'], + 'black-token' : blackArr[userIdx]['black-token'], + 'Referer' : 'https://m.black-unique.com/', + 'Connection' : 'keep-alive', + }, + body: reqBody + }; + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log("Fucntion " + caller + ": API请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + let result = JSON.parse(data); + if(logDebug) console.log(result); + if(result.code == 200) { + //施肥成功 + } else { + console.log(`施肥失败:${result.msg}`) + } + await $.wait(500) + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +//果园-摇树得优惠券 +async function getTreeCoupon() { + console.log(`\n开始摇树${clickTreeTimes}次得优惠券`) + for(let i=0; i { + let url = { + url: 'https://market.chuxingyouhui.com/promo-bargain-api/garden/api/v1_0/clickTree', + headers: { + 'Host' : 'market.chuxingyouhui.com', + 'request-body' : encodeBody, + 'Accept' : 'application/json, text/plain, */*', + 'Accept-Language' : 'zh-CN,zh-Hans;q=0.9', + 'Accept-Encoding' : 'gzip, deflate, br', + 'token' : blackArr[userIdx]['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackArr[userIdx]['User-Agent'], + 'black-token' : blackArr[userIdx]['black-token'], + 'Referer' : 'https://m.black-unique.com/', + 'Connection' : 'keep-alive', + }, + body: reqBody + }; + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log("Fucntion " + caller + ": API请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + let result = JSON.parse(data); + if(logDebug) console.log(result); + if(result.code == 200) { + await $.wait(1000) + if(result.data.hasReward == true) { + await receiveReward(result.data.rewardId,result.data.rewardName,result.data.rewardInfo) + } + } else { + console.log(`果园点击树失败:${result.msg}`) + } + await $.wait(500) + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +//果园-获得树干奖励 +async function receiveReward(rewardId,rewardName,rewardInfo) { + let caller = printCaller() + //rndtime = Math.round(new Date().getTime()) + reqBody = `{"rewardId":"${rewardId}","userFruitId":"${userFruitId}","appId":"${blackArr[userIdx]['appId']}"}` + encodeBody = encodeURIComponent(reqBody) + return new Promise((resolve) => { + let url = { + url: 'https://market.chuxingyouhui.com/promo-bargain-api/garden/api/v1_0/receiveReward', + headers: { + 'Host' : 'market.chuxingyouhui.com', + 'request-body' : encodeBody, + 'Accept' : 'application/json, text/plain, */*', + 'Accept-Language' : 'zh-CN,zh-Hans;q=0.9', + 'Accept-Encoding' : 'gzip, deflate, br', + 'token' : blackArr[userIdx]['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackArr[userIdx]['User-Agent'], + 'black-token' : blackArr[userIdx]['black-token'], + 'Referer' : 'https://m.black-unique.com/', + 'Connection' : 'keep-alive', + }, + body: reqBody + }; + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log("Fucntion " + caller + ": API请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + let result = JSON.parse(data); + if(logDebug) console.log(result); + if(result.code == 200) { + console.log(`获得优惠券:${rewardName} -- ${rewardInfo}`) + } else { + console.log(`获取优惠券失败:${result.msg}`) + } + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +//查询账户信息 +async function userInfo() { + console.log(`\n========= 账户${userIdx+1} 信息 =========`) + notifyStr += `========= 账户${userIdx+1} 信息 =========\n` + await userRebateInfo() + await userTopInfo() +} + +//查询现金余额 +async function userRebateInfo() { + let caller = printCaller() + //rndtime = Math.round(new Date().getTime()) + return new Promise((resolve) => { + let url = { + url: 'https://pyp-api.chuxingyouhui.com/api/app/userCenter/v1/info', + headers: { + 'Host' : 'pyp-api.chuxingyouhui.com', + 'Accept' : '*/*', + 'Accept-Language' : 'zh-Hans-CN;q=1', + 'token' : blackArr[userIdx]['token'], + 'User-Agent' : blackArr[userIdx]['User-Agent'], + 'black-token' : blackArr[userIdx]['black-token'], + 'Accept-Encoding' : 'gzip, deflate, br', + 'Connection' : 'keep-alive', + }, + }; + $.get(url, async (err, resp, data) => { + try { + if (err) { + console.log("Fucntion " + caller + ": API请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + let result = JSON.parse(data); + if(logDebug) console.log(result); + if(result.code == 200) { + console.log(`【骑士卡号】:${result.data.userPointsResp.cardNo}`) + notifyStr += `【骑士卡号】:${result.data.userPointsResp.cardNo}\n` + console.log(`【现金余额】:${result.data.currencyBlanceResp.commission}元`) + notifyStr += `【现金余额】:${result.data.currencyBlanceResp.commission}元\n` + } else { + console.log(`查询现金余额失败:${result.msg}`) + notifyStr += `查询现金余额失败:${result.msg}\n` + } + await $.wait(200) + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +//查询勋章余额 +async function userTopInfo() { + let caller = printCaller() + //rndtime = Math.round(new Date().getTime()) + return new Promise((resolve) => { + let url = { + url: 'https://market.chuxingyouhui.com/promo-bargain-api/activity/mqq/api/indexTopInfo?appId='+blackArr[userIdx]['appId'], + headers: { + 'Host' : 'market.chuxingyouhui.com', + 'Origin' : 'https://m.black-unique.com', + 'Accept-Encoding' : 'gzip, deflate, br', + 'Connection' : 'keep-alive', + 'black-token' : blackArr[userIdx]['black-token'], + 'Accept' : 'application/json, text/plain, */*', + 'User-Agent' : blackArr[userIdx]['User-Agent'], + 'Referer' : 'https://m.black-unique.com/', + 'token' : blackArr[userIdx]['token'], + 'Accept-Language' : 'zh-CN,zh-Hans;q=0.9', + }, + }; + $.get(url, async (err, resp, data) => { + try { + if (err) { + console.log("Fucntion " + caller + ": API请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + let result = JSON.parse(data); + if(logDebug) console.log(result); + if(result.code == 200) { + console.log(`【勋章余额】:${result.data.score} ≈ ${result.data.score/10000}元`) + notifyStr += `【勋章余额】:${result.data.score} ≈ ${result.data.score/10000}元\n` + } else { + console.log(`查询勋章余额失败:${result.msg}`) + notifyStr += `查询勋章余额失败:${result.msg}\n` + } + await $.wait(200) + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +//////////////////////////////////////////////////////////////////// +function safeGet(data) { + try { + if (typeof JSON.parse(data) == "object") { + return true; + } + } catch (e) { + console.log(e); + console.log(`服务器访问数据为空,请检查自身设备网络情况`); + return false; + } +} + +function printCaller(){ + return (new Error()).stack.split("\n")[2].trim().split(" ")[1] +} + +function formatDateTime(inputTime) { + var date = new Date(inputTime); + var y = date.getFullYear(); + var m = date.getMonth() + 1; + m = m < 10 ? ('0' + m) : m; + var d = date.getDate(); + d = d < 10 ? ('0' + d) : d; + var h = date.getHours(); + h = h < 10 ? ('0' + h) : h; + var minute = date.getMinutes(); + var second = date.getSeconds(); + minute = minute < 10 ? ('0' + minute) : minute; + second = second < 10 ? ('0' + second) : second; + return `${y}-${m}-${d}`; +}; + +function Env(t, e) { class s { constructor(t) { this.env = t } send(t, e = "GET") { t = "string" == typeof t ? { url: t } : t; let s = this.get; return "POST" === e && (s = this.post), new Promise((e, i) => { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), a = { url: `http://${h}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(a, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null } setval(t, e) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null } initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) } get(t, e = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.get(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { try { if (t.headers["set-cookie"]) { const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar } } catch (t) { this.logErr(t) } }).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) })) } post(t, e = (() => { })) { if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.post(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) }); else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: s, ...i } = t; this.got.post(s, i).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) }) } } time(t) { let e = { "M+": (new Date).getMonth() + 1, "d+": (new Date).getDate(), "H+": (new Date).getHours(), "m+": (new Date).getMinutes(), "s+": (new Date).getSeconds(), "q+": Math.floor(((new Date).getMonth() + 3) / 3), S: (new Date).getMilliseconds() }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, ((new Date).getFullYear() + "").substr(4 - RegExp.$1.length))); for (let s in e) new RegExp("(" + s + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? e[s] : ("00" + e[s]).substr(("" + e[s]).length))); return t } msg(e = t, s = "", i = "", r) { const o = t => { if (!t) return t; if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : this.isSurge() ? { url: t } : void 0; if ("object" == typeof t) { if (this.isLoon()) { let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-url"]; return { openUrl: e, mediaUrl: s } } if (this.isQuanX()) { let e = t["open-url"] || t.url || t.openUrl, s = t["media-url"] || t.mediaUrl; return { "open-url": e, "media-url": s } } if (this.isSurge()) { let e = t.url || t.openUrl || t["open-url"]; return { url: e } } } }; this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))); let h = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="]; h.push(e), s && h.push(s), i && h.push(i), console.log(h.join("\n")), this.logs = this.logs.concat(h) } log(...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) } logErr(t, e) { const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); s ? this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack) : this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t) } wait(t) { return new Promise(e => setTimeout(e, t)) } done(t = {}) { const e = (new Date).getTime(), s = (e - this.startTime) / 1e3; this.log("", `\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } }(t, e) } diff --git a/daw.js b/daw.js new file mode 100644 index 0000000..ed9e549 --- /dev/null +++ b/daw.js @@ -0,0 +1,895 @@ +/* +IOS/安卓:都爱玩 +下载注册地址,微信打开: +https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx592b7bf2a9f7f003&redirect_uri=https://v3.sdk.haowusong.com/api/auth/wechat/sharelogin&response_type=code&scope=snsapi_userinfo&state=AAABQKAW,dawbox-android#wechat_redirect + +现在需要充钱1块才能解锁分红池,自己考虑要不要充 +支持苹果和安卓双端的任务,两边账户分红币独立,理论上收益可以翻倍,每天2块多到3块的样子,不过提现次数似乎两边共用 +支持多账户,可以并发看视频广告,减少运行时间,V2P跑有时会有code=400错误信息,忽略就好 +重写捉包只需要捉其中一端的账号即可,ck通用 +脚本内置了自动提现,默认提现到微信 +在【我的】页面可以花0.1购买普通会员,马上返1元可提现。会员每日可以积分兑换0.1-0.2的红包,聊胜于无吧,建议购买 +建议每天多跑几次,池子有额度就能投进去分红 + +青龙: +捉取https://v3.sdk.haowusong.com/api/box/wallet/info的包里的token,写到环境变量dawToken里,多账户用@隔开 +export dawToken='account1@account2@account3' + +V2P重写:打开APP即可获取CK,没有的话点一下下面分红币页面,可以直接捉多账号 +[task_local] +#都爱玩 +3 1,20 * * * https://raw.githubusercontent.com/leafxcy/JavaScript/main/daw.js, tag=都爱玩, enabled=true +[rewrite_local] +https://v3.sdk.haowusong.com/api/box/wallet/info url script-request-header https://raw.githubusercontent.com/leafxcy/JavaScript/main/daw.js +[MITM] +hostname = v3.sdk.haowusong.com +*/ + +const jsname = '都爱玩 by leaf ' +const $ = Env(jsname) + +const logDebug = 0 + +//0为关闭通知,1为打开通知,默认为1,可以在环境变量设置 +let notifyFlag = ($.isNode() ? process.env.dawNotify : $.getdata('dawNotify')) || 1; +let notifyStr = '' +const notify = $.isNode() ? require('./sendNotify') : ''; + +let rndtime = "" //毫秒 +let httpResult //global buffer + +let userToken = '' +let userIdx = 0 +let numBoxbody = 0 +let userStatus = [] +let coinStatus = [] + +let maxTryNum = 12 +let waitTime = 0 +let allCompFlag = 0 + +let channelIdx = 0 +let channel = ['dawbox','dawbox-android'] +let channelStr = ['苹果端','安卓端'] +let withdrawList = [] +let withdrawMethod = [] + +let dawToken = ($.isNode() ? process.env.dawToken : $.getdata('dawToken')) || ''; +let dawTokenArr = [] + +let userName = [] +let isVip = 0 +let vipLevel = 0 + +/////////////////////////////////////////////////////////////////// + +!(async () => { + + if(typeof $request !== "undefined") + { + await GetRewrite() + } + else + { + await CheckEnv() + + numBoxbody = dawTokenArr.length + console.log(`\n找到${numBoxbody}个账户,脚本会同时做IOS和安卓端任务`) + + console.log(`\n检查账号状态中...`) + for(channelIdx=0; channelIdx 0) { + console.log(`等待${waitTime}ms 进行下一轮看视频抽奖\n`) + await $.wait(waitTime) + } + } + } + } + + console.log(`\n开始签到,领取任务奖励,兑换红包和提现`) + for(channelIdx=0; channelIdx $.logErr(e)) +.finally(() => $.done()) + +//通知 +async function Showmsg() { + + notifyBody = '\n' + jsname + "运行通知\n\n" + notifyStr + + if (notifyFlag != 1) { + console.log(notifyBody); + } + + if (notifyFlag == 1) { + $.msg(notifyBody); + if ($.isNode()){await notify.sendNotify($.name, notifyBody );} + } +} + +async function GetRewrite() { + + if($request.url.indexOf('api/box/wallet/info') > -1) { + let headers = $request.headers + let token = headers['token'] ? headers['token'] : '' + + if(!token) return; + + if(dawToken) { + if(dawToken.indexOf(token) > -1) { + $.msg(jsname+` 此dawToken已存在`) + } else { + dawToken = dawToken + '@' + token + $.setdata(dawToken, 'dawToken'); + ckList = dawToken.split('@') + $.msg(jsname+` 获取第${ckList.length}个dawToken成功`) + } + } else { + $.setdata(token, 'dawToken'); + $.msg(jsname+` 获取第1个dawToken成功`) + } + } +} + +async function CheckEnv() { + if(dawToken) { + if(dawToken.indexOf('@') > -1) { + let dawTokens = dawToken.split('@') + for(let i=0; i 0) { + if(integral_num >= integral_min_put_num && can_put_num >= integral_min_put_num) { + let putNum = (integral_num>can_put_num) ? can_put_num : integral_num + await $.wait(100) + await PutInPool(putNum,1) + } + } + } else if(type == 1) { + if(result.data.tasks.vedio_task && Array.isArray(result.data.tasks.vedio_task)) { + for(let i=0; i -1) { + if(taskItem.complete_num < taskItem.contribution_num) { + allCompFlag = 0 + await $.wait(100) + waitTime -= 100 + await ReceiveCoin(taskItem) + } + } + } + } + if(result.data.tasks.game_task && Array.isArray(result.data.tasks.game_task)) { + for(let i=0; i -1) { + if(taskItem.complete_num < taskItem.contribution_num) { + allCompFlag = 0 + await $.wait(100) + waitTime -= 100 + await QueryTurntable(taskItem) + } + } + } + } + } else if(type == 2) { + let integral_num = result.data.player.integral_num ? result.data.player.integral_num : 0 + let use_integral_num = result.data.player.use_integral_num ? result.data.player.use_integral_num : 0 + let money = result.data.player.money ? result.data.player.money : 0 + console.log(`【DAB币】:${integral_num}`) + console.log(`【今日已投】:${use_integral_num}`) + console.log(`【分红余额】:${money}`) + notifyStr += `【DAB币】:${integral_num}\n` + notifyStr += `【今日已投】:${use_integral_num}\n` + notifyStr += `【分红余额】:${money}\n` + } + } else { + console.log(`\n账户${userIdx+1}${channelStr[channelIdx]}查询信息失败:${result.error}`) + } +} + +//领币任务奖励 +async function ReceiveCoin(taskItem) { + let caller = PrintCaller() + let url = `https://v3.sdk.haowusong.com/api/channel/integral/task/receive` + let reqBody = `{"task_id":${taskItem.task_id},"channel":"${channel[channelIdx]}"}` + let urlObject = PopulatePostUrl(url,reqBody) + await HttpPost(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.code == 200) { + console.log(`账户${userIdx+1}${channelStr[channelIdx]}完成任务【${taskItem.title}】,领取DAB币成功`) + } else { + console.log(`账户${userIdx+1}${channelStr[channelIdx]}完成任务【${taskItem.title}】失败:${result.error}`) + if(result.error.indexOf('当前仓库已存满') > -1) { + let idx = channelIdx*numBoxbody+userIdx + if(coinStatus[idx] == 1) { + console.log(`账户${userIdx+1}${channelStr[channelIdx]}仓库已存满,尝试先投入分红池`) + coinStatus[idx] = 2 + await $.wait(100) + await QueryCoinInfo(0) + } else if(coinStatus[idx] == 2) { + console.log(`账户${userIdx+1}${channelStr[channelIdx]}仓库已存满,且无法投入分红池,此用户暂时不再做任务`) + } + } + } +} + +//转盘次数查询 +async function QueryTurntable(taskItem) { + let caller = PrintCaller() + let url = `https://v3.sdk.haowusong.com/api/channel/integral/turntable/config?channel=${channel[channelIdx]}&task_id=${taskItem.task_id}` + let urlObject = PopulateGetUrl(url) + await HttpGet(urlObject,caller) + let result = httpResult; + if(!result) return false + + if(result.code == 200) { + let can_video_num = result.data.lottery_num.can_video_num ? result.data.lottery_num.can_video_num : 0 + let max_video_num = result.data.lottery_num.max_video_num ? result.data.lottery_num.max_video_num : 0 + let can_lottery_num = result.data.lottery_num.can_lottery_num ? result.data.lottery_num.can_lottery_num : 0 + let max_lottery_num = result.data.lottery_num.max_lottery_num ? result.data.lottery_num.max_lottery_num : 0 + if(can_video_num < max_video_num) { + //先看视频领次数 + await $.wait(100) + waitTime -= 100 + await ReceiveVideoReward(taskItem) + } else if(can_lottery_num < max_lottery_num) { + //已看完视频,直接抽奖 + await $.wait(100) + waitTime -= 100 + await Turntable(taskItem) + } + } else { + console.log(`账户${userIdx+1}${channelStr[channelIdx]}获取转盘次数失败:${result.error}`) + return false + } + + return true +} + +//看视频领抽奖次数 +async function ReceiveVideoReward(taskItem) { + let caller = PrintCaller() + let url = `https://v3.sdk.haowusong.com/api/channel/integral/turntable/video/receive` + let reqBody = `{"channel":"${channel[channelIdx]}","task_id":"${taskItem.task_id}"}` + let urlObject = PopulatePostUrl(url,reqBody) + await HttpPost(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.code == 200) { + console.log(`账户${userIdx+1}${channelStr[channelIdx]}看视频获得了一次抽奖机会`) + await $.wait(100) + waitTime -= 100 + await Turntable(taskItem) + } else { + console.log(`账户${userIdx+1}${channelStr[channelIdx]}看视频得抽奖机会失败:${result.error}`) + } +} + +//转盘抽奖 +async function Turntable(taskItem) { + let caller = PrintCaller() + let url = `https://v3.sdk.haowusong.com/api/channel/integral/turntable/result` + let reqBody = `{"channel":"${channel[channelIdx]}","task_id":"${taskItem.task_id}"}` + let urlObject = PopulatePostUrl(url,reqBody) + await HttpPost(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.code == 200) { + let reward = result.data.title ? result.data.title : '【?】' + console.log(`账户${userIdx+1}${channelStr[channelIdx]}抽奖成功,获得了${reward}`) + await $.wait(100) + waitTime -= 100 + await ReceiveTurntable(taskItem) + } else { + console.log(`账户${userIdx+1}${channelStr[channelIdx]}抽奖失败:${result.error}`) + } +} + +//转盘抽奖奖励翻倍领取 +async function ReceiveTurntable(taskItem) { + let caller = PrintCaller() + let url = `https://v3.sdk.haowusong.com/api/channel/integral/turntable/receive` + let reqBody = `{"channel":"${channel[channelIdx]}","task_id":"${taskItem.task_id}","type":1}` + let urlObject = PopulatePostUrl(url,reqBody) + await HttpPost(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.code == 200) { + console.log(`账户${userIdx+1}${channelStr[channelIdx]}看视频获得抽奖翻倍奖励成功`) + } else { + console.log(`账户${userIdx+1}${channelStr[channelIdx]}看视频获得抽奖翻倍奖励失败:${result.error}`) + if(result.error.indexOf('当前仓库已存满') > -1) { + let idx = channelIdx*numBoxbody+userIdx + if(coinStatus[idx] == 1) { + console.log(`账户${userIdx+1}${channelStr[channelIdx]}仓库已存满,尝试先投入分红池`) + coinStatus[idx] = 2 + await $.wait(100) + await QueryCoinInfo(0) + } else if(coinStatus[idx] == 2) { + console.log(`账户${userIdx+1}${channelStr[channelIdx]}仓库已存满,且无法投入分红池,此用户暂时不再做任务`) + } + } + } +} + +//瓜分池投入 +async function PutInPool(num,pool_lv) { + let caller = PrintCaller() + let url = `https://v3.sdk.haowusong.com/api/channel/integral/put?channel=${channel[channelIdx]}&num=${num}&pool_lv=${pool_lv}` + let urlObject = PopulateGetUrl(url) + await HttpPost(urlObject,caller) + let result = httpResult; + if(!result) return false + + if(result.code == 200) { + console.log(`账号${userIdx+1}${channelStr[channelIdx]}投入瓜分池${num}币成功`) + notifyStr += `账号${userIdx+1}${channelStr[channelIdx]}投入瓜分池${num}币成功\n` + coinStatus[channelIdx*numBoxbody+userIdx] = 1 + } else { + console.log(`账号${userIdx+1}${channelStr[channelIdx]}投入瓜分池${num}币失败:${result.error}`) + } +} + +//签到信息查询 +async function QuerySignList() { + let caller = PrintCaller() + let url = `https://v3.sdk.haowusong.com/api/box/sign/list` + let urlObject = PopulateGetUrl(url) + await HttpGet(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.code == 200) { + if(result.data.today_sign_status == 0) { + await $.wait(100) + await SignToday() + } else { + console.log(`账户${userIdx+1}${channelStr[channelIdx]}今日已签到`) + } + } else { + console.log(`账户${userIdx+1}${channelStr[channelIdx]}获取签到信息失败:${result.error}`) + } +} + +//签到 +async function SignToday() { + let caller = PrintCaller() + let url = `https://v3.sdk.haowusong.com/api/box/sign/post` + let urlObject = PopulateGetUrl(url) + await HttpPost(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.code == 200) { + console.log(`账户${userIdx+1}${channelStr[channelIdx]}签到成功,获得${result.data.total_credit_num}积分`) + } else { + console.log(`账户${userIdx+1}${channelStr[channelIdx]}签到失败:${result.error}`) + } +} + +//积分任务列表查询 +async function QueryTaskList() { + let caller = PrintCaller() + let url = `https://v3.sdk.haowusong.com/api/box/task/list` + let urlObject = PopulateGetUrl(url) + await HttpGet(urlObject,caller) + let result = httpResult; + if(!result) return false + + if(result.code == 200) { + if(result.data && Array.isArray(result.data)) { + for(let i=0; i 0 && vipLevel >= exchangeItem.vip_level) { + await $.wait(100) + await MallExchange(exchangeItem,exchangeItem.today_ex_num) + } + } + } + } else { + console.log(`账户${userIdx+1}${channelStr[channelIdx]}获取积分红包兑换列表失败:${result.error}`) + } +} + +//积分红包兑换 +async function MallExchange(exchangeItem,num) { + let caller = PrintCaller() + let url = `https://v3.sdk.haowusong.com/api/box/mall/exchange` + let reqBody = `{"mall_id":${exchangeItem.id},"num":${num}}` + let urlObject = PopulatePostUrl(url,reqBody) + await HttpPost(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.code == 200) { + console.log(`账户${userIdx+1}${channelStr[channelIdx]}兑换【${exchangeItem.title}】成功`) + } else { + console.log(`账户${userIdx+1}${channelStr[channelIdx]}兑换【${exchangeItem.title}】失败:${result.error}`) + } +} + +//积分红包提现列表查询 +async function QueryWithdrawBox(page) { + let caller = PrintCaller() + let url = `https://v3.sdk.haowusong.com/api/box/withdraw/platform/config?channel=${channel[channelIdx]}&page=${page}&page_count=10` + let urlObject = PopulateGetUrl(url) + await HttpGet(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.code == 200) { + let money = result.data.money ? result.data.money : 0 + withdrawMethod[userIdx].alipay = result.data.is_bind_alipay ? result.data.is_bind_alipay : 0 + withdrawMethod[userIdx].wechat = result.data.is_bind_wechat ? result.data.is_bind_wechat : 0 + let payType = '' + if(result.data.is_bind_wechat==1) payType += ' 微信' + if(result.data.is_bind_alipay==1) payType += ' 支付宝' + if(!payType) payType += '无' + console.log(`账户${userIdx+1}${channelStr[channelIdx]}积分红包余额:${result.data.money}`) + console.log(`账户${userIdx+1}${channelStr[channelIdx]}已绑定支付方式:${payType}`) + if(result.data.withdraw_config && Array.isArray(result.data.withdraw_config)) { + for(let i=0; i= withItem.money) { + withdrawList[userIdx].push({type:'box',channel:channelIdx,item:withItem}) + } + } + } else { + console.log(`账号${userIdx+1}${channelStr[channelIdx]}获取积分红包提现列表失败`) + } + } else { + console.log(`账号${userIdx+1}${channelStr[channelIdx]}获取积分红包提现列表失败:${result.error}`) + } +} + +//分红提现列表查询 +async function QueryWithdrawIntegral(page) { + let caller = PrintCaller() + let url = `https://v3.sdk.haowusong.com/api/channel/integral/withdraw/config?channel=${channel[channelIdx]}&page=${page}&page_count=10` + let urlObject = PopulateGetUrl(url) + await HttpGet(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.code == 200) { + let money = result.data.money ? result.data.money : 0 + console.log(`\n账号${userIdx+1}${channelStr[channelIdx]}:`) + console.log(`分红余额:${result.data.money}`) + if(result.data.withdraw_config && Array.isArray(result.data.withdraw_config)) { + for(let i=0; i= withItem.money) { + withdrawList[userIdx].push({type:'integral',channel:channelIdx,item:withItem}) + } + } + } else { + console.log(`\n账号${userIdx+1}${channelStr[channelIdx]}获取分红余额提现列表失败`) + } + } else { + console.log(`\n账号${userIdx+1}${channelStr[channelIdx]}获取分红余额提现列表失败:${result.error}`) + } +} + +async function Withdraw() { + if(withdrawList[userIdx].length > 0) { + console.log(`\n账号${userIdx+1}开始尝试提现:`) + let sortList = withdrawList[userIdx].sort(function(a,b){return b['item']['money']-a['item']['money']}); + for(let i=0; i -1) { + return true + } + } + return false +} + +//分红提现 +async function WithdrawIntegral(withItem,withMethod) { + let caller = PrintCaller() + let pay_type = 0 + if(withMethod.wechat == 1 && withItem.item.is_wechat == 1) { + pay_type = 1 + } else if(withMethod.alipay == 1 && withItem.item.is_alipay == 1) { + pay_type = 2 + } else { + return false + } + let url = `https://v3.sdk.haowusong.com/api/channel/integral/withdraw/apply?config_id=${withItem.item.id}&channel=${channel[withItem.channel]}&pay_type=${pay_type}` + let urlObject = PopulateGetUrl(url) + await HttpPost(urlObject,caller) + let result = httpResult; + if(!result) { + console.log(`--账号${userIdx+1}${channelStr[withItem.channel]}提现分红${withItem.item.money}元失败:服务器无响应`) + return false + } + + if(result.code == 200) { + console.log(`--账号${userIdx+1}${channelStr[withItem.channel]}提现分红${withItem.item.money}元成功`) + notifyStr += `--账号${userIdx+1}${channelStr[withItem.channel]}提现分红${withItem.item.money}元成功\n` + return true + } else { + console.log(`--账号${userIdx+1}${channelStr[withItem.channel]}提现分红${withItem.item.money}元失败:${result.error}`) + if(result.error.indexOf('今日提现次数超出限制') > -1) { + return true + } + } + return false +} + +//////////////////////////////////////////////////////////////////// +function PopulatePostUrl(url,reqBody){ + let urlObject = { + url: url, + headers: { + 'Host' : 'v3.sdk.haowusong.com', + 'Origin' : 'https://v3.h5.haowusong.com', + 'Content-Type' : 'application/json', + 'Accept-Encoding' : 'gzip, deflate, br', + 'Connection' : 'keep-alive', + 'Accept' : 'application/json, text/plain, */*', + 'User-Agent' : 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148', + 'Accept-Language' : 'zh-CN,zh-Hans;q=0.9', + 'Referer' : 'https://v3.h5.haowusong.com/', + 'token' : dawTokenArr[userIdx], + }, + body: reqBody, + } + return urlObject; +} + +function PopulateGetUrl(url){ + let urlObject = { + url: url, + headers: { + 'Host' : 'v3.sdk.haowusong.com', + 'Origin' : 'https://v3.h5.haowusong.com', + 'Content-Type' : 'application/json', + 'Accept-Encoding' : 'gzip, deflate, br', + 'Connection' : 'keep-alive', + 'Accept' : 'application/json, text/plain, */*', + 'User-Agent' : 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148', + 'Accept-Language' : 'zh-CN,zh-Hans;q=0.9', + 'Referer' : 'https://v3.h5.haowusong.com/', + 'token' : dawTokenArr[userIdx], + } + } + return urlObject; +} + +async function HttpPost(url,caller) { + httpResult = null + return new Promise((resolve) => { + $.post(url, async (err, resp, data) => { + try { + if (SafeGet(data,caller)) { + httpResult = JSON.parse(data); + if(logDebug) console.log(httpResult); + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +async function HttpGet(url,caller) { + httpResult = null + return new Promise((resolve) => { + $.get(url, async (err, resp, data) => { + try { + if (SafeGet(data,caller)) { + httpResult = JSON.parse(data); + if(logDebug) console.log(httpResult); + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +function SafeGet(data,caller) { + try { + if (typeof JSON.parse(data) == "object") { + return true; + } else { + console.log(`Function ${caller}: 未知错误`); + console.log(data) + } + } catch (e) { + console.log(e); + console.log(data) + console.log(`Function ${caller}: 服务器访问数据为空,请检查自身设备网络情况`); + return false; + } +} + +function PrintCaller(){ + return (new Error()).stack.split("\n")[2].trim().split(" ")[1] +} + +function Env(t, e) { class s { constructor(t) { this.env = t } send(t, e = "GET") { t = "string" == typeof t ? { url: t } : t; let s = this.get; return "POST" === e && (s = this.post), new Promise((e, i) => { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), a = { url: `http://${h}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(a, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null } setval(t, e) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null } initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) } get(t, e = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.get(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { try { if (t.headers["set-cookie"]) { const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar } } catch (t) { this.logErr(t) } }).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) })) } post(t, e = (() => { })) { if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.post(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) }); else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: s, ...i } = t; this.got.post(s, i).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) }) } } time(t) { let e = { "M+": (new Date).getMonth() + 1, "d+": (new Date).getDate(), "H+": (new Date).getHours(), "m+": (new Date).getMinutes(), "s+": (new Date).getSeconds(), "q+": Math.floor(((new Date).getMonth() + 3) / 3), S: (new Date).getMilliseconds() }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, ((new Date).getFullYear() + "").substr(4 - RegExp.$1.length))); for (let s in e) new RegExp("(" + s + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? e[s] : ("00" + e[s]).substr(("" + e[s]).length))); return t } msg(e = t, s = "", i = "", r) { const o = t => { if (!t) return t; if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : this.isSurge() ? { url: t } : void 0; if ("object" == typeof t) { if (this.isLoon()) { let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-url"]; return { openUrl: e, mediaUrl: s } } if (this.isQuanX()) { let e = t["open-url"] || t.url || t.openUrl, s = t["media-url"] || t.mediaUrl; return { "open-url": e, "media-url": s } } if (this.isSurge()) { let e = t.url || t.openUrl || t["open-url"]; return { url: e } } } }; this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))); let h = ["", "=========\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3========="]; h.push(e), s && h.push(s), i && h.push(i), console.log(h.join("\n")), this.logs = this.logs.concat(h) } log(...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) } logErr(t, e) { const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); s ? this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack) : this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t) } wait(t) { return new Promise(e => setTimeout(e, t)) } done(t = {}) { const e = (new Date).getTime(), s = (e - this.startTime) / 1e3; this.log("", `\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } }(t, e) } diff --git a/jckd/jckd_risk.js b/jckd/jckd_risk.js new file mode 100644 index 0000000..8e100a3 --- /dev/null +++ b/jckd/jckd_risk.js @@ -0,0 +1,312 @@ +/* +安卓:晶彩看点 风险查询+今日收益详情 + +需要用到jckdCookie,只测试了青龙,理论上V2P也能用 +本脚本没有设置重写,请自己复制jc_cookie到青龙环境下使用,多账号用@隔开 +例子: export jckdCookie='uid=xxx&zqkey=yyy&zqkey_id=zzz@uid=aaa&zqkey=bbb&zqkey_id=ccc@uid=qqq&zqkey=sss&zqkey_id=ttt' +*/ + +const jsname = '晶彩看点风险查询' +const $ = Env(jsname) +const notifyFlag = 1; //0为关闭通知,1为打开通知,默认为1 +const logDebug = 0 + +const notify = $.isNode() ? require('./sendNotify') : ''; +let notifyStr = '' + +let rndtime = "" //毫秒 +let httpResult //global buffer + +let userCookie = ($.isNode() ? process.env.jckdCookie : $.getdata('jckdCookie')) || ''; +let userCookieArr = [] + +let nickname = [] +/////////////////////////////////////////////////////////////////// + +!(async () => { + + if(typeof $request !== "undefined") + { + $.msg(jsname+': 此脚本不做重写,请检查重写设置') + } + else + { + if(!(await checkEnv())) { + return + } + + await initAccountInfo() + await RunRiskInfo() + await RunUserBalance() + + await showmsg() + } + + +})() +.catch((e) => $.logErr(e)) +.finally(() => $.done()) + +//通知 +async function showmsg() { + + notifyBody = jsname + "运行通知\n\n" + notifyStr + + if (notifyFlag != 1) { + console.log(notifyBody); + } + + if (notifyFlag == 1) { + $.msg(notifyBody); + if($.isNode()){await notify.sendNotify($.name, notifyBody );} + } +} + +async function checkEnv() { + if(userCookie) { + if(userCookie.indexOf('@') > -1) { + let userCookies = userCookie.split('@') + for(let i=0; i -1) { + for(let j=0; j { + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log(caller + ": post请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + httpResult = JSON.parse(data); + if(logDebug) console.log(httpResult); + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +async function httpGet(url,caller) { + httpResult = null + return new Promise((resolve) => { + $.get(url, async (err, resp, data) => { + try { + if (err) { + console.log(caller + ": get请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data,caller)) { + httpResult = JSON.parse(data); + if(logDebug) console.log(httpResult); + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +function safeGet(data,caller) { + try { + if (typeof JSON.parse(data) == "object") { + return true; + } else { + console.log(`Function ${caller}: 未知错误`); + console.log(data) + } + } catch (e) { + console.log(e); + console.log(`Function ${caller}: 服务器访问数据为空,请检查自身设备网络情况`); + return false; + } +} + +function printCaller(){ + return (new Error()).stack.split("\n")[2].trim().split(" ")[1] +} + +function Env(t, e) { class s { constructor(t) { this.env = t } send(t, e = "GET") { t = "string" == typeof t ? { url: t } : t; let s = this.get; return "POST" === e && (s = this.post), new Promise((e, i) => { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), a = { url: `http://${h}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(a, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null } setval(t, e) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null } initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) } get(t, e = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.get(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { try { if (t.headers["set-cookie"]) { const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar } } catch (t) { this.logErr(t) } }).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) })) } post(t, e = (() => { })) { if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.post(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) }); else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: s, ...i } = t; this.got.post(s, i).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) }) } } time(t) { let e = { "M+": (new Date).getMonth() + 1, "d+": (new Date).getDate(), "H+": (new Date).getHours(), "m+": (new Date).getMinutes(), "s+": (new Date).getSeconds(), "q+": Math.floor(((new Date).getMonth() + 3) / 3), S: (new Date).getMilliseconds() }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, ((new Date).getFullYear() + "").substr(4 - RegExp.$1.length))); for (let s in e) new RegExp("(" + s + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? e[s] : ("00" + e[s]).substr(("" + e[s]).length))); return t } msg(e = t, s = "", i = "", r) { const o = t => { if (!t) return t; if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : this.isSurge() ? { url: t } : void 0; if ("object" == typeof t) { if (this.isLoon()) { let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-url"]; return { openUrl: e, mediaUrl: s } } if (this.isQuanX()) { let e = t["open-url"] || t.url || t.openUrl, s = t["media-url"] || t.mediaUrl; return { "open-url": e, "media-url": s } } if (this.isSurge()) { let e = t.url || t.openUrl || t["open-url"]; return { url: e } } } }; this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))); let h = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="]; h.push(e), s && h.push(s), i && h.push(i), console.log(h.join("\n")), this.logs = this.logs.concat(h) } log(...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) } logErr(t, e) { const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); s ? this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack) : this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t) } wait(t) { return new Promise(e => setTimeout(e, t)) } done(t = {}) { const e = (new Date).getTime(), s = (e - this.startTime) / 1e3; this.log("", `\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } }(t, e) } diff --git a/jckd/jckd_shareRead.js b/jckd/jckd_shareRead.js new file mode 100644 index 0000000..1ee1bf1 --- /dev/null +++ b/jckd/jckd_shareRead.js @@ -0,0 +1,328 @@ +/* +安卓:晶彩看点 + +转发和分享阅读,请勿贪心,小心黑号 +*/ + +const jsname = '晶彩看点分享阅读' +const $ = Env(jsname) +const notifyFlag = 1; //0为关闭通知,1为打开通知,默认为1 +const logDebug = 0 + +//const notify = $.isNode() ? require('./sendNotify') : ''; +let notifyStr = '' + +let rndtime = "" //毫秒 +let httpResult //global buffer + +let jckdCookie = ($.isNode() ? process.env.jc_cookie : $.getdata('jc_cookie')) || ''; +let jckdCookieArr = [] + +let userCk = '' +let readCount = 0 + +let jckdShareNum = ($.isNode() ? process.env.jckdShareNum : $.getdata('jckdShareNum')) || 0; + +let newsItem = '' +let UserAgent = '' +let si = '' + +/////////////////////////////////////////////////////////////////// + +!(async () => { + + if(typeof $request !== "undefined") + { + $.msg(jsname+': 此脚本不做重写,请检查重写设置') + } + else + { + if(!(await checkEnv())){ + return + } + + for(let j=0; j maxWaitTime ? maxWaitTime : seedFactor + let randomTime = Math.floor(Math.random()*factor) + 1000 + let second = Math.floor(randomTime/1000) + UserAgent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.16(0x1800102c) NetType/WIFI Language/zh_CN' + si = randomString(32) + console.log(`--随机延迟${second}秒后开始模拟第${readCount}次分享阅读`) + await $.wait(randomTime) + console.log(`----模拟第${readCount}次阅读,使用si=${si}`) + await shareReadStep1() + await $.wait(Math.floor(Math.random()*500)+500) + await shareReadStep2() + await $.wait(Math.floor(Math.random()*1000)+2000) + await shareReadStep3() + await $.wait(Math.floor(Math.random()*1000)+2000) + await shareReadStep4() + console.log(`----模拟第${readCount}次阅读完成`) + } + + } + } + } + + +})() +.catch((e) => $.logErr(e)) +.finally(() => $.done()) + +//通知 +async function showmsg() { + + notifyBody = jsname + "运行通知\n\n" + notifyStr + + if (notifyFlag != 1) { + console.log(notifyBody); + } + + if (notifyFlag == 1) { + $.msg(notifyBody); + //if ($.isNode()){await notify.sendNotify($.name, notifyBody );} + } +} + +async function checkEnv() { + + if(jckdShareNum == 0) { + console.log('当前分享次数设置为0。如果需要开启分享阅读,请设置环境变量jckdShareNum为要被阅读的次数。') + return false + } + + if(jckdCookie) { + if(jckdCookie.indexOf('@') > -1) { + let jckdCookies = jckdCookie.split('@') + for(let i=0; i { + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log(caller + ": post请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + httpResult = JSON.parse(data,caller); + if(logDebug) console.log(httpResult); + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +async function httpGet(url,caller) { + httpResult = null + return new Promise((resolve) => { + $.get(url, async (err, resp, data) => { + try { + if (err) { + console.log(caller + ": get请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + // + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +function safeGet(data,caller) { + try { + if (typeof JSON.parse(data) == "object") { + return true; + } else { + console.log(`Function ${caller}: 未知错误`); + console.log(data) + } + } catch (e) { + console.log(e); + console.log(`Function ${caller}: 服务器访问数据为空,请检查自身设备网络情况`); + return false; + } +} + +function printCaller(){ + return (new Error()).stack.split("\n")[2].trim().split(" ")[1] +} + +function Env(t, e) { class s { constructor(t) { this.env = t } send(t, e = "GET") { t = "string" == typeof t ? { url: t } : t; let s = this.get; return "POST" === e && (s = this.post), new Promise((e, i) => { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), a = { url: `http://${h}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(a, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null } setval(t, e) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null } initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) } get(t, e = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.get(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { try { if (t.headers["set-cookie"]) { const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar } } catch (t) { this.logErr(t) } }).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) })) } post(t, e = (() => { })) { if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.post(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) }); else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: s, ...i } = t; this.got.post(s, i).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) }) } } time(t) { let e = { "M+": (new Date).getMonth() + 1, "d+": (new Date).getDate(), "H+": (new Date).getHours(), "m+": (new Date).getMinutes(), "s+": (new Date).getSeconds(), "q+": Math.floor(((new Date).getMonth() + 3) / 3), S: (new Date).getMilliseconds() }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, ((new Date).getFullYear() + "").substr(4 - RegExp.$1.length))); for (let s in e) new RegExp("(" + s + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? e[s] : ("00" + e[s]).substr(("" + e[s]).length))); return t } msg(e = t, s = "", i = "", r) { const o = t => { if (!t) return t; if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : this.isSurge() ? { url: t } : void 0; if ("object" == typeof t) { if (this.isLoon()) { let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-url"]; return { openUrl: e, mediaUrl: s } } if (this.isQuanX()) { let e = t["open-url"] || t.url || t.openUrl, s = t["media-url"] || t.mediaUrl; return { "open-url": e, "media-url": s } } if (this.isSurge()) { let e = t.url || t.openUrl || t["open-url"]; return { url: e } } } }; this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))); let h = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="]; h.push(e), s && h.push(s), i && h.push(i), console.log(h.join("\n")), this.logs = this.logs.concat(h) } log(...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) } logErr(t, e) { const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); s ? this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack) : this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t) } wait(t) { return new Promise(e => setTimeout(e, t)) } done(t = {}) { const e = (new Date).getTime(), s = (e - this.startTime) / 1e3; this.log("", `\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } }(t, e) } diff --git a/jctq/README.md b/jctq/README.md new file mode 100644 index 0000000..2e15bfb --- /dev/null +++ b/jctq/README.md @@ -0,0 +1,22 @@ +# 晶彩天气(v8.3.7) + +## 重写: +https://tq.xunsl.com/v17/NewTask/getTaskListByWeather.json -- 点开福利页即可获取jctqCookie +https://tq.xunsl.com/v5/CommonReward/toGetReward.json -- 签到,和福利页任务奖励 +https://tq.xunsl.com/v5/article/info.json -- 点开文章获取文章body +https://tq.xunsl.com/v5/article/detail.json -- 点开视频获取视频body +https://tq.xunsl.com/v5/user/stay.json -- 阅读文章或者看视频一段时间后可以获取到时长body +https://tq.xunsl.com/v5/nameless/adlickstart.json -- 点开看看赚获取body,可以一直开着,脚本会自动删除重复body +https://tq.xunsl.com/v5/Weather/giveBoxOnWeather.json -- 点开福利页浮窗宝箱和观看翻倍视频获取body +https://tq.xunsl.com/v5/weather/giveTimeInterval.json -- 点开首页气泡红包和观看翻倍视频获取body +https://tq.xunsl.com/v5/wechat/withdraw2.json -- 提现一次对应金额获取body +https://tq.xunsl.com/v5/CommonReward/toDouble.json -- 领取签到翻倍奖励后可获取 + +## 任务: +jctq_daily.js -- 领转发页定时宝箱,领福利页定时宝箱,领首页气泡红包,时段转发,刷福利视频,抽奖5次 +jctq_reward.js -- 签到和翻倍,任务奖励领取,统计今日收益,自动提现 +jctq_kkz.js -- 完成看看赚任务,删除重复和失效的body +jctq_read.js -- 阅读文章,浏览视频 + +## 分享阅读: +jctq_shareRead.js -- 分享和助力阅读,需要在环境变量jctqShareNum里设置要被阅读的次数,不设置默认不跑 diff --git a/jctq/jctq_Adv_video.js b/jctq/jctq_Adv_video.js deleted file mode 100644 index 671b3fd..0000000 --- a/jctq/jctq_Adv_video.js +++ /dev/null @@ -1,91 +0,0 @@ -const $ = new Env("晶彩天气福利视频"); -const notify = $.isNode() ? require('./sendNotify') : ''; -message = "" -let jctqCookie= $.isNode() ? (process.env.jctqCookie ? process.env.jctqCookie : "") : ($.getdata('jctqCookie') ? $.getdata('jctqCookie') : "") -let jctqCookieArr = [] -let jctqCookies = "" - -if (!jctqCookie) { - $.msg($.name, '【提示】进入点击右下角"赚钱图标",再跑一次脚本', '不知道说啥好', { - "open-url": "给您劈个叉吧" - }); - $.done() - } - else if (jctqCookie.indexOf("@") == -1 && jctqCookie.indexOf("@") == -1) { - jctqCookieArr.push(jctqCookie) - } - else if (jctqCookie.indexOf("@") > -1) { - jctqCookies = jctqCookie.split("@") - } - else if (process.env.jctqCookie && process.env.jctqCookie.indexOf('@') > -1) { - jctqCookieArr = process.env.jctqCookie.split('@'); - console.log(`您选择的是用"@"隔开\n`) - } - else { - jctqCookies = [process.env.jctqCookie] - }; - Object.keys(jctqCookies).forEach((item) => { - if (jctqCookies[item]) { - jctqCookieArr.push(jctqCookies[item]) - } - }) - - - - -!(async () => { - console.log(`共${jctqCookieArr.length}个cookie`) - for (let k = 0; k < jctqCookieArr.length; k++) { - $.message = "" - bodyVal = jctqCookieArr[k] - var time1 = Date.parse( new Date() ).toString(); - time1 = time1.substr(0,10); - jctqCookie1= time1 + '&' + bodyVal - //待处理cookie - console.log(`${jctqCookie1}`) - console.log(`--------第 ${k + 1} 个账号观看福利视频中--------\n`) - for (let j =0; j<5;j++){ - console.log(`--------第 ${j + 1} 次观看福利视频中--------\n`) - await video(jctqCookie1) - console.log("等待30秒") - await $.wait(30000); - console.log("\n\n") - } - console.log("\n\n") - } - - })() - .catch((e) => $.logErr(e)) - .finally(() => $.done()) - - -function video(jctqCookie1,timeout = 0) { - return new Promise((resolve) => { - - let url = { - url : 'https://tq.xunsl.com/V17/NewTask/recordNum.json?'+ jctqCookie1, - headers : { - 'Host': 'tq.xunsl.com', - 'Connection': 'Keep-Alive', - 'Accept-Encoding': 'gzip', - 'User-Agent': 'okhttp/3.12.2' -}, - } - $.get(url, async (err, resp, data) => { - try { - const result = JSON.parse(data) - if(result.success === true){ - console.log('\n福利视频:'+result.message) - }else{ - console.log(result) - } - } catch (e) { - } finally { - resolve() - } - },timeout) - }) -} - -function Env(t,e){"undefined"!=typeof process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0);class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} - diff --git a/jctq/jctq_Rotary.js b/jctq/jctq_Rotary.js deleted file mode 100644 index c5a84ac..0000000 --- a/jctq/jctq_Rotary.js +++ /dev/null @@ -1,137 +0,0 @@ -const $ = new Env("晶彩天气大转盘抽奖"); -const notify = $.isNode() ? require('./sendNotify') : ''; -message = "" -let jctqCookie= $.isNode() ? (process.env.jctqCookie ? process.env.jctqCookie : "") : ($.getdata('jctqCookie') ? $.getdata('jctqCookie') : "") -let jctqCookieArr = [] -let jctqCookies = "" -let remain =100 -var time = Date.parse( new Date() ).toString(); -var time1 = time.substr(0,10); - -if (!jctqCookie) { - $.msg($.name, '【提示】进入点击右下角"赚钱图标",获取cookie,再跑一次脚本', '不知道说啥好', { - "open-url": "给您劈个叉吧" - }); - $.done() - } - else if (jctqCookie.indexOf("@") == -1 && jctqCookie.indexOf("@") == -1) { - jctqCookieArr.push(jctqCookie) - } - else if (jctqCookie.indexOf("@") > -1) { - jctqCookies = jctqCookie.split("@") - } - else if (process.env.jctqCookie && process.env.jctqCookie.indexOf('@') > -1) { - jctqCookieArr = process.env.jctqCookie.split('@'); - console.log(`您选择的是用"@"隔开\n`) - } - else { - jctqCookies = [process.env.jctqCookie] - }; - Object.keys(jctqCookies).forEach((item) => { - if (jctqCookies[item]) { - jctqCookieArr.push(jctqCookies[item]) - } - }) - - - -!(async () => { - console.log(`共${jctqCookieArr.length}个cookie`) - for (let k = 0; k < jctqCookieArr.length; k++) { - $.message = "" - bodyVal = jctqCookieArr[k].split('&uid=')[0]; - cookie = bodyVal.replace(/zqkey=/, "cookie=") - cookie_id = cookie.replace(/zqkey_id=/, "cookie_id=") - jctqCookie1= cookie_id + '&request_time=' + time1 + '&time=' + time1 +'&'+ bodyVal - //待处理cookie - //console.log(`${jctqCookie1}`) - console.log(`--------第 ${k + 1} 个账号转盘抽奖中--------\n`) - - console.log("\n\n") - - for(let k = 0 ; k < 100 ; k++){ - await Rotary(jctqCookie1,cookie_id,time) - await $.wait(6000); - console.log("\n\n") - } - for (let k = 1 ; k < 5 ; k++){ - id = k.toString() - await openbox(jctqCookie1,cookie_id,time,id) - await $.wait(15000) - } - console.log("\n\n") - } - })() - .catch((e) => $.logErr(e)) - .finally(() => $.done()) -//抽奖 -function Rotary(jctqCookie1,cookie_id,time) { - return new Promise((resolve, reject) => { - let url = { - url : 'https://tq.xunsl.com/WebApi/RotaryTable/turnRotary?_='+time, - headers : {'Host': 'tq.xunsl.com', - 'Referer':'https://tq.xunsl.com/html/rotaryTable/index.html?'+jctqCookie1 - }, - body:cookie_id, - } - $.post(url, async (err, resp, data) => { - try { - const result = JSON.parse(data) - if(result.status === 1 ){ - if(result.data.score !== 0){ - console.log('好家伙!你抽中了'+result.data.score + '金币') - - //console.log('剩'+remain+'次') - }else { - console.log('你抽了个寂寞') - } - - }else{ - console.log('\n抽奖失败,别问我,我也不知道为啥') - } - } catch (e) { - $.logErr(e+resp); - } finally { - resolve() - } - }) - }) -} - -function openbox(jctqCookie1,cookie_id,time,k,timeout = 0) { - return new Promise((resolve) => { - let url = { - url : 'https://tq.xunsl.com/WebApi/RotaryTable/chestReward?_='+ time, - headers : {'Host': 'tq.xunsl.com', - 'User-Agent': '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/65.0.3325.109 Mobile Safari/537.36', - 'Content-Type': 'application/x-www-form-urlencoded', - 'Accept-Language': 'zh-CN,en-US;q=0.9', - 'Accept-Encoding': 'gzip, deflate', - 'Content-Length': (cookie_id +'&num='+k).length.toString(), - 'Referer':'https://tq.xunsl.com/html/rotaryTable/index.html?'+jctqCookie1 - }, - body:cookie_id + '&num=' + k, - } - $.post(url, async (err, resp, data) => { - try { - const result = JSON.parse(data) - if(result.status === 1 ){ - if(result.data.score !== 0){ - console.log('宝箱获得:'+result.data.score + '金币') - - }else { - console.log('宝箱打开失败') - } - }else{ - console.log('\n宝箱请求失败') - - } - } catch (e) { - } finally { - resolve() - } - },timeout) - }) -} - -function Env(t,e){"undefined"!=typeof process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0);class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} diff --git a/jctq/jctq_daily.js b/jctq/jctq_daily.js new file mode 100644 index 0000000..8f61908 --- /dev/null +++ b/jctq/jctq_daily.js @@ -0,0 +1,709 @@ +/* +安卓:水果天气(v8.3.9) + +此脚本负责: +旧版本8.3.7:领首页气泡红包和翻倍奖励,福利页定时宝箱和翻倍奖励 +新版本8.3.9:领转发页定时宝箱,领资讯页宝箱和视频奖励,任务页一键收金币,时段转发,刷福利视频,抽奖5次 +*/ + +const jsname = '晶彩天气日常' +const $ = Env(jsname) +const notifyFlag = 1; //0为关闭通知,1为打开通知,默认为1 +const logDebug = 0 + +//const notify = $.isNode() ? require('./sendNotify') : ''; +let notifyStr = '' + +let rndtime = "" //毫秒 +let httpResult //global buffer + +let userCookie = '' + +let jctqCookie = ($.isNode() ? process.env.jctqCookie : $.getdata('jctqCookie')) || ''; +let jctqBubbleBody = ($.isNode() ? process.env.jctqBubbleBody : $.getdata('jctqBubbleBody')) || ''; +let jctqGiveBoxBody = ($.isNode() ? process.env.jctqGiveBoxBody : $.getdata('jctqGiveBoxBody')) || ''; +let jctqGoldBody = ($.isNode() ? process.env.jctqGoldBody : $.getdata('jctqGoldBody')) || ''; +let jctqVideoBody = ($.isNode() ? process.env.jctqVideoBody : $.getdata('jctqVideoBody')) || ''; + +let jctqCookieArr = [] +let jctqBubbleBodyArr = [] +let jctqGiveBoxBodyArr = [] +let jctqGoldBodyArr = [] +let jctqVideoBodyArr = [] + +let refHotShare = 'http://tq.xunsl.com/h5/hotShare/?' +let refRotory = 'https://tq.xunsl.com/html/rotaryTable/index.html?keyword_wyq=woyaoq.com&' + + +/////////////////////////////////////////////////////////////////// + +!(async () => { + + if(typeof $request !== "undefined") + { + $.msg(jsname+': 此脚本不做重写,请检查重写设置') + } + else + { + await checkEnv() + + numBoxbody = jctqCookieArr.length + console.log(`找到${numBoxbody}个cookie`) + + for(let i=0; i $.logErr(e)) +.finally(() => $.done()) + +//通知 +async function showmsg() { + + notifyBody = jsname + "运行通知\n\n" + notifyStr + + if (notifyFlag != 1) { + console.log(notifyBody); + } + + if (notifyFlag == 1) { + $.msg(notifyBody); + //if ($.isNode()){await notify.sendNotify($.name, notifyBody );} + } +} + +async function checkEnv() { + + if(jctqCookie) { + if(jctqCookie.indexOf('&') > -1) { + let jctqCookies = jctqCookie.split('@') + for(let i=0; i -1) { + let jctqBubbleBodyArrs = jctqBubbleBody.split('&') + for(let i=0; i -1) { + let jctqGiveBoxBodyArrs = jctqGiveBoxBody.split('&') + for(let i=0; i -1) { + let jctqGoldBodyArrs = jctqGoldBody.split('&') + for(let i=0; i -1) { + let jctqVideoBodyArrs = jctqVideoBody.split('@') + for(let i=0; i=5 && currentHour<10) { + action = 'beread_extra_reward_one' + } else if(currentHour>=11 && currentHour<16) { + action = 'beread_extra_reward_two' + } else if(currentHour>=17 && currentHour<22) { + action = 'beread_extra_reward_three' + } + + if(result.code == 200) { + if(result.data && result.data.taskList && Array.isArray(result.data.taskList)) { + let taskList = result.data.taskList + for(let i=0; i -1) { + if(taskItem.status == 1) { + console.log(`\n转发页面定时宝箱可领取`) + await $.wait(1000) + await getRewardShareBox() + } else { + let cdTime = taskItem.total_time - taskItem.countdown + console.log(`\n转发页面定时宝箱冷却时间:${cdTime}秒`) + if(cdTime < 90) { + let waitTime = cdTime+1 + console.log(`\n等待${waitTime}秒后尝试领取`) + await $.wait(waitTime*1000) + await queryShareStatus() + } + } + } + if(action && taskItem.action.indexOf(action) > -1) { + if(taskItem.status == 0) { + console.log(`\n开始做${taskItem.name}转发任务`) + await $.wait(1000) + await listsNewTag() + await $.wait(1000) + await execExtractTask(taskItem.action,taskItem.name) + } else { + console.log(`\n${taskItem.name}转发已完成`) + } + } + } + } + } else { + console.log(`\n转发页面查询失败:${result.msg}`) + } +} + +//转发页面红包领取 -- 30分钟一次 +async function getRewardShareBox() { + let caller = printCaller() + let url = 'http://tq.xunsl.com/WebApi/TimePacket/getReward' + let urlObject = populatePostUrl(url,refHotShare,userCookie) + await httpPost(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.code == 1) { + console.log(`领取转发页面定时宝箱成功:获得${result.data.score}金币`) + } else { + console.log(`领取转发页面定时宝箱失败:${result.msg}`) + } +} + +//转发页面列表 +async function listsNewTag() { + let caller = printCaller() + let url = 'http://tq.xunsl.com/WebApi/ArticleTop/listsNewTag' + let urlObject = populatePostUrl(url,refHotShare,userCookie) + await httpPost(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.status == 1) { + if(result.data && result.data.items && Array.isArray(result.data.items)) { + let shareIdx = Math.floor(Math.random()*result.data.items.length) + let newsItem = result.data.items[shareIdx] + await $.wait(1000) + await getShareArticleReward(newsItem.id) + } + } else { + console.log(`查询转发页面列表失败:${result.msg}`) + } +} + +//转发文章 +async function getShareArticleReward(articleId) { + let caller = printCaller() + let url = 'http://tq.xunsl.com/WebApi/ShareNew/getShareArticleReward' + let reqBody = userCookie + '&article_id=' + articleId + let urlObject = populatePostUrl(url,refHotShare,reqBody) + await httpPost(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.status == 1) { + if(result.data.share == 1) { + console.log(`转发文章成功`) + } + } else { + console.log(`转发文章失败:${result.msg}`) + } +} + +//转发时段奖励 +async function execExtractTask(action,name) { + let caller = printCaller() + let url = 'http://tq.xunsl.com/WebApi/ShareNew/execExtractTask' + let reqBody = userCookie + '&action=' + action + let urlObject = populatePostUrl(url,refHotShare,reqBody) + await httpPost(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.code == 200) { + console.log(`领取${name}转发奖励成功`) + } else { + console.log(`领取${name}转发奖励失败:${result.msg}`) + } +} + +//首页气泡红包查询 +async function queryBubbleStatus() { + let caller = printCaller() + let url = 'https://tq.xunsl.com/v17/weather/index.json?' + userCookie + let urlObject = populateGetUrl(url,refHotShare) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.success == true) { + let numBody = jctqBubbleBodyArr.length + if(numBody > 0) { + if(result.items && result.items.bubble && Array.isArray(result.items.bubble)) { + let bubbleList = result.items.bubble + let numBubble = bubbleList.length + console.log(`\n共有${numBubble}个气泡红包可以领取,找到${numBody}个气泡和翻倍body,开始尝试领取`) + for(let i=0; i 1) { + if(result.items.status == 1) { + console.log(`\n福利页面定时宝箱可领取,找到${numBody}个宝箱body,开始尝试领取`) + for(let i=0; i 5 ? 5 : result.data.remainTurn + if(numTurn > 0) { + for(let i=0; i= boxItem.times) { + randomTime = Math.floor(Math.random()*5000)+30000 + console.log(`随机延迟 ${randomTime}ms 看视频开抽奖宝箱`) + await $.wait(randomTime) + await chestReward(i+1) + } + } + } + } else { + console.log(`抽奖次数查询失败:${result.msg}`) + } +} + +//抽奖宝箱 +async function chestReward(idx) { + rndtime = Math.floor(new Date().getTime()) + let caller = printCaller() + let url = 'https://tq.xunsl.com/WebApi/RotaryTable/chestReward?_='+rndtime + let reqBody = userCookie + '&num=' + idx + let urlObject = populatePostUrl(url,refRotory,reqBody) + await httpPost(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.status == 1) { + console.log(`开抽奖第${idx}个宝箱获得${result.data.score}金币`) + } else { + console.log(`开抽奖宝箱失败:${result.msg}`) + } +} + +//抽奖 +async function turnRotary() { + rndtime = Math.floor(new Date().getTime()) + let caller = printCaller() + let url = 'https://tq.xunsl.com/WebApi/RotaryTable/turnRotary?_='+rndtime + let urlObject = populatePostUrl(url,refRotory,userCookie) + await httpPost(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.status == 1) { + console.log(`抽奖获得${result.data.score}金币,剩余抽奖次数${result.data.remainTurn}`) + } else { + console.log(`抽奖失败:${result.msg}`) + } +} + +//查询日常任务进度 +async function getTaskListByWeather() { + let caller = printCaller() + let url = 'https://tq.xunsl.com/v17/NewTask/getTaskListByWeather.json?' + userCookie + let urlObject = populateGetUrl(url,refHotShare) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.success == true) { + if(Array.isArray(result.items.daily)) { + for(let i=0; i 0) { + console.log(`\n找到${numBody}个资讯页宝箱body,开始尝试领取`) + for(let i=0; i 0) { + console.log(`\n找到${numBody}个收金币body,开始尝试领取`) + for(let i=0; i { + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log(caller + ": post请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + httpResult = JSON.parse(data,caller); + if(logDebug) console.log(httpResult); + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +async function httpGet(url,caller) { + httpResult = null + return new Promise((resolve) => { + $.get(url, async (err, resp, data) => { + try { + if (err) { + console.log(caller + ": get请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data,caller)) { + httpResult = JSON.parse(data); + if(logDebug) console.log(httpResult); + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +function safeGet(data,caller) { + try { + if (typeof JSON.parse(data) == "object") { + return true; + } else { + console.log(`Function ${caller}: 未知错误`); + console.log(data) + } + } catch (e) { + console.log(e); + console.log(`Function ${caller}: 服务器访问数据为空,请检查自身设备网络情况`); + return false; + } +} + +function printCaller(){ + return (new Error()).stack.split("\n")[2].trim().split(" ")[1] +} + +function Env(t, e) { class s { constructor(t) { this.env = t } send(t, e = "GET") { t = "string" == typeof t ? { url: t } : t; let s = this.get; return "POST" === e && (s = this.post), new Promise((e, i) => { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), a = { url: `http://${h}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(a, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null } setval(t, e) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null } initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) } get(t, e = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.get(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { try { if (t.headers["set-cookie"]) { const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar } } catch (t) { this.logErr(t) } }).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) })) } post(t, e = (() => { })) { if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.post(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) }); else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: s, ...i } = t; this.got.post(s, i).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) }) } } time(t) { let e = { "M+": (new Date).getMonth() + 1, "d+": (new Date).getDate(), "H+": (new Date).getHours(), "m+": (new Date).getMinutes(), "s+": (new Date).getSeconds(), "q+": Math.floor(((new Date).getMonth() + 3) / 3), S: (new Date).getMilliseconds() }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, ((new Date).getFullYear() + "").substr(4 - RegExp.$1.length))); for (let s in e) new RegExp("(" + s + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? e[s] : ("00" + e[s]).substr(("" + e[s]).length))); return t } msg(e = t, s = "", i = "", r) { const o = t => { if (!t) return t; if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : this.isSurge() ? { url: t } : void 0; if ("object" == typeof t) { if (this.isLoon()) { let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-url"]; return { openUrl: e, mediaUrl: s } } if (this.isQuanX()) { let e = t["open-url"] || t.url || t.openUrl, s = t["media-url"] || t.mediaUrl; return { "open-url": e, "media-url": s } } if (this.isSurge()) { let e = t.url || t.openUrl || t["open-url"]; return { url: e } } } }; this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))); let h = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="]; h.push(e), s && h.push(s), i && h.push(i), console.log(h.join("\n")), this.logs = this.logs.concat(h) } log(...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) } logErr(t, e) { const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); s ? this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack) : this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t) } wait(t) { return new Promise(e => setTimeout(e, t)) } done(t = {}) { const e = (new Date).getTime(), s = (e - this.startTime) / 1e3; this.log("", `\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } }(t, e) } diff --git a/jctq/jctq_friendSign.js b/jctq/jctq_friendSign.js deleted file mode 100644 index 598ddcf..0000000 --- a/jctq/jctq_friendSign.js +++ /dev/null @@ -1,125 +0,0 @@ -const $ = new Env("晶彩天气好友签到红包"); -const notify = $.isNode() ? require('./sendNotify') : ''; -message = "" -let jctqCookie= $.isNode() ? (process.env.jctqCookie ? process.env.jctqCookie : "") : ($.getdata('jctqCookie') ? $.getdata('jctqCookie') : "") -let jctqCookieArr = [] -let jctqCookies = "" - - if (typeof $request !== "undefined") { - getjctqCookie() - $.done() - } - - -if (!jctqCookie) { - $.msg($.name, '【提示】进入点击右下角"赚钱图标",再跑一次脚本', '不知道说啥好', { - "open-url": "给您劈个叉吧" - }); - $.done() - } - else if (jctqCookie.indexOf("@") == -1 && jctqCookie.indexOf("@") == -1) { - jctqCookieArr.push(jctqCookie) - } - else if (jctqCookie.indexOf("@") > -1) { - jctqCookies = jctqCookie.split("@") - } - else if (process.env.jctqCookie && process.env.jctqCookie.indexOf('@') > -1) { - jctqCookieArr = process.env.jctqCookie.split('@'); - console.log(`您选择的是用"@"隔开\n`) - } - else { - jctqCookies = [process.env.jctqCookie] - }; - Object.keys(jctqCookies).forEach((item) => { - if (jctqCookies[item]) { - jctqCookieArr.push(jctqCookies[item]) - } - }) - -!(async () => { - console.log(`共${jctqCookieArr.length}个cookie`) - for (let k = 0; k < jctqCookieArr.length; k++) { - $.message = "" - bodyVal = jctqCookieArr[k].split('&uid=')[0]; - cookie = bodyVal.replace(/zqkey=/, "cookie=") - cookie_id = cookie.replace(/zqkey_id=/, "cookie_id=") - var time1 = Date.parse( new Date() ).toString(); - time1 = time1.substr(0,10); - jctqCookie1= cookie_id + '&request_time=' + time1 + '&time=' + time1 +'&'+ bodyVal - //待处理cookie - //console.log(`${jctqCookie1}`) - console.log(`--------第 ${k + 1} 个账号好友查询中--------\n`) - await friendlist(jctqCookie1) - //await $.wait(4000); - console.log("\n\n") - } - - - })() - .catch((e) => $.logErr(e)) - .finally(() => $.done()) -//查询好友列表 -function friendlist(jctqCookie1,timeout = 0) { - return new Promise((resolve) => { - let url = { - url : 'https://tq.xunsl.com/WebApi/ShareSignNew/getFriendFinalList?'+jctqCookie1, - headers : {'Host': 'tq.xunsl.com', - 'Referer':'https://tq.xunsl.com/h5/20201020missionSign/?'+jctqCookie1 - }, - } - $.get(url, async (err, resp, data) => { - try { - - const result = JSON.parse(data) - if(result.success === true ){ - - for (let k=0;k { - let url = { - url : 'https://tq.xunsl.com/WebApi/ShareSignNew/sendScoreV2?friend_uid='+uid+'&'+jctqCookie1, - headers : {'Host': 'tq.xunsl.com', - 'Referer':'https://tq.xunsl.com/h5/20201020missionSign/?'+jctqCookie1 - }, - } - $.get(url, async (err, resp, data) => { - try { - - const result = JSON.parse(data) - if(result.success === true ){ - long=result.data.length - console.log('领取好友红包成功,获得:'+result.data[long-1].score + '金币') - - await $.wait(2000); - // await share(wzid) - - }else{ - console.log('\n该好友未签到或红包已完') - } - } catch (e) { - } finally { - resolve() - } - },timeout) - }) -} - -function Env(t,e){"undefined"!=typeof process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0);class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} diff --git a/jctq/jctq_kkz.js b/jctq/jctq_kkz.js new file mode 100644 index 0000000..89adf8b --- /dev/null +++ b/jctq/jctq_kkz.js @@ -0,0 +1,372 @@ +/* +安卓:水果天气(v8.3.9) + +此脚本负责: +完成看看赚任务 +*/ + +const jsname = '水果天气看看赚' +const $ = Env(jsname) +const notifyFlag = 1; //0为关闭通知,1为打开通知,默认为1 +const logDebug = 0 + +//const notify = $.isNode() ? require('./sendNotify') : ''; +let notifyStr = '' + +let rndtime = "" //毫秒 +let httpResult //global buffer + +let jctqCookie = ($.isNode() ? process.env.jctqCookie : $.getdata('jctqCookie')) || ''; +let jctqLookStartbody = ($.isNode() ? process.env.jctqLookStartbody : $.getdata('jctqLookStartbody')) || ''; + +let jctqCookieArr = [] +let jctqLookStartbodyArr = [] + +let userCookie = '' + +let bannerIdList = [] +//let duplicatedCount = 0 +let finishCount = 0 +let rewardAmount = 0 + + +/////////////////////////////////////////////////////////////////// + +!(async () => { + + if(typeof $request !== "undefined") + { + $.msg(jsname+': 此脚本不做重写,请检查重写设置') + } + else + { + if(!(await checkEnv())) { + return + } + + for(let i=0; i $.logErr(e)) +.finally(() => $.done()) + +//通知 +async function showmsg() { + + notifyBody = jsname + "运行通知\n\n" + notifyStr + + if (notifyFlag != 1) { + console.log(notifyBody); + } + + if (notifyFlag == 1) { + $.msg(notifyBody); + //if ($.isNode()){await notify.sendNotify($.name, notifyBody );} + } +} + +async function checkEnv() { + + if(!jctqLookStartbody) { + console.log(`未获取到看看赚body`) + return false + } + + if(jctqLookStartbody.indexOf('&') > -1) { + jctqLookStartbodyArr = jctqLookStartbody.split('&') + } else { + jctqLookStartbodyArr.push(jctqLookStartbody) + } + + let numBody = jctqLookStartbodyArr.length + console.log(`找到${numBody}个看看赚body`) + + if(jctqCookie) { + if(jctqCookie.indexOf('@') > -1) { + let jctqCookies = jctqCookie.split('@') + for(let i=0; i { + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log(caller + ": post请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + httpResult = JSON.parse(data,caller); + if(logDebug) console.log(httpResult); + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +async function httpGet(url,caller) { + httpResult = null + return new Promise((resolve) => { + $.get(url, async (err, resp, data) => { + try { + if (err) { + console.log(caller + ": get请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data,caller)) { + httpResult = JSON.parse(data); + if(logDebug) console.log(httpResult); + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +function safeGet(data,caller) { + try { + if (typeof JSON.parse(data) == "object") { + return true; + } else { + console.log(`Function ${caller}: 未知错误`); + console.log(data) + } + } catch (e) { + console.log(e); + console.log(`Function ${caller}: 服务器访问数据为空,请检查自身设备网络情况`); + return false; + } +} + +function printCaller(){ + return (new Error()).stack.split("\n")[2].trim().split(" ")[1] +} + +function Env(t, e) { class s { constructor(t) { this.env = t } send(t, e = "GET") { t = "string" == typeof t ? { url: t } : t; let s = this.get; return "POST" === e && (s = this.post), new Promise((e, i) => { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), a = { url: `http://${h}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(a, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null } setval(t, e) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null } initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) } get(t, e = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.get(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { try { if (t.headers["set-cookie"]) { const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar } } catch (t) { this.logErr(t) } }).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) })) } post(t, e = (() => { })) { if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.post(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) }); else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: s, ...i } = t; this.got.post(s, i).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) }) } } time(t) { let e = { "M+": (new Date).getMonth() + 1, "d+": (new Date).getDate(), "H+": (new Date).getHours(), "m+": (new Date).getMinutes(), "s+": (new Date).getSeconds(), "q+": Math.floor(((new Date).getMonth() + 3) / 3), S: (new Date).getMilliseconds() }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, ((new Date).getFullYear() + "").substr(4 - RegExp.$1.length))); for (let s in e) new RegExp("(" + s + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? e[s] : ("00" + e[s]).substr(("" + e[s]).length))); return t } msg(e = t, s = "", i = "", r) { const o = t => { if (!t) return t; if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : this.isSurge() ? { url: t } : void 0; if ("object" == typeof t) { if (this.isLoon()) { let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-url"]; return { openUrl: e, mediaUrl: s } } if (this.isQuanX()) { let e = t["open-url"] || t.url || t.openUrl, s = t["media-url"] || t.mediaUrl; return { "open-url": e, "media-url": s } } if (this.isSurge()) { let e = t.url || t.openUrl || t["open-url"]; return { url: e } } } }; this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))); let h = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="]; h.push(e), s && h.push(s), i && h.push(i), console.log(h.join("\n")), this.logs = this.logs.concat(h) } log(...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) } logErr(t, e) { const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); s ? this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack) : this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t) } wait(t) { return new Promise(e => setTimeout(e, t)) } done(t = {}) { const e = (new Date).getTime(), s = (e - this.startTime) / 1e3; this.log("", `\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } }(t, e) } diff --git a/jctq/jctq_read.js b/jctq/jctq_read.js new file mode 100644 index 0000000..4c7f92c --- /dev/null +++ b/jctq/jctq_read.js @@ -0,0 +1,258 @@ +/* +安卓:水果天气(v8.3.9) + +此脚本负责: +阅读文章,浏览视频 +*/ + +const jsname = '水果天气文章视频' +const $ = Env(jsname) +const notifyFlag = 1; //0为关闭通知,1为打开通知,默认为1 +const logDebug = 0 + +//const notify = $.isNode() ? require('./sendNotify') : ''; +let notifyStr = '' + +let rndtime = "" //毫秒 +let httpResult //global buffer + +let jctqTimeBody = ($.isNode() ? process.env.jctqTimeBody : $.getdata('jctqTimeBody')) || ''; +let jctqWzBody = ($.isNode() ? process.env.jctqWzBody : $.getdata('jctqWzBody')) || ''; +let jctqWzBodyArr = [] + +let bannerIdList = [] +let totalTime = 0 +let invalidCount = 0 +let finishCount = 0 +let rewardAmount = 0 + +/////////////////////////////////////////////////////////////////// + +!(async () => { + + if(typeof $request !== "undefined") + { + $.msg(jsname+': 此脚本不做重写,请检查重写设置') + } + else + { + if(!(await checkEnv())) { + return + } + + for(let i=0; i $.logErr(e)) +.finally(() => $.done()) + +//通知 +async function showmsg() { + + notifyBody = jsname + "运行通知\n\n" + notifyStr + + if (notifyFlag != 1) { + console.log(notifyBody); + } + + if (notifyFlag == 1) { + $.msg(notifyBody); + //if ($.isNode()){await notify.sendNotify($.name, notifyBody );} + } +} + +async function checkEnv() { + + if(!jctqWzBody) { + console.log(`未获取到文章视频body`) + return false + } + + if(jctqWzBody.indexOf('&') > -1) { + jctqWzBodyArr = jctqWzBody.split('&') + } else { + jctqWzBodyArr.push(jctqWzBody) + } + + if(jctqTimeBody && jctqTimeBody.indexOf('&') > -1) { + jctqTimeBodys = jctqTimeBody.split('&') + jctqTimeBody = jctqTimeBodys[0] + } + + let numWzBody = jctqWzBodyArr.length + console.log(`找到${numWzBody}个文章视频body`) + + return true +} + +/////////////////////////////////////////////////////////////////// + +//浏览文章 +async function readArticle(wzBody,idx) { + let caller = printCaller() + let url = 'https://tq.xunsl.com/v5/article/complete.json' + let urlObject = populatePostUrl(url,wzBody) + await httpPost(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.success == true) { + finishCount++ + let randomTime = Math.floor(Math.random()*10000)+60000 + let score = result.items.read_score || 0 + rewardAmount += parseInt(score) + console.log(`浏览第${idx+1}篇文章获得${score}金币,随机延迟${randomTime}ms后刷阅读时长`) + await $.wait(randomTime) + if(jctqTimeBody) { + await updateStayTime(jctqTimeBody) + } else { + console.log(`----没有找到时长body,不刷时长,请小心黑号`) + } + } else { + //invalidCount++ + //await removeBody(wzBody) + console.log(`浏览第${idx+1}篇文章失败:${result.message}`) + } +} + +//更新阅读时长 +async function updateStayTime(timeBody) { + let caller = printCaller() + let url = 'https://tq.xunsl.com/v5/user/stay.json' + let urlObject = populatePostUrl(url,timeBody) + await httpPost(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.success == true) { + totalTime = result.time + console.log(`----更新阅读时长成功,今天总阅读时长${result.time}秒`) + } else { + console.log(`----更新阅读时长失败:${result.message}`) + } +} + +//删除失效body +async function removeBody(wzBody) { + newBody = $.getdata('jctqWzBody').replace(wzBody,""); + newBody = newBody.replace("&&","&"); + $.setdata(newBody,'jctqWzBody'); +} + +//统计运行情况 +async function getStatus() { + notifyStr += `本次运行情况:\n` + notifyStr += `共阅读了${finishCount}篇文章/视频,获得${rewardAmount}金币,总阅读时长${totalTime}\n` + //if(invalidCount > 0) notifyStr += `删除了${invalidCount}个无效的body\n` +} + +//////////////////////////////////////////////////////////////////// +function populatePostUrl(url,reqBody){ + let rndtime = Math.floor(new Date().getTime()/1000) + let urlObject = { + url: url, + headers: { + 'request_time' : rndtime, + 'Host' : 'tq.xunsl.com', + 'device-model' : 'VOG-AL10', + 'device-platform' : 'android', + 'Connection' : 'keep-alive', + 'app-type' : 'jcweather', + }, + body: reqBody + } + return urlObject; +} + +function populateGetUrl(url){ + let rndtime = Math.floor(new Date().getTime()/1000) + let urlObject = { + url: url, + headers: { + 'request_time' : rndtime, + 'Host' : 'tq.xunsl.com', + 'device-model' : 'VOG-AL10', + 'device-platform' : 'android', + 'Connection' : 'keep-alive', + 'app-type' : 'jcweather', + } + } + return urlObject; +} + +async function httpPost(url,caller) { + httpResult = null + return new Promise((resolve) => { + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log(caller + ": post请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + httpResult = JSON.parse(data,caller); + if(logDebug) console.log(httpResult); + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +async function httpGet(url,caller) { + httpResult = null + return new Promise((resolve) => { + $.get(url, async (err, resp, data) => { + try { + if (err) { + console.log(caller + ": get请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data,caller)) { + httpResult = JSON.parse(data); + if(logDebug) console.log(httpResult); + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +function safeGet(data,caller) { + try { + if (typeof JSON.parse(data) == "object") { + return true; + } else { + console.log(`Function ${caller}: 未知错误`); + console.log(data) + } + } catch (e) { + console.log(e); + console.log(`Function ${caller}: 服务器访问数据为空,请检查自身设备网络情况`); + return false; + } +} + +function printCaller(){ + return (new Error()).stack.split("\n")[2].trim().split(" ")[1] +} + +function Env(t, e) { class s { constructor(t) { this.env = t } send(t, e = "GET") { t = "string" == typeof t ? { url: t } : t; let s = this.get; return "POST" === e && (s = this.post), new Promise((e, i) => { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), a = { url: `http://${h}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(a, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null } setval(t, e) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null } initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) } get(t, e = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.get(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { try { if (t.headers["set-cookie"]) { const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar } } catch (t) { this.logErr(t) } }).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) })) } post(t, e = (() => { })) { if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.post(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) }); else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: s, ...i } = t; this.got.post(s, i).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) }) } } time(t) { let e = { "M+": (new Date).getMonth() + 1, "d+": (new Date).getDate(), "H+": (new Date).getHours(), "m+": (new Date).getMinutes(), "s+": (new Date).getSeconds(), "q+": Math.floor(((new Date).getMonth() + 3) / 3), S: (new Date).getMilliseconds() }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, ((new Date).getFullYear() + "").substr(4 - RegExp.$1.length))); for (let s in e) new RegExp("(" + s + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? e[s] : ("00" + e[s]).substr(("" + e[s]).length))); return t } msg(e = t, s = "", i = "", r) { const o = t => { if (!t) return t; if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : this.isSurge() ? { url: t } : void 0; if ("object" == typeof t) { if (this.isLoon()) { let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-url"]; return { openUrl: e, mediaUrl: s } } if (this.isQuanX()) { let e = t["open-url"] || t.url || t.openUrl, s = t["media-url"] || t.mediaUrl; return { "open-url": e, "media-url": s } } if (this.isSurge()) { let e = t.url || t.openUrl || t["open-url"]; return { url: e } } } }; this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))); let h = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="]; h.push(e), s && h.push(s), i && h.push(i), console.log(h.join("\n")), this.logs = this.logs.concat(h) } log(...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) } logErr(t, e) { const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); s ? this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack) : this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t) } wait(t) { return new Promise(e => setTimeout(e, t)) } done(t = {}) { const e = (new Date).getTime(), s = (e - this.startTime) / 1e3; this.log("", `\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } }(t, e) } diff --git a/jctq/jctq_reward.js b/jctq/jctq_reward.js new file mode 100644 index 0000000..bd3a343 --- /dev/null +++ b/jctq/jctq_reward.js @@ -0,0 +1,373 @@ +/* +安卓:水果天气(v8.3.9) + +此脚本负责: +签到和翻倍,任务奖励领取,领首页福利视频奖励,首页统计今日收益,自动提现 + +请将定时放在看看赚和阅读任务后面 +如果不想自动提现的,请不要捉提现body,或者新建环境变量jctqWithdrawFlag,写成0 +*/ + +const jsname = '水果天气任务签到' +const $ = Env(jsname) +const notifyFlag = 1; //0为关闭通知,1为打开通知,默认为1 +const logDebug = 0 + +//const notify = $.isNode() ? require('./sendNotify') : ''; +let notifyStr = '' + +let rndtime = "" //毫秒 +let httpResult //global buffer + +let numBoxbody + +let jctqWithdrawFlag = ($.isNode() ? process.env.jctqWithdrawFlag : $.getdata('jctqWithdrawFlag')) || 1; +let jctqBoxbody = ($.isNode() ? process.env.jctqBoxbody : $.getdata('jctqBoxbody')) || ''; +let jctqQdBody = ($.isNode() ? process.env.jctqQdBody : $.getdata('jctqQdBody')) || ''; +let jctqSignDoubleBody = ($.isNode() ? process.env.jctqSignDoubleBody : $.getdata('jctqSignDoubleBody')) || ''; +let jctqWithdraw = ($.isNode() ? process.env.jctqWithdraw : $.getdata('jctqWithdraw')) || ''; +let jctqCookie = ($.isNode() ? process.env.jctqCookie : $.getdata('jctqCookie')) || ''; + +let jctqRewardBodyArr = [] +let jctqSignDoubleBodyArr = [] +let jctqWithdrawArr = [] +let jctqCookieArr = [] + +let withdrawSuccess = 0 + +/////////////////////////////////////////////////////////////////// + +!(async () => { + + if(typeof $request !== "undefined") + { + $.msg(jsname+': 此脚本不做重写,请检查重写设置') + } + else + { + await checkEnv() + + numBoxbody = jctqRewardBodyArr.length + console.log(`找到${numBoxbody}个签到/奖励body`) + + for(let i=0; i 0 && jctqWithdrawArr.length > 0) { + numBoxbody = jctqWithdrawArr.length + console.log(`找到${numBoxbody}个提现body`) + + for(let i=0; i $.logErr(e)) +.finally(() => $.done()) + +//通知 +async function showmsg() { + + notifyBody = jsname + "运行通知\n\n" + notifyStr + + if (notifyFlag != 1) { + console.log(notifyBody); + } + + if (notifyFlag == 1) { + $.msg(notifyBody); + //if ($.isNode()){await notify.sendNotify($.name, notifyBody );} + } +} + +async function checkEnv() { + + if(jctqCookie) { + if(jctqCookie.indexOf('@') > -1) { + let jctqCookies = jctqCookie.split('@') + for(let i=0; i -1) { + let jctqWithdraws = jctqWithdraw.split('&') + for(let i=0; i -1) { + let jctqQdBodyArr = jctqQdBody.split('&') + for(let i=0; i -1) { + let jctqBoxbodyArr = jctqBoxbody.split('&') + for(let i=0; i -1) { + let jctqSignDoubleBodys = jctqSignDoubleBody.split('&') + for(let i=0; i -1) signStr = '签到' + console.log(`领取第${idx+1}个奖励成功,${signStr}获得${result.items.score}金币`) + } + } else { + console.log(`领取第${idx+1}个奖励失败:${result.message}`) + } +} + +//签到翻倍 +async function toDouble(rewardBody) { + let caller = printCaller() + let url = 'https://tq.xunsl.com/v5/CommonReward/toDouble.json' + let urlObject = populatePostUrl(url,rewardBody) + await httpPost(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.success == true) { + if(result.items && result.items.score) { + console.log(`签到翻倍成功,获得${result.items.score}金币`) + } + } else { + console.log(`签到翻倍失败:${result.message}`) + } +} + +//今日收益 +async function getBalance(cookie) { + let caller = printCaller() + let url = 'https://tq.xunsl.com/wap/user/balance?keyword_wyq=woyaoq.com&' + cookie + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.status == 0) { + notifyStr += `【金币总数】:${result.user.score}\n` + notifyStr += `【今日收益】:${result.user.today_score}\n` + for(let i=0; i -1) { + for(let j=0; j { + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log(caller + ": post请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + httpResult = JSON.parse(data,caller); + if(logDebug) console.log(httpResult); + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +async function httpGet(url,caller) { + httpResult = null + return new Promise((resolve) => { + $.get(url, async (err, resp, data) => { + try { + if (err) { + console.log(caller + ": get请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data,caller)) { + httpResult = JSON.parse(data); + if(logDebug) console.log(httpResult); + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +function safeGet(data,caller) { + try { + if (typeof JSON.parse(data) == "object") { + return true; + } else { + console.log(`Function ${caller}: 未知错误`); + console.log(data) + } + } catch (e) { + console.log(e); + console.log(`Function ${caller}: 服务器访问数据为空,请检查自身设备网络情况`); + return false; + } +} + +function printCaller(){ + return (new Error()).stack.split("\n")[2].trim().split(" ")[1] +} + +function Env(t, e) { class s { constructor(t) { this.env = t } send(t, e = "GET") { t = "string" == typeof t ? { url: t } : t; let s = this.get; return "POST" === e && (s = this.post), new Promise((e, i) => { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), a = { url: `http://${h}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(a, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null } setval(t, e) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null } initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) } get(t, e = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.get(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { try { if (t.headers["set-cookie"]) { const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar } } catch (t) { this.logErr(t) } }).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) })) } post(t, e = (() => { })) { if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.post(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) }); else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: s, ...i } = t; this.got.post(s, i).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) }) } } time(t) { let e = { "M+": (new Date).getMonth() + 1, "d+": (new Date).getDate(), "H+": (new Date).getHours(), "m+": (new Date).getMinutes(), "s+": (new Date).getSeconds(), "q+": Math.floor(((new Date).getMonth() + 3) / 3), S: (new Date).getMilliseconds() }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, ((new Date).getFullYear() + "").substr(4 - RegExp.$1.length))); for (let s in e) new RegExp("(" + s + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? e[s] : ("00" + e[s]).substr(("" + e[s]).length))); return t } msg(e = t, s = "", i = "", r) { const o = t => { if (!t) return t; if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : this.isSurge() ? { url: t } : void 0; if ("object" == typeof t) { if (this.isLoon()) { let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-url"]; return { openUrl: e, mediaUrl: s } } if (this.isQuanX()) { let e = t["open-url"] || t.url || t.openUrl, s = t["media-url"] || t.mediaUrl; return { "open-url": e, "media-url": s } } if (this.isSurge()) { let e = t.url || t.openUrl || t["open-url"]; return { url: e } } } }; this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))); let h = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="]; h.push(e), s && h.push(s), i && h.push(i), console.log(h.join("\n")), this.logs = this.logs.concat(h) } log(...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) } logErr(t, e) { const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); s ? this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack) : this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t) } wait(t) { return new Promise(e => setTimeout(e, t)) } done(t = {}) { const e = (new Date).getTime(), s = (e - this.startTime) / 1e3; this.log("", `\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } }(t, e) } diff --git a/jctq/jctq_rewrite.js b/jctq/jctq_rewrite.js new file mode 100644 index 0000000..93e9d39 --- /dev/null +++ b/jctq/jctq_rewrite.js @@ -0,0 +1,263 @@ +/* +安卓:水果天气(v8.3.9) + +此脚本负责:捉包重写 + +脚本会自动提现,如果不想自动提现的,请不要捉提现body,或者新建环境变量jctqWithdrawFlag,写成0 + +重写: +https://tq.xunsl.com/v17/NewTask/getTaskListByWeather.json -- 点开任务页即可获取jctqCookie +https://tq.xunsl.com/v5/CommonReward/toGetReward.json -- 领取签到和任务奖励后获取。首页左方点击福利视频浮窗(一共5次,建议捉到第一个后复制4遍)。获取完建议关掉重写 +https://tq.xunsl.com/v5/article/info.json -- 点开文章获取文章body,获取完建议关掉重写 +https://tq.xunsl.com/v5/article/detail.json -- 点开视频获取视频body,获取完建议关掉重写 +https://tq.xunsl.com/v5/user/stay.json -- 阅读文章或者看视频一段时间后可以获取到时长body,获取完务必关掉重写,同一个账号不要获取多个时长body +https://tq.xunsl.com/v5/nameless/adlickstart.json -- 点开看看赚获取body,可以一直开着,看看赚会不定时更新 +https://tq.xunsl.com/v5/Weather/giveBoxOnWeather.json -- (旧版8.3.7)点开福利页浮窗宝箱和观看翻倍视频获取body,获取完建议关掉重写 +https://tq.xunsl.com/v5/weather/giveTimeInterval.json -- (旧版8.3.7)点开首页气泡红包和观看翻倍视频获取body,获取完建议关掉重写 +https://tq.xunsl.com/v5/Weather/giveReceiveGoldCoin.json -- 任务页点击一键收金币获取第一个body,收金币后看完视频领奖励获取第二个body +https://tq.xunsl.com/v17/Rvideo/videoCallback.json -- 资讯页右上角宝箱,看视频领取奖励后获取 +https://tq.xunsl.com/v5/wechat/withdraw2.json -- 提现一次对应金额获取body +https://tq.xunsl.com/v5/CommonReward/toDouble.json -- 领取签到翻倍奖励后可获取 + +任务: +jctq_daily.js -- 各种时段奖励,抽奖,转发 +jctq_reward.js -- 签到和翻倍,任务奖励领取,领首页福利视频奖励,首页统计今日收益,自动提现 +jctq_kkz.js -- 完成看看赚任务 +jctq_read.js -- 阅读文章,浏览视频 + +*/ + +const jsname = '晶彩天气捉包重写' +const $ = Env(jsname) +const notifyFlag = 1; //0为关闭通知,1为打开通知,默认为1 +const logDebug = 0 + +let jctqCookie = ($.isNode() ? process.env.jctqCookie : $.getdata('jctqCookie')) || ''; +let jctqBoxbody = ($.isNode() ? process.env.jctqBoxbody : $.getdata('jctqBoxbody')) || ''; +let jctqTimeBody = ($.isNode() ? process.env.jctqTimeBody : $.getdata('jctqTimeBody')) || ''; +let jctqWzBody = ($.isNode() ? process.env.jctqWzBody : $.getdata('jctqWzBody')) || ''; +let jctqLookStartbody = ($.isNode() ? process.env.jctqLookStartbody : $.getdata('jctqLookStartbody')) || ''; +let jctqWithdraw = ($.isNode() ? process.env.jctqWithdraw : $.getdata('jctqWithdraw')) || ''; +let jctqBubbleBody = ($.isNode() ? process.env.jctqBubbleBody : $.getdata('jctqBubbleBody')) || ''; +let jctqGiveBoxBody = ($.isNode() ? process.env.jctqGiveBoxBody : $.getdata('jctqGiveBoxBody')) || ''; +let jctqSignDoubleBody = ($.isNode() ? process.env.jctqSignDoubleBody : $.getdata('jctqSignDoubleBody')) || ''; +let jctqGoldBody = ($.isNode() ? process.env.jctqGoldBody : $.getdata('jctqGoldBody')) || ''; +let jctqVideoBody = ($.isNode() ? process.env.jctqVideoBody : $.getdata('jctqVideoBody')) || ''; + +/////////////////////////////////////////////////////////////////// + +!(async () => { + + if(typeof $request !== "undefined") + { + await getRewrite() + } else { + $.msg(jsname+': 此脚本只负责重写,请检查任务设置') + } + +})() +.catch((e) => $.logErr(e)) +.finally(() => $.done()) + +async function getRewrite() { + + if($request.url.indexOf('v17/NewTask/getTaskListByWeather.json') > -1) { + rUrl = $request.url + app_version = rUrl.match(/app_version=([\w\.]+)/)[1] + zqkey = rUrl.match(/zqkey=([\w-]+)/)[1] + zqkey_id = rUrl.match(/zqkey_id=([\w-]+)/)[1] + uid = rUrl.match(/uid=([\w]+)/)[1] + uidStr = 'uid=' + uid + + let newCookie = `app_version=${app_version}&cookie=${zqkey}&cookie_id=${zqkey_id}&uid=${uid}` + if(jctqCookie) { + if(jctqCookie.indexOf(uidStr) > -1) { + $.msg(jsname+` 此jctqCookie已存在,本次跳过`) + } else { + jctqCookie = jctqCookie + '@' + newCookie + $.setdata(jctqCookie, 'jctqCookie'); + bodyList = jctqCookie.split('@') + $.msg(jsname+` 获取第${bodyList.length}个jctqCookie成功`) + } + } else { + $.setdata(newCookie, 'jctqCookie'); + $.msg(jsname+` 获取第一个jctqCookie成功`) + } + } + + if($request.url.indexOf('v5/CommonReward/toGetReward.json') > -1) { + rBody = $request.body + if(jctqBoxbody) { + if(jctqBoxbody.indexOf(rBody) > -1) { + $.msg(jsname+` 此签到/奖励body已存在,本次跳过`) + } else { + jctqBoxbody = jctqBoxbody + '&' + rBody + $.setdata(jctqBoxbody, 'jctqBoxbody'); + bodyList = jctqBoxbody.split('&') + $.msg(jsname+` 获取第${bodyList.length}个签到/奖励body成功`) + } + } else { + $.setdata(rBody, 'jctqBoxbody'); + $.msg(jsname+` 获取第一个签到/奖励body成功`) + } + } + + if($request.url.indexOf('v5/article/info.json') > -1 || + $request.url.indexOf('v5/article/detail.json') > -1) { + rUrl = $request.url + bodys = rUrl.split('?p=') + rBody = 'p=' + bodys[1] + if(jctqWzBody) { + if(jctqWzBody.indexOf(rBody) > -1) { + $.msg(jsname+` 此文章/视频body已存在,本次跳过`) + } else { + jctqWzBody = jctqWzBody + '&' + rBody + $.setdata(jctqWzBody, 'jctqWzBody'); + bodyList = jctqWzBody.split('&') + $.msg(jsname+` 获取第${bodyList.length}个文章/视频body成功`) + } + } else { + $.setdata(rBody, 'jctqWzBody'); + $.msg(jsname+` 获取第一个文章/视频body成功`) + } + } + + if($request.url.indexOf('v5/user/stay.json') > -1) { + rBody = $request.body + if(jctqTimeBody) { + if(jctqTimeBody.indexOf(rBody) > -1) { + $.msg(jsname+` 此时长body已存在,本次跳过`) + } else { + jctqTimeBody = jctqTimeBody + '&' + rBody + $.setdata(jctqTimeBody, 'jctqTimeBody'); + bodyList = jctqTimeBody.split('&') + $.msg(jsname+` 获取第${bodyList.length}个时长body成功`) + } + } else { + $.setdata(rBody, 'jctqTimeBody'); + $.msg(jsname+` 获取第一个时长body成功`) + } + } + + if($request.url.indexOf('v5/nameless/adlickstart.json') > -1) { + rBody = $request.body + if(jctqLookStartbody) { + if(jctqLookStartbody.indexOf(rBody) > -1) { + $.msg(jsname+` 此看看赚body已存在,本次跳过`) + } else { + jctqLookStartbody = jctqLookStartbody + '&' + rBody + $.setdata(jctqLookStartbody, 'jctqLookStartbody'); + bodyList = jctqLookStartbody.split('&') + $.msg(jsname+` 获取第${bodyList.length}个看看赚body成功`) + } + } else { + $.setdata(rBody, 'jctqLookStartbody'); + $.msg(jsname+` 获取第一个看看赚body成功`) + } + } + + if($request.url.indexOf('v5/wechat/withdraw2.json') > -1) { + rBody = $request.body + if(jctqWithdraw) { + if(jctqWithdraw.indexOf(rBody) > -1) { + $.msg(jsname+` 此提现body已存在,本次跳过`) + } else { + jctqWithdraw = jctqWithdraw + '&' + rBody + $.setdata(jctqWithdraw, 'jctqWithdraw'); + bodyList = jctqWithdraw.split('&') + $.msg(jsname+` 获取第${bodyList.length}个提现body成功`) + } + } else { + $.setdata(rBody, 'jctqWithdraw'); + $.msg(jsname+` 获取第一个提现body成功`) + } + } + + if($request.url.indexOf('v5/Weather/giveBoxOnWeather.json') > -1) { + rBody = $request.body + if(jctqGiveBoxBody) { + if(jctqGiveBoxBody.indexOf(rBody) > -1) { + $.msg(jsname+` 此福利页宝箱/翻倍body已存在,本次跳过`) + } else { + jctqGiveBoxBody = jctqGiveBoxBody + '&' + rBody + $.setdata(jctqGiveBoxBody, 'jctqGiveBoxBody'); + bodyList = jctqGiveBoxBody.split('&') + $.msg(jsname+` 获取第${bodyList.length}个福利页宝箱/翻倍body成功`) + } + } else { + $.setdata(rBody, 'jctqGiveBoxBody'); + $.msg(jsname+` 获取第一个福利页宝箱/翻倍body成功`) + } + } + + if($request.url.indexOf('v5/weather/giveTimeInterval.json') > -1) { + rBody = $request.body + if(jctqBubbleBody) { + if(jctqBubbleBody.indexOf(rBody) > -1) { + $.msg(jsname+` 此首页气泡/翻倍body已存在,本次跳过`) + } else { + jctqBubbleBody = jctqBubbleBody + '&' + rBody + $.setdata(jctqBubbleBody, 'jctqBubbleBody'); + bodyList = jctqBubbleBody.split('&') + $.msg(jsname+` 获取第${bodyList.length}个首页气泡/翻倍body成功`) + } + } else { + $.setdata(rBody, 'jctqBubbleBody'); + $.msg(jsname+` 获取第一个首页气泡/翻倍body成功`) + } + } + + if($request.url.indexOf('v5/CommonReward/toDouble.json') > -1) { + rBody = $request.body + if(jctqSignDoubleBody) { + if(jctqSignDoubleBody.indexOf(rBody) > -1) { + $.msg(jsname+` 此签到翻倍body已存在,本次跳过`) + } else { + jctqSignDoubleBody = jctqSignDoubleBody + '&' + rBody + $.setdata(jctqSignDoubleBody, 'jctqSignDoubleBody'); + bodyList = jctqSignDoubleBody.split('&') + $.msg(jsname+` 获取第${bodyList.length}个签到翻倍body成功`) + } + } else { + $.setdata(rBody, 'jctqSignDoubleBody'); + $.msg(jsname+` 获取第一个签到翻倍body成功`) + } + } + + if($request.url.indexOf('v5/Weather/giveReceiveGoldCoin.json') > -1) { + rBody = $request.body + if(jctqGoldBody) { + if(jctqGoldBody.indexOf(rBody) > -1) { + $.msg(jsname+` 此收金币body已存在,本次跳过`) + } else { + jctqGoldBody = jctqGoldBody + '&' + rBody + $.setdata(jctqGoldBody, 'jctqGoldBody'); + bodyList = jctqGoldBody.split('&') + $.msg(jsname+` 获取第${bodyList.length}个收金币body成功`) + } + } else { + $.setdata(rBody, 'jctqGoldBody'); + $.msg(jsname+` 获取第一个收金币body成功`) + } + } + + if($request.url.indexOf('v17/Rvideo/videoCallback.json') > -1) { + rBody = $request.body + if(jctqVideoBody) { + if(jctqVideoBody.indexOf(rBody) > -1) { + $.msg(jsname+` 此资讯页视频奖励body已存在,本次跳过`) + } else { + jctqVideoBody = jctqVideoBody + '@' + rBody + $.setdata(jctqVideoBody, 'jctqVideoBody'); + bodyList = jctqVideoBody.split('@') + $.msg(jsname+` 获取第${bodyList.length}个资讯页视频奖励body成功`) + } + } else { + $.setdata(rBody, 'jctqVideoBody'); + $.msg(jsname+` 获取第一个资讯页视频奖励body成功`) + } + } +} + +//////////////////////////////////////////////////////////////////// +function Env(t, e) { class s { constructor(t) { this.env = t } send(t, e = "GET") { t = "string" == typeof t ? { url: t } : t; let s = this.get; return "POST" === e && (s = this.post), new Promise((e, i) => { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), a = { url: `http://${h}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(a, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null } setval(t, e) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null } initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) } get(t, e = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.get(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { try { if (t.headers["set-cookie"]) { const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar } } catch (t) { this.logErr(t) } }).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) })) } post(t, e = (() => { })) { if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.post(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) }); else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: s, ...i } = t; this.got.post(s, i).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) }) } } time(t) { let e = { "M+": (new Date).getMonth() + 1, "d+": (new Date).getDate(), "H+": (new Date).getHours(), "m+": (new Date).getMinutes(), "s+": (new Date).getSeconds(), "q+": Math.floor(((new Date).getMonth() + 3) / 3), S: (new Date).getMilliseconds() }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, ((new Date).getFullYear() + "").substr(4 - RegExp.$1.length))); for (let s in e) new RegExp("(" + s + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? e[s] : ("00" + e[s]).substr(("" + e[s]).length))); return t } msg(e = t, s = "", i = "", r) { const o = t => { if (!t) return t; if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : this.isSurge() ? { url: t } : void 0; if ("object" == typeof t) { if (this.isLoon()) { let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-url"]; return { openUrl: e, mediaUrl: s } } if (this.isQuanX()) { let e = t["open-url"] || t.url || t.openUrl, s = t["media-url"] || t.mediaUrl; return { "open-url": e, "media-url": s } } if (this.isSurge()) { let e = t.url || t.openUrl || t["open-url"]; return { url: e } } } }; this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))); let h = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="]; h.push(e), s && h.push(s), i && h.push(i), console.log(h.join("\n")), this.logs = this.logs.concat(h) } log(...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) } logErr(t, e) { const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); s ? this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack) : this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t) } wait(t) { return new Promise(e => setTimeout(e, t)) } done(t = {}) { const e = (new Date).getTime(), s = (e - this.startTime) / 1e3; this.log("", `\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } }(t, e) } diff --git a/jctq/jctq_rewrite_subscribe.json b/jctq/jctq_rewrite_subscribe.json index c83c209..9da565b 100644 --- a/jctq/jctq_rewrite_subscribe.json +++ b/jctq/jctq_rewrite_subscribe.json @@ -3,49 +3,81 @@ "type": "rewrite", "note": "仅供参考", "author": "leaf", - "resource": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite_subscribe.json", + "resource": "jctq_rewrite_subscribe.json", "mitmhost": [ "tq.xunsl.com" ], "rewrite": [ { - "match": "https://tq.xunsl.com/v5/nameless/adlickstart.json", - "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctqkkz.js", + "match": "https://tq.xunsl.com/v17/NewTask/getTaskListByWeather.json", + "stage": "req", + "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", "enable": true }, { - "match": "https://tq.xunsl.com/v17/NewTask/getTaskListByWeather.json", - "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_today_score.js", + "match": "https://tq.xunsl.com/v5/CommonReward/toGetReward.json", + "stage": "req", + "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", "enable": true }, { "match": "https://tq.xunsl.com/v5/article/info.json", - "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctqwz.js", + "stage": "req", + "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", "enable": true }, { "match": "https://tq.xunsl.com/v5/article/detail.json", - "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctqwz.js", + "stage": "req", + "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", "enable": true }, { "match": "https://tq.xunsl.com/v5/user/stay.json", - "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctqwz.js", + "stage": "req", + "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", "enable": true }, { - "match": "https://tq.xunsl.com/v5/CommonReward/toGetReward.json", - "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctqqd.js", + "match": "https://tq.xunsl.com/v5/nameless/adlickstart.json", + "stage": "req", + "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", "enable": true }, { - "match": "https://tq.xunsl.com/v5/CommonReward/toGetReward.json", - "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctqbox.js", + "match": "https://tq.xunsl.com/v5/wechat/withdraw2.json", + "stage": "req", + "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", "enable": true }, { - "match": "https://tq.xunsl.com/v5/wechat/withdraw2.json", - "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_withdraw.js", + "match": "https://tq.xunsl.com/v5/Weather/giveBoxOnWeather.json", + "stage": "req", + "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", + "enable": true + }, + { + "match": "https://tq.xunsl.com/v5/weather/giveTimeInterval.json", + "stage": "req", + "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", + "enable": true + }, + { + "match": "https://tq.xunsl.com/v5/CommonReward/toDouble.json", + "stage": "req", + "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", + "enable": true + }, + { + "match": "https://tq.xunsl.com/v5/Weather/giveReceiveGoldCoin.json", + "stage": "req", + "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", + "enable": true + }, + { + "match": "https://tq.xunsl.com/v17/Rvideo/videoCallback.json", + "stage": "req", + "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", "enable": true } ], @@ -55,92 +87,38 @@ { "name": "晶彩天气看看赚", "type": "cron", - "time": "21 8,20 * * *", - "job": { - "type": "runjs", - "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctqkkz.js" - }, - }, - { - "name": "晶彩天气每日收益", - "type": "cron", - "time": "18 22 * * *", - "job": { - "type": "runjs", - "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_today_score.js" - }, - }, - { - "name": "晶彩天气签到", - "type": "cron", - "time": "23 0,6 * * *", - "job": { - "type": "runjs", - "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctqqd.js" - }, - }, - { - "name": "晶彩天气文章", - "type": "cron", - "time": "12 7,19 * * *", - "job": { - "type": "runjs", - "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctqwz.js" - }, - }, - { - "name": "晶彩天气火爆转发", - "type": "cron", - "time": "12 6,12,18 * * *", - "job": { - "type": "runjs", - "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_share.js" - }, - }, - { - "name": "晶彩天气福利视频", - "type": "cron", - "time": "20 9,17 * * *", - "job": { - "type": "runjs", - "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_Adv_video.js" - }, - }, - { - "name": "晶彩抽奖", - "type": "cron", - "time": "31 8,16 * * *", + "time": "30 9,20 * * *", "job": { "type": "runjs", - "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_Rotary.js" - }, + "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_kkz.js" + } }, { - "name": "晶彩每日宝箱", + "name": "晶彩天气文章视频", "type": "cron", - "time": "24 21,22 * * *", + "time": "20 7,18 * * *", "job": { "type": "runjs", - "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctqbox.js" - }, + "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_read.js" + } }, { - "name": "晶彩好友签到红包", + "name": "晶彩天气日常任务", "type": "cron", - "time": "32 2,6,20 * * *", + "time": "15,45 * * * *", "job": { "type": "runjs", - "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_friendSign.js" - }, + "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_daily.js" + } }, { - "name": "晶彩天气提现", + "name": "晶彩天气任务签到", "type": "cron", - "time": "34 23 * * *", + "time": "30 22 * * *", "job": { "type": "runjs", - "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_withdraw.js" - }, + "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_reward.js" + } } ] } diff --git a/jctq/jctq_rewrite_subscribe.json.bak b/jctq/jctq_rewrite_subscribe.json.bak new file mode 100644 index 0000000..c38e922 --- /dev/null +++ b/jctq/jctq_rewrite_subscribe.json.bak @@ -0,0 +1,102 @@ +{ + "name": "晶彩天气重写订阅", + "type": "rewrite", + "note": "仅供参考", + "author": "leaf", + "resource": "jctq_rewrite_subscribe.json", + "mitmhost": [ + "tq.xunsl.com" + ], + "rewrite": [ + { + "match": "https://tq.xunsl.com/v17/NewTask/getTaskListByWeather.json", + "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", + "enable": true + }, + { + "match": "https://tq.xunsl.com/v5/CommonReward/toGetReward.json", + "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", + "enable": true + }, + { + "match": "https://tq.xunsl.com/v5/article/info.json", + "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", + "enable": true + }, + { + "match": "https://tq.xunsl.com/v5/article/detail.json", + "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", + "enable": true + }, + { + "match": "https://tq.xunsl.com/v5/user/stay.json", + "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", + "enable": true + }, + { + "match": "https://tq.xunsl.com/v5/nameless/adlickstart.json", + "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", + "enable": true + }, + { + "match": "https://tq.xunsl.com/v5/wechat/withdraw2.json", + "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", + "enable": true + }, + { + "match": "https://tq.xunsl.com/v5/Weather/giveBoxOnWeather.json", + "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", + "enable": true + }, + { + "match": "https://tq.xunsl.com/v5/weather/giveTimeInterval.json", + "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", + "enable": true + } + ], + "task": { + "type": "skip", + "list": [ + { + "name": "晶彩天气看看赚", + "type": "cron", + "time": "30 9,20 * * *", + "job": { + "type": "runjs", + "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_kkz.js" + }, + "running": true + }, + { + "name": "晶彩天气文章视频", + "type": "cron", + "time": "20 7,18 * * *", + "job": { + "type": "runjs", + "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_read.js" + }, + "running": true + }, + { + "name": "晶彩天气日常任务", + "type": "cron", + "time": "15,45 * * * *", + "job": { + "type": "runjs", + "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_daily.js" + }, + "running": true + }, + { + "name": "晶彩天气任务签到", + "type": "cron", + "time": "30 22 * * *", + "job": { + "type": "runjs", + "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_reward.js" + }, + "running": true + } + ] + } +} \ No newline at end of file diff --git a/jctq/jctq_share.js b/jctq/jctq_share.js deleted file mode 100644 index 0bc38f4..0000000 --- a/jctq/jctq_share.js +++ /dev/null @@ -1,199 +0,0 @@ -const $ = new Env("晶彩天气火爆转发"); -const notify = $.isNode() ? require('./sendNotify') : ''; -message = "" -let jctqCookie= $.isNode() ? (process.env.jctqCookie ? process.env.jctqCookie : "") : ($.getdata('jctqCookie') ? $.getdata('jctqCookie') : "") -let jctqCookieArr = [] -let jctqCookies = "" - -var myDate = new Date(); -var hour=myDate.getHours(); -console.log(hour) - - - - - if (!jctqCookie) { - $.msg($.name, '【提示】进入点击右下角"赚钱图标",再跑一次脚本', '不知道说啥好', { - "open-url": "给您劈个叉吧" - }); - $.done() - } - else if (jctqCookie.indexOf("@") == -1 && jctqCookie.indexOf("@") == -1) { - jctqCookieArr.push(jctqCookie) - } - else if (jctqCookie.indexOf("@") > -1) { - jctqCookies = jctqCookie.split("@") - } - else if (process.env.jctqCookie && process.env.jctqCookie.indexOf('@') > -1) { - jctqCookieArr = process.env.jctqCookie.split('@'); - console.log(`您选择的是用"@"隔开\n`) - } - else { - jctqCookies = [process.env.jctqCookie] - }; - Object.keys(jctqCookies).forEach((item) => { - if (jctqCookies[item]) { - jctqCookieArr.push(jctqCookies[item]) - } - }) - -!(async () => { - if (typeof $request !== "undefined") { - await getjctqCookie() - $.done()}else { - console.log(`共${jctqCookieArr.length}个cookie`) - for (let k = 0; k < jctqCookieArr.length; k++) { - // $.message = "" - //bodyVal2 =jctqCookie2.split('&token=')[0] - //console.log(`${bodyVal2}`) - - - if (hour > 4 && hour !== 10 && hour !== 16 && hour !== 22) { - var time1 = Date.parse(new Date()).toString(); - time1 = time1.substr(0, 10); - bodyVal = jctqCookieArr[k].split('&uid=')[0]; - cookie = bodyVal.replace(/zqkey=/, "cookie=") - cookie_id = cookie.replace(/zqkey_id=/, "cookie_id=") - jctqCookie1 = cookie_id + '&device_brand=xfdg&device_id=cc7dgdsgfsz83e&device_model=1gx&device_platform=android&device_type=android&inner_version=202107261526&mi=0&openudid=cc7dgdsgfsz83e&os_api=27&os_version=bdftgsdfga&phone_network=WIFI&phone_sim=1' + '&request_time=' + time1 + '&time=' + time1 + '&' + bodyVal - - //待处理cookie - - //console.log(`${jctqCookie1}`) - console.log(`--------第 ${k + 1} 次转发奖励执行中--------\n`) - - await wzlist() - await $.wait(4000); - await sharejl() - //console.log(typeof(jctqCookie1)); - //console.log(jctqCookie1.length.toString()); - await $.wait(4000); - console.log("\n\n") - } else { - console.log('\n现在不是转发时段!') - } - } - } - })() - .catch((e) => $.logErr(e)) - .finally(() => $.done()) - -function wzlist(timeout = 5000) { - return new Promise((resolve) => { - let url = { - url : 'https://tq.xunsl.com/WebApi/ArticleTop/listsNewTag', - headers : {'Host': 'tq.xunsl.com'}, - //body : wzbody1, - }//xsgbody,} - $.post(url, async (err, resp, data) => { - try { - - const result = JSON.parse(data) - if(result.data.items !== "undefined" ){ - wzid = result.data.items[0].id - console.log(result.data.items[0].id) - await $.wait(3000); - await share(wzid) - - }else{ - console.log(result) - } - } catch (e) { - } finally { - resolve() - } - },timeout) - }) -} - -function share(wzid,timeout=0) { - return new Promise((resolve) => { - let url = { - url : 'https://tq.xunsl.com/WebApi/ShareNew/getShareArticleReward', - headers : { - 'Content-Type': 'application/x-www-form-urlencoded', - 'Content-Length': (jctqCookie1+ '&article_id='+wzid).length.toString(), - 'Host': 'tq.xunsl.com', - 'Referer': 'https://tq.xunsl.com/h5/hotShare/?' +jctqCookie1 -}, - body : jctqCookie1 + '&article_id='+wzid,} - $.post(url, async (err, resp, data) => { - try { - - const result = JSON.parse(data) - if(result.status == 1){ - console.log(result.data) - }else{ - console.log(result) - } - } catch (e) { - } finally { - resolve() - } - },timeout) - }) -} - -function sharejl(timeout=0) { - return new Promise((resolve) => { - if(hour >= 5 && hour <=10 ){ - reward = 'one' - }else if(hour >= 11 && hour <=16){ - reward = 'two' - }else if(hour >= 17 && hour <=22){ - reward = 'three' - } - let url = { - url : 'https://tq.xunsl.com/WebApi/ShareNew/execExtractTask', - headers : { - 'Content-Type': 'application/x-www-form-urlencoded', - 'Content-Length': (jctqCookie1+ '&action=beread_extra_reward_'+ reward).length.toString(), - 'Host': 'tq.xunsl.com', - 'Referer': 'https://tq.xunsl.com/h5/20200612makeMoney/?' +jctqCookie1 -}, - body : jctqCookie1 + '&action=beread_extra_reward_'+ reward,} - $.post(url, async (err, resp, data) => { - try { - - const result = JSON.parse(data) - if(result.status == 1){ - console.log(result.data) - }else{ - console.log(result) - } - } catch (e) { - } finally { - resolve() - } - },timeout) - }) -} - - -async function getjctqCookie() { - if ($request.url.match(/\/tq.xunsl.com\/v17\/NewTask\/getTaskList/)) { - bodyVal1 = $request.url.split('?')[1] - bodyVal2 = bodyVal1.split('&token')[0] - bodyVal3 = bodyVal2.split('&zqkey=')[1] - bodyVal4 = bodyVal2.split('&uid=')[1] - bodyVal5 = bodyVal4.split('&version_code=')[0] - bodyVal = 'zqkey='+ bodyVal3 + '&uid='+ bodyVal5 - if (jctqCookie) { - if (jctqCookie.indexOf(bodyVal5) > -1) { - $.log("此cookie已存在,本次跳过") - } else if (jctqCookie.indexOf(bodyVal5) === -1) { - jctqCookies = jctqCookie + "@" + bodyVal; - $.setdata(jctqCookies, 'jctqCookie'); - $.log(`${$.name}获取cookie: 成功, jctqCookies: ${bodyVal}`); - bodys = jctqCookies.split("@") - // $.msg($.name, "获取第" + bodys.length + "个阅读请求: 成功🎉", ``) - } - } else { - $.setdata(bodyVal, 'jctqCookie'); - $.log(`${$.name}获取cookie: 成功, jctqCookies: ${bodyVal}`); - $.msg($.name, `获取第一个cookie: 成功🎉`, ``) - } - } - - } - -function Env(t,e){"undefined"!=typeof process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0);class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file diff --git a/jctq/jctq_shareRead.js b/jctq/jctq_shareRead.js new file mode 100644 index 0000000..b534a65 --- /dev/null +++ b/jctq/jctq_shareRead.js @@ -0,0 +1,331 @@ +/* +安卓:晶彩天气(v8.3.7) + +转发和分享阅读,请勿贪心,小心黑号 +*/ + +const jsname = '晶彩天气分享阅读' +const $ = Env(jsname) +const notifyFlag = 1; //0为关闭通知,1为打开通知,默认为1 +const logDebug = 0 + +//const notify = $.isNode() ? require('./sendNotify') : ''; +let notifyStr = '' + +let rndtime = "" //毫秒 +let httpResult //global buffer + +let jctqCookie = ($.isNode() ? process.env.jctqCookie : $.getdata('jctqCookie')) || ''; +let jctqCookieArr = [] + +let userCk = '' +let readCount = 0 + +let jctqShareNum = ($.isNode() ? process.env.jctqShareNum : $.getdata('jctqShareNum')) || 0; + +let newsItem = '' +let UserAgent = '' +let si = '' + +/////////////////////////////////////////////////////////////////// + +!(async () => { + + if(typeof $request !== "undefined") + { + $.msg(jsname+': 此脚本不做重写,请检查重写设置') + } + else + { + if(!(await checkEnv())){ + return + } + + for(let j=0; j maxWaitTime ? maxWaitTime : seedFactor + let randomTime = Math.floor(Math.random()*factor) + 1000 + let second = Math.floor(randomTime/1000) + UserAgent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.16(0x1800102c) NetType/WIFI Language/zh_CN' + si = randomString(32) + console.log(`--随机延迟${second}秒后开始模拟第${readCount}次分享阅读`) + await $.wait(randomTime) + console.log(`----模拟第${readCount}次阅读,使用si=${si}`) + await shareReadStep1() + await $.wait(Math.floor(Math.random()*500)+500) + await shareReadStep2() + await $.wait(Math.floor(Math.random()*1000)+2000) + await shareReadStep3() + await $.wait(Math.floor(Math.random()*1000)+2000) + await shareReadStep4() + console.log(`----模拟第${readCount}次阅读完成`) + } + + } + } + } + + +})() +.catch((e) => $.logErr(e)) +.finally(() => $.done()) + +//通知 +async function showmsg() { + + notifyBody = jsname + "运行通知\n\n" + notifyStr + + if (notifyFlag != 1) { + console.log(notifyBody); + } + + if (notifyFlag == 1) { + $.msg(notifyBody); + //if ($.isNode()){await notify.sendNotify($.name, notifyBody );} + } +} + +async function checkEnv() { + + if(jctqShareNum == 0) { + console.log('当前分享次数设置为0。如果需要开启分享阅读,请设置环境变量jctqShareNum为要被阅读的次数。') + return false + } + + if(jctqCookie) { + if(jctqCookie.indexOf('@') > -1) { + let jctqCookies = jctqCookie.split('@') + for(let i=0; i { + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log(caller + ": post请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + httpResult = JSON.parse(data,caller); + if(logDebug) console.log(httpResult); + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +async function httpGet(url,caller) { + httpResult = null + return new Promise((resolve) => { + $.get(url, async (err, resp, data) => { + try { + if (err) { + console.log(caller + ": get请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + // + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +function safeGet(data,caller) { + try { + if (typeof JSON.parse(data) == "object") { + return true; + } else { + console.log(`Function ${caller}: 未知错误`); + console.log(data) + } + } catch (e) { + console.log(e); + console.log(`Function ${caller}: 服务器访问数据为空,请检查自身设备网络情况`); + return false; + } +} + +function printCaller(){ + return (new Error()).stack.split("\n")[2].trim().split(" ")[1] +} + +function Env(t, e) { class s { constructor(t) { this.env = t } send(t, e = "GET") { t = "string" == typeof t ? { url: t } : t; let s = this.get; return "POST" === e && (s = this.post), new Promise((e, i) => { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), a = { url: `http://${h}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(a, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null } setval(t, e) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null } initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) } get(t, e = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.get(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { try { if (t.headers["set-cookie"]) { const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar } } catch (t) { this.logErr(t) } }).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) })) } post(t, e = (() => { })) { if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.post(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) }); else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: s, ...i } = t; this.got.post(s, i).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) }) } } time(t) { let e = { "M+": (new Date).getMonth() + 1, "d+": (new Date).getDate(), "H+": (new Date).getHours(), "m+": (new Date).getMinutes(), "s+": (new Date).getSeconds(), "q+": Math.floor(((new Date).getMonth() + 3) / 3), S: (new Date).getMilliseconds() }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, ((new Date).getFullYear() + "").substr(4 - RegExp.$1.length))); for (let s in e) new RegExp("(" + s + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? e[s] : ("00" + e[s]).substr(("" + e[s]).length))); return t } msg(e = t, s = "", i = "", r) { const o = t => { if (!t) return t; if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : this.isSurge() ? { url: t } : void 0; if ("object" == typeof t) { if (this.isLoon()) { let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-url"]; return { openUrl: e, mediaUrl: s } } if (this.isQuanX()) { let e = t["open-url"] || t.url || t.openUrl, s = t["media-url"] || t.mediaUrl; return { "open-url": e, "media-url": s } } if (this.isSurge()) { let e = t.url || t.openUrl || t["open-url"]; return { url: e } } } }; this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))); let h = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="]; h.push(e), s && h.push(s), i && h.push(i), console.log(h.join("\n")), this.logs = this.logs.concat(h) } log(...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) } logErr(t, e) { const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); s ? this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack) : this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t) } wait(t) { return new Promise(e => setTimeout(e, t)) } done(t = {}) { const e = (new Date).getTime(), s = (e - this.startTime) / 1e3; this.log("", `\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } }(t, e) } diff --git a/jctq/jctq_task_subscribe.json b/jctq/jctq_task_subscribe.json index 1e27df5..4064c76 100644 --- a/jctq/jctq_task_subscribe.json +++ b/jctq/jctq_task_subscribe.json @@ -1,98 +1,48 @@ { - "name": "晶彩天气任务订阅", + "name": "晶彩天气重写订阅", + "type": "rewrite", + "note": "仅供参考", "author": "leaf", - "note": "请自行修改运行时间", - "date": "2021-11-12 00:08:11", "list": [ - { - "name": "晶彩天气看看赚", - "type": "cron", - "time": "21 8,20 * * *", - "job": { - "type": "runjs", - "target": "jctqkkz.js" - } - }, - { - "name": "晶彩天气每日收益", - "type": "cron", - "time": "18 22 * * *", - "job": { - "type": "runjs", - "target": "jctq_today_score.js" - } - }, - { - "name": "晶彩天气签到", - "type": "cron", - "time": "23 0,6 * * *", - "job": { - "type": "runjs", - "target": "jctqqd.js" - } - }, - { - "name": "晶彩天气文章", - "type": "cron", - "time": "12 7,19 * * *", - "job": { - "type": "runjs", - "target": "jctqwz.js" - } - }, - { - "name": "晶彩天气火爆转发", - "type": "cron", - "time": "12 6,12,18 * * *", - "job": { - "type": "runjs", - "target": "jctq_share.js" - } - }, - { - "name": "晶彩天气福利视频", - "type": "cron", - "time": "20 9,17 * * *", - "job": { - "type": "runjs", - "target": "jctq_Adv_video.js" - } - }, - { - "name": "晶彩天气抽奖", - "type": "cron", - "time": "31 8,16 * * *", - "job": { - "type": "runjs", - "target": "jctq_Rotary.js" - } - }, - { - "name": "晶彩天气每日宝箱", - "type": "cron", - "time": "24 21,22 * * *", - "job": { - "type": "runjs", - "target": "jctqbox.js" - } - }, - { - "name": "晶彩天气好友红包", - "type": "cron", - "time": "32 2,6,20 * * *", - "job": { - "type": "runjs", - "target": "jctq_friendSign.js" - } - }, - { - "name": "晶彩天气提现", - "type": "cron", - "time": "34 23 * * *", - "job": { - "type": "runjs", - "target": "jctq_withdraw.js" - } - } - ] -} + { + "name": "晶彩天气看看赚", + "type": "cron", + "time": "30 9,20 * * *", + "job": { + "type": "runjs", + "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_kkz.js" + }, + "running": true + }, + { + "name": "晶彩天气文章视频", + "type": "cron", + "time": "20 7,18 * * *", + "job": { + "type": "runjs", + "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_read.js" + }, + "running": true + }, + { + "name": "晶彩天气日常任务", + "type": "cron", + "time": "15,45 * * * *", + "job": { + "type": "runjs", + "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_daily.js" + }, + "running": true + }, + { + "name": "晶彩天气任务签到", + "type": "cron", + "time": "30 22 * * *", + "job": { + "type": "runjs", + "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_reward.js" + }, + "running": true + } + ] +} \ No newline at end of file diff --git a/jctq/jctq_today_score.js b/jctq/jctq_today_score.js deleted file mode 100644 index 4b760e6..0000000 --- a/jctq/jctq_today_score.js +++ /dev/null @@ -1,134 +0,0 @@ -const $ = new Env("晶彩天气收益统计"); -const notify = $.isNode() ? require('./sendNotify') : ''; -message = "" -let jctqCookie= $.isNode() ? (process.env.jctqCookie ? process.env.jctqCookie : "") : ($.getdata('jctqCookie') ? $.getdata('jctqCookie') : "") -let jctqCookieArr = [] -let jctqCookies = "" - - - - - -if (!jctqCookie) { - $.msg($.name, '【提示】进入点击右下角"赚钱图标",再跑一次脚本', '不知道说啥好', { - "open-url": "给您劈个叉吧" - }); - $.done() - } - else if (jctqCookie.indexOf("@") == -1 && jctqCookie.indexOf("@") == -1) { - jctqCookieArr.push(jctqCookie) - } - else if (jctqCookie.indexOf("@") > -1) { - jctqCookies = jctqCookie.split("@") - } - else if (process.env.jctqCookie && process.env.jctqCookie.indexOf('@') > -1) { - jctqCookieArr = process.env.jctqCookie.split('@'); - console.log(`您选择的是用"@"隔开\n`) - } - else { - jctqCookies = [process.env.jctqCookie] - }; - Object.keys(jctqCookies).forEach((item) => { - if (jctqCookies[item]) { - jctqCookieArr.push(jctqCookies[item]) - } - }) - -!(async () => { - if (typeof $request !== "undefined") { - getjctqCookie() - $.done() - }else { - console.log(`共${jctqCookieArr.length}个cookie`) - for (let k = 0; k < jctqCookieArr.length; k++) { - $.message = "" - bodyVal = jctqCookieArr[k].split('&uid=')[0]; - cookie = bodyVal.replace(/zqkey=/, "cookie=") - cookie_id = cookie.replace(/zqkey_id=/, "cookie_id=") - jctqCookie1 = cookie_id + '&' + bodyVal - //待处理cookie - console.log(`${jctqCookie1}`) - console.log(`--------第 ${k + 1} 个账号收益查询中--------\n`) - await today_score(jctqCookie1) - if ($.message.length != 0) { - message += "账号" + (k + 1) + ": " + $.message + " \n" - } - await $.wait(4000); - console.log("\n\n") - } - - - if (message.length != 0) { - await notify ? notify.sendNotify("晶彩天气收益查询", `${message}\n\n shaolin-kongfu`) : - $.msg($.name, "晶彩天气收益查询", `${message}`); - } else if ($.isNode()) { - await notify.sendNotify("晶彩天气收益查询", `${message}\n\nshaolin-kongfu`); - } - } - })() - .catch((e) => $.logErr(e)) - .finally(() => $.done()) - - -function today_score(jctqCookie1,timeout = 0) { - return new Promise((resolve) => { - let url = { - url : 'https://tq.xunsl.com/wap/user/balance?'+ jctqCookie1, - headers : { - 'Host': 'tq.xunsl.com' -}, - } - $.get(url, async (err, resp, data) => { - try { - - const result = JSON.parse(data) - if(result.status == 0){ - console.log('\n今日收益总计:'+result.user.today_score) - console.log('\n当前金币总数:'+result.user.score) - console.log('\n折合人民币总数:'+result.user.money) - $.message = `今日收益总计:${result.user.today_score}金币\n 当前金币总数:${result.user.score} \n 折合人民币总数:${result.user.money}元` - $.msg($.name, "", `今日收益总计:${result.user.today_score}金币\n 当前金币总数:${result.user.score} \n 折合人民币总数:${result.user.money}元`); - }else{ - console.log(result) - } - } catch (e) { - } finally { - resolve() - } - },timeout) - }) -} - - - -async function getjctqCookie() { - if ($request.url.match(/\/tq.xunsl.com\/v17\/NewTask\/getTaskList/)) { - bodyVal1 = $request.url.split('?')[1] - bodyVal2 = bodyVal1.split('&token')[0] - bodyVal3 = bodyVal2.split('&zqkey=')[1] - bodyVal4 = bodyVal2.split('&uid=')[1] - bodyVal5 = bodyVal4.split('&version_code=')[0] - bodyVal = 'zqkey='+ bodyVal3 + '&uid='+ bodyVal5 - if (jctqCookie) { - if (jctqCookie.indexOf(bodyVal5) > -1) { - $.log("此cookie已存在,本次跳过") - } else if (jctqCookie.indexOf(bodyVal5) === -1) { - jctqCookies = jctqCookie + "@" + bodyVal; - $.setdata(jctqCookies, 'jctqCookie'); - $.log(`${$.name}获取cookie: 成功, jctqCookies: ${bodyVal}`); - bodys = jctqCookies.split("@") - $.msg($.name, "获取第" + bodys.length + "个cookie: 成功🎉", ``) - } - } else { - $.setdata(bodyVal, 'jctqCookie'); - $.log(`${$.name}获取cookie: 成功, jctqCookies: ${bodyVal}`); - $.msg($.name, `获取第一个cookie: 成功🎉`, ``) - } - } - - } - -function Env(t,e){"undefined"!=typeof process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0);class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} - - - diff --git a/jctq/jctq_withdraw.js b/jctq/jctq_withdraw.js deleted file mode 100644 index 636e5be..0000000 --- a/jctq/jctq_withdraw.js +++ /dev/null @@ -1,206 +0,0 @@ -const $ = new Env("晶彩天气提现"); -const notify = $.isNode() ? require('./sendNotify') : ''; -message = "" -let jctqWithdraw= $.isNode() ? (process.env.jctqWithdraw ? process.env.jctqWithdraw : "") : ($.getdata('jctqWithdraw') ? $.getdata('jctqWithdraw') : "") -let jctqWithdrawArr = [] -let jctqWithdraws = "" -let jc_cash = $.getdata('jc_cash') || 0.3; -let jctqCookie= $.isNode() ? (process.env.jctqCookie ? process.env.jctqCookie : "") : ($.getdata('jctqCookie') ? $.getdata('jctqCookie') : "") -let jctqCookieArr = [] -let jctqCookies = "" -let nowmoney; - - - -var time1 = Date.parse( new Date() ).toString(); - time1 = time1.substr(0,10); -if (!jctqWithdraw) { - $.msg($.name, '【提示】请先完成一次提现,明天再跑一次脚本', '不知道说啥好', { - "open-url": "给您劈个叉吧" - }); - - $.done() - } - else if (jctqWithdraw.indexOf("@") == -1 && jctqWithdraw.indexOf("@") == -1) { - jctqWithdrawArr.push(jctqWithdraw) - } - else if (jctqWithdraw.indexOf("@") > -1) { - jctqWithdraws = jctqWithdraw.split("@") - } - else if (process.env.jctqWithdraw && process.env.jctqWithdraw.indexOf('@') > -1) { - jctqWithdrawArr = process.env.jctqWithdraw.split('@'); - console.log(`您选择的是用"@"隔开\n`) - } - else { - jctqWithdraws = [process.env.jctqWithdraw] - }; - Object.keys(jctqWithdraws).forEach((item) => { - if (jctqWithdraws[item]) { - jctqWithdrawArr.push(jctqWithdraws[item]) - } - }) - - -if (!jctqCookie) { - $.msg($.name, '【提示】进入点击右下角"赚钱图标",再跑一次脚本', '不知道说啥好', { - "open-url": "给您劈个叉吧" - }); - $.done() - } - else if (jctqCookie.indexOf("@") == -1 && jctqCookie.indexOf("@") == -1) { - jctqCookieArr.push(jctqCookie) - } - else if (jctqCookie.indexOf("@") > -1) { - jctqCookies = jctqCookie.split("@") - } - else if (process.env.jctqCookie && process.env.jctqCookie.indexOf('@') > -1) { - jctqCookieArr = process.env.jctqCookie.split('@'); - console.log(`您选择的是用"@"隔开\n`) - } - else { - jctqCookies = [process.env.jctqCookie] - }; - Object.keys(jctqCookies).forEach((item) => { - if (jctqCookies[item]) { - jctqCookieArr.push(jctqCookies[item]) - } - }) - -!(async () => { - if (typeof $request !== "undefined") { - getbody() - $.done() - }else { - console.log(`共${jctqCookieArr.length}个cookie`) - for (let k = 0; k < jctqCookieArr.length; k++) { - $.message = "" - bodyVal = jctqCookieArr[k].split('&uid=')[0]; - cookie = bodyVal.replace(/zqkey=/, "cookie=") - cookie_id = cookie.replace(/zqkey_id=/, "cookie_id=") - jctqCookie1 = cookie_id + '&' + bodyVal - //待处理cookie - console.log(`--------第 ${k + 1} 个账号收益查询中--------\n`) - jctqWithdraw1 = jctqWithdrawArr[k] - await today_score(jctqCookie1) - - - if ($.message.length != 0) { - message += "账号" + (k + 1) + ": " + $.message + " \n" - } - await $.wait(4000); - console.log("\n\n") - } - - - if (message.length != 0) { - await notify ? notify.sendNotify("晶彩天气提现", `${message}\n\n shaolin-kongfu`) : - $.msg($.name, "晶彩天气提现", `${message}\n\n shaolin-kongfu`); - } else if ($.isNode()) { - await notify.sendNotify("晶彩天气提现", `${message}\n\nshaolin-kongfu`); - } - } - })() - .catch((e) => $.logErr(e)) - .finally(() => $.done()) - - - -function withdraw(jctqWithdraw1,timeout = 0) { - return new Promise((resolve) => { - let url = { - url : 'https://tq.xunsl.com/v5/wechat/withdraw2.json', - headers : { - 'request_time' : time1, - 'access' : 'WIFI', - 'os-api' : '29', - 'app-type' : 'jcweather', - 'device-platform' : 'android', - 'app-version' : '8.3.7', - 'Content-Type' : 'application/x-www-form-urlencoded', - 'Host' : 'tq.xunsl.com', - 'Connection' : 'Keep-Alive', - 'Accept-Encoding' : 'gzip', - 'User-Agent' : 'okhttp/3.12.2', - }, - body : jctqWithdraw1,} - $.post(url, async (err, resp, data) => { - try { - - const result = JSON.parse(data) - if (result.error_code == 0) { - console.log(result) - console.log(`【自动提现】提现${jc_cash}元成功\n`) - $.message = `【自动提现】提现${jc_cash}元成功\n` - //$.msg($.name,$.sub,$.desc) - } else { - console.log(result) - } - } catch (e) { - } finally { - resolve() - } - },timeout) - }) -} - - -function getbody() { - if ($request.url.match(/\/tq.xunsl.com\/v5\/wechat\/withdraw2.json/)) { - bodyVal=$request.body - console.log(bodyVal) - if (jctqWithdraw) { - if (jctqWithdraw.indexOf(bodyVal) > -1) { - $.log("此提现请求已存在,本次跳过") - } else if (jctqWithdraw.indexOf(bodyVal) == -1) { - jctqWithdraws = jctqWithdraw + "@" + bodyVal; - $.setdata(jctqWithdraws,'jctqWithdraw'); - $.log(`${$.name}获取提现: 成功, jctqWithdraws: ${bodyVal}`); - bodys = jctqWithdraws.split("@") - $.msg($.name, "获取第" + bodys.length + "个提现请求: 成功🎉", ``) - } - } else { - $.setdata($request.body,'jctqWithdraw'); - $.log(`${$.name}获取提现: 成功, jctqWithdraws: ${bodyVal}`); - $.msg($.name, `获取第一个提现请求: 成功🎉`, ``) - } - } -} - - -function today_score(jctqCookie1,timeout = 0) { - return new Promise((resolve) => { - let url = { - url : 'https://tq.xunsl.com/wap/user/balance?'+ jctqCookie1, - headers : { - 'Host': 'tq.xunsl.com' -}, - } - $.get(url, async (err, resp, data) => { - try { - - const result = JSON.parse(data) - if(result.status == 0){ - - console.log('\n当前金币总数:'+result.user.score) - console.log('\n折合人民币总数:'+result.user.money) - nowmoney = result.user.money - if(nowmoney >= jc_cash){ - await $.wait(3000); - await withdraw(jctqWithdraw1) - } - $.message = `当前金币总数:${result.user.score} \n 折合人民币总数:${result.user.money}元` - //$.msg($.name, "", `当前金币总数:${result.user.score} \n 折合人民币总数:${result.user.money}元`); - }else{ - console.log(result) - } - } catch (e) { - } finally { - resolve() - } - },timeout) - }) -} - -function Env(t,e){"undefined"!=typeof process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0);class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} - - diff --git a/jctq/jctqbox.js b/jctq/jctqbox.js deleted file mode 100644 index 4645d9d..0000000 --- a/jctq/jctqbox.js +++ /dev/null @@ -1,108 +0,0 @@ -const $ = new Env('晶彩天气任务宝箱领取'); -let jctqBoxbody= $.isNode() ? (process.env.jctqBoxbody ? process.env.jctqBoxbody : "") : ($.getdata('jctqBoxbody') ? $.getdata('jctqBoxbody') : "") -let jctqBoxbodyArr = [] -let jctqBoxbodys = "" - - - -if (!jctqBoxbody) { - $.msg($.name, '【提示】请在app下方点击赚钱图标,在每日任务中点击所有可领取的奖励,获取body,明天再跑一次脚本', '不知道说啥好', { - "open-url": "给您劈个叉吧" - }); - $.done() - } - else if (jctqBoxbody.indexOf("&") == -1) { - jctqBoxbodyArr.push(jctqBoxbody) - } - else if (jctqBoxbody.indexOf("&") > -1) { - jctqBoxbodys = jctqBoxbody.split("&") - } - else if (process.env.jctqBoxbody && process.env.jctqBoxbody.indexOf('&') > -1) { - jctqBoxbodyArr = process.env.jctqBoxbody.split('&'); - console.log(`您选择的是用"&"隔开\n`) - } - else { - jctqBoxbodys = [process.env.jctqBoxbody] - }; - Object.keys(jctqBoxbodys).forEach((item) => { - if (jctqBoxbodys[item]) { - jctqBoxbodyArr.push(jctqBoxbodys[item]) - } - }) - -!(async () => { -if (typeof $request !== "undefined") { - getjctqBoxbody() - $.done() - }else { - console.log(`共${jctqBoxbodyArr.length}个宝箱奖励body`) - for (let k = 0; k < jctqBoxbodyArr.length; k++) { - // $.message = "" - jctqBoxbody1 = jctqBoxbodyArr[k]; - console.log(`${jctqBoxbody1}`) - console.log(`--------第 ${k + 1} 次宝箱奖励执行中--------\n`) - let jctqBoxheader = { - 'device-platform': 'android', - 'Content-Type': 'application/x-www-form-urlencoded', - 'Content-Length': jctqBoxbody1.length.toString(), - 'Host': 'tq.xunsl.com', - } - await jctqBoxreward(jctqBoxheader) - console.log(typeof (jctqBoxbody1)); - console.log(jctqBoxbody1.length.toString()); - await $.wait(4000); - console.log("\n\n") - } -} - })() - .catch((e) => $.logErr(e)) - .finally(() => $.done()) - -function getjctqBoxbody() { - if ($request.url.match(/\/tq.xunsl.com\/v5\/CommonReward\/toGetReward/)) { - bodyVal = $request.body - if (jctqBoxbody) { - if (jctqBoxbody.indexOf(bodyVal) > -1) { - $.log("此宝箱请求已存在,本次跳过") - } else if (jctqBoxbody.indexOf(bodyVal) == -1) { - jctqBoxbodys = jctqBoxbody + "&" + bodyVal; - $.setdata(jctqBoxbodys, 'jctqBoxbody'); - $.log(`${$.name}获取宝箱: 成功, jctqBoxbodys: ${bodyVal}`); - bodys = jctqBoxbodys.split("&") - $.msg($.name, "获取第" + bodys.length + "个宝箱请求: 成功🎉", ``) - } - } else { - $.setdata(bodyVal, 'jctqBoxbody'); - $.log(`${$.name}获取宝箱: 成功, jctqBoxbodys: ${bodyVal}`); - $.msg($.name, `获取第一个宝箱请求: 成功🎉`, ``) - } - } - - } -//宝箱 -function jctqBoxreward(jctqBoxheader,timeout=0) { - return new Promise((resolve) => { - let url = { - url : 'https://tq.xunsl.com/v5/CommonReward/toGetReward.json', - headers : jctqBoxheader, - body : jctqBoxbody1,} - $.post(url, async (err, resp, data) => { - try { - - const result = JSON.parse(data) - if(result.success !== false ){ - console.log('\n领取宝箱奖励成功,获得:'+result.items.score + '金币') - }else{ - console.log('\n领取宝箱奖励失败,'+result.error_code) - console.log(result) - } - } catch (e) { - } finally { - resolve() - } - },timeout) - }) -} - -function Env(t,e){class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} - diff --git a/jctq/jctqkkz.js b/jctq/jctqkkz.js deleted file mode 100644 index 46e93f0..0000000 --- a/jctq/jctqkkz.js +++ /dev/null @@ -1,271 +0,0 @@ -const $ = new Env("晶彩天气看看赚"); -const notify = $.isNode() ? require('./sendNotify') : ''; -message = "" - -let jctqLookStartbody= $.isNode() ? (process.env.jctqLookStartbody ? process.env.jctqLookStartbody : "") : ($.getdata('jctqLookStartbody') ? $.getdata('jctqLookStartbody') : "") -let jctqLookStartbodyArr = [] -let jctqLookStartbodys = "" - -let jctqCookie= $.isNode() ? (process.env.jctqCookie ? process.env.jctqCookie : "") : ($.getdata('jctqCookie') ? $.getdata('jctqCookie') : "") -let jctqCookieArr = [] -let jctqCookies = "" - - -const jctqLookheader = { - 'device-platform': 'android', - 'Content-Type': 'application/x-www-form-urlencoded', - 'Host': 'tq.xunsl.com', - 'app-type' : 'jcweather', -} - -const jctqRewardheader={ - 'device-platform': 'android', - 'Content-Type': 'application/x-www-form-urlencoded', - 'Host': 'tq.xunsl.com', - 'app-type' : 'jcweather', -} - -const jctqLookStartheader={ - 'device-platform': 'android', - 'Content-Type': 'application/x-www-form-urlencoded', - 'Host': 'tq.xunsl.com', - 'app-type' : 'jcweather', -} - - - -if (!jctqCookie) { - $.msg($.name, '【提示】进入点击右下角"赚钱图标",再跑一次脚本', '不知道说啥好', { - "open-url": "给您劈个叉吧" - }); - $.done() - } - else if (jctqCookie.indexOf("@") == -1 && jctqCookie.indexOf("@") == -1) { - jctqCookieArr.push(jctqCookie) - } - else if (jctqCookie.indexOf("@") > -1) { - jctqCookies = jctqCookie.split("@") - } - else if (process.env.jctqCookie && process.env.jctqCookie.indexOf('@') > -1) { - jctqCookieArr = process.env.jctqCookie.split('@'); - console.log(`您选择的是用"@"隔开\n`) - } - else { - jctqCookies = [process.env.jctqCookie] - }; - Object.keys(jctqCookies).forEach((item) => { - if (jctqCookies[item]) { - jctqCookieArr.push(jctqCookies[item]) - } - }) -if (!jctqLookStartbody) { - $.msg($.name, '【提示】请点击看看赚某一任务获取body', '不知道说啥好', { - "open-url": "给您劈个叉吧" - }); - $.done() - } - else if (jctqLookStartbody.indexOf("&") == -1) { - jctqLookStartbodyArr.push(jctqLookStartbody) - } - else if (jctqLookStartbody.indexOf("&") > -1) { - jctqLookStartbodys = jctqLookStartbody.split("&") - } - else if (process.env.jctqLookStartbody && process.env.jctqLookStartbody.indexOf('&') > -1) { - jctqLookStartbodyArr = process.env.jctqLookStartbody.split('&'); - console.log(`您选择的是用"&"隔开\n`) - } - else { - jctqLookStartbodys = [process.env.jctqLookStartbody] - }; - Object.keys(jctqLookStartbodys).forEach((item) => { - if (jctqLookStartbodys[item]) { - jctqLookStartbodyArr.push(jctqLookStartbodys[item]) - } - }) - -!(async () => { - if (typeof $request !== "undefined") { - await getjctqLookStartbody() - $.done() - }else{ - console.log(`共${jctqLookStartbodyArr.length}个看看赚body`) - for (let k = 0; k < jctqLookStartbodyArr.length; k++) { - - jctqLookStartbody1 = jctqLookStartbodyArr[k]; - console.log(`--------第 ${k + 1} 次看看赚激活执行中--------\n`) - await lookStart() - await $.wait(1000); - console.log("\n\n") - } - console.log(`共${jctqCookieArr.length}个cookie`) - for (let k = 0; k < jctqCookieArr.length; k++) { - bodyVal = jctqCookieArr[k].split('&uid=')[0]; - var time1 = Date.parse( new Date() ).toString(); - time1 = time1.substr(0,10); - - cookie = bodyVal.replace(/zqkey=/, "cookie=") - cookie_id = cookie.replace(/zqkey_id=/, "cookie_id=") - jctqCookie1= cookie_id +'&device_brand=xfdg&device_id=cc7dgdsgfsz83e&device_model=1gx&device_platform=android&device_type=android&inner_version=202107261526&mi=0&openudid=cc7dgdsgfsz83e&os_api=27&os_version=bdftgsdfga&phone_network=WIFI&phone_sim=1'+'&request_time=' + time1 +'&time=' + time1 +'&'+ bodyVal - //console.log(`${jctqCookie1}`) - console.log(`--------第 ${k + 1} 个账号看看赚上方宝箱奖励执行中--------\n`) - for(let k = 0; k < 3; k++){ - id = k.toString() - await openbox(id,jctqCookie1) - await $.wait(30000); - - } - - console.log("\n\n") - - } - - -function openbox(id,jctqCookie1,timeout=0) { - return new Promise((resolve) => { - let url = { - url : 'https://tq.xunsl.com/WebApi/Nameless/getBoxReward?id='+ id + '&' + jctqCookie1, - headers : { - 'Host': 'tq.xunsl.com', - //'Referer': 'https://tq.xunsl.com/h5/20190527watchMoney/?' +jctqCookie1 - 'Referer':'https://tq.xunsl.com/h5/20190527watchMoney/?keyword_wyq=woyaoq.com&access=WIFI&app-version=8.1.2&app_version=8.1.2&carrier=%E4%B8%AD%E5%9B%BD%E7%A7%BB%E5%8A%A8&channel=c1005&'+jctqCookie1}, - } - $.get(url, async (err, resp, data) => { - try { - - const result = JSON.parse(data) - if(result.status == 1){ - console.log(result.data) - }else{ - console.log(result) - } - } catch (e) { - } finally { - resolve() - } - },timeout) - }) -}} - })() - .catch((e) => $.logErr(e)) - .finally(() => $.done()) - - - - - - - - -//获取看看赚激活body -async function getjctqLookStartbody() { -if ($request.url.match(/\/tq.xunsl.com\/v5\/nameless\/adlickstart/)) { - bodyVal=$request.body - await $.wait(1100); - if (jctqLookStartbody) { - if (jctqLookStartbody.indexOf(bodyVal) > -1) { - $.log("此看看赚任务请求已存在,本次跳过") - } else if (jctqLookStartbody.indexOf(bodyVal) == -1) { - jctqLookStartbodys = jctqLookStartbody + "&" + bodyVal; - $.setdata(jctqLookStartbodys, 'jctqLookStartbody'); - $.log(`${$.name}获取看看赚任务: 成功, jctqLookStartbodys: ${bodyVal}`); - bodys = jctqLookStartbodys.split("&") - $.msg($.name, "获取第" + bodys.length + "个看看赚任务请求: 成功🎉", ``) - } - } else { - $.setdata(bodyVal, 'jctqLookStartbody'); - $.log(`${$.name}获取看看赚任务: 成功, jctqLookStartbodys: ${bodyVal}`); - $.msg($.name, `获取第一个看看赚任务请求: 成功🎉`, ``) - } - } - - } -//看看赚激活 -function lookStart(timeout = 0) { - return new Promise((resolve) => { - let url = { - url : 'https://tq.xunsl.com/v5/nameless/adlickstart.json', - headers : jctqLookStartheader, - body : jctqLookStartbody1,}//xsgbody,} - $.post(url, async (err, resp, data) => { - try { - - const result = JSON.parse(data) - if(result.success === true ){ - console.log('\n激活看看赚任务成功') - comstate = result.items.comtele_state - if(comstate === 1){ - console.log('\n任务: '+ result.items.banner_id+'已完成,跳过') - }else { - $.log("任务开始," + result.items.banner_id + result.message); - for (let j = 0; j < result.items.see_num - result.items.read_num; j++) { - $.log("任务执行第" + parseInt(j + 1) + "次") - await $.wait(8000); - await lookstart() - } - await $.wait(10000); - await reward() - } - - }else{ - console.log('\n激活看看赚任务失败') - smbody = $.getdata('jctqLookStartbody').replace(jctqLookStartbody1 + "&", ""); - $.setdata(smbody, 'jctqLookStartbody'); - console.log("该看看赚任务已自动删除") - } - } catch (e) { - } finally { - resolve() - } - },timeout) - }) -} -//看看赚阅读 -function lookstart(timeout = 0) { - return new Promise((resolve) => { - let url = { - url : 'https://tq.xunsl.com/v5/nameless/bannerstatus.json', - headers : jctqLookheader, - body : jctqLookStartbody1,}//xsgbody,} - $.post(url, async (err, resp, data) => { - try { - - const result = JSON.parse(data) - if(result.success === true ){ - console.log('\n浏览看看赚文章成功') - }else { - console.log('\n浏览看看赚文章失败') - } - - } catch (e) { - } finally { - resolve() - } - },timeout) - }) -} -//看看赚奖励 -function reward(timeout = 0) { - return new Promise((resolve) => { - let url = { - url : 'https://tq.xunsl.com/v5/nameless/adlickend.json', - headers : jctqRewardheader, - body : jctqLookStartbody1,}//xsgbody,} - $.post(url, async (err, resp, data) => { - try { - - const result = JSON.parse(data) - if(result.items.score !== "undefined" ){ - console.log('\n看看赚获得:'+result.items.score + '金币') - }else{ - console.log('\n领取奖励失败') - } - } catch (e) { - } finally { - resolve() - } - },timeout) - }) -} - - -function Env(t,e){"undefined"!=typeof process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0);class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} diff --git a/jctq/jctqqd.js b/jctq/jctqqd.js deleted file mode 100644 index 0b97485..0000000 --- a/jctq/jctqqd.js +++ /dev/null @@ -1,118 +0,0 @@ -const $ = new Env("晶彩天气签到"); -const notify = $.isNode() ? require('./sendNotify') : ''; -message = "" -let jctqQdBody= $.isNode() ? (process.env.jctqQdBody ? process.env.jctqQdBody : "") : ($.getdata('jctqQdBody') ? $.getdata('jctqQdBody') : "") -let jctqQdBodyArr = [] -let jctqQdBodys = "" -const jctqQdHeader={ - 'device-platform': 'android', - 'Content-Type': 'application/x-www-form-urlencoded', - 'Content-Length': '1247', - 'Host': 'tq.xunsl.com' -}; - - if (typeof $request !== "undefined") { - getjctqQdBody() - $.done() - } - if (!jctqQdBody) { - $.msg($.name, '【提示】请签到以获取body,明天再跑一次脚本测试', '不知道说啥好', { - "open-url": "给您劈个叉吧" - }); - $.done() - } - else if (jctqQdBody.indexOf("&") == -1) { - jctqQdBodyArr.push(jctqQdBody) - } - else if (jctqQdBody.indexOf("&") > -1) { - jctqQdBodys = jctqQdBody.split("&") - } - else if (process.env.jctqQdBody && process.env.jctqQdBody.indexOf('&') > -1) { - jctqQdBodyArr = process.env.jctqQdBody.split('&'); - console.log(`您选择的是用"&"隔开\n`) - } - else { - jctqQdBodys = [process.env.jctqQdBody] - }; - Object.keys(jctqQdBodys).forEach((item) => { - if (jctqQdBodys[item]) { - jctqQdBodyArr.push(jctqQdBodys[item]) - } - }) - -!(async () => { - - - console.log(`共${jctqQdBodyArr.length}个账号`) - for (let k = 0; k < jctqQdBodyArr.length; k++) { - $.message = "" - jctqQdBody1 = jctqQdBodyArr[k]; - console.log(`${jctqQdBody1}`) - console.log(`--------账号 ${k+1} 签到任务执行中--------\n`) - await jcqd() - await $.wait(1000); - console.log("\n\n") - } - - date = new Date() - if ($.isNode() &&date.getHours() == 11 && date.getMinutes()<10) { - if (message.length != 0) { - await notify.sendNotify("晶彩天气签到", `${message}\n\n shaolin-kongfu`); - } - } else { - $.msg($.name, "", message) - } - - })() - .catch((e) => $.logErr(e)) - .finally(() => $.done()) - - -//获取签到body -function getjctqQdBody() { - if ($request.url.match(/\/tq.xunsl.com\/v5\/CommonReward\/toGetReward/)) { - bodyVal = $request.body - if (jctqQdBody) { - if (jctqQdBody.indexOf(bodyVal) > -1) { - $.log("此签到请求已存在,本次跳过") - } else if (jctqQdBody.indexOf(bodyVal) == -1) { - jctqQdBodys = jctqQdBody + "&" + bodyVal; - $.setdata(jctqQdBodys, 'jctqQdBody'); - $.log(`${$.name}获取签到: 成功, jctqQdBodys: ${bodyVal}`); - bodys = jctqQdBodys.split("&") - $.msg($.name, "获取第" + bodys.length + "个签到请求: 成功🎉", ``) - } - } else { - $.setdata(bodyVal, 'jctqQdBody'); - $.log(`${$.name}获取签到: 成功, jctqQdBodys: ${bodyVal}`); - $.msg($.name, `获取第一个签到请求: 成功🎉`, ``) - } - } - - } - -//签到 -function jcqd(timeout = 0) { - return new Promise((resolve) => { - let url = { - url : 'https://tq.xunsl.com/v5/CommonReward/toGetReward.json', - headers : jctqQdHeader, - body : jctqQdBody1,} - $.post(url, async (err, resp, data) => { - try { - - const result = JSON.parse(data) - if(result.success == true){ - console.log('\n签到成功,获得:'+result.items.score +'金币') - }else{ - console.log('\n今日已签到,明天再来吧^_^') - } - } catch (e) { - } finally { - resolve() - } - },timeout) - }) -} -function Env(t,e){"undefined"!=typeof process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0);class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} - diff --git a/jctq/jctqwz.js b/jctq/jctqwz.js deleted file mode 100644 index c0088f5..0000000 --- a/jctq/jctqwz.js +++ /dev/null @@ -1,229 +0,0 @@ -const $ = new Env("晶彩天气阅读文章"); -const notify = $.isNode() ? require('./sendNotify') : ''; -message = "" - - -let jctqWzBody= $.isNode() ? (process.env.jctqWzBody ? process.env.jctqWzBody : "") : ($.getdata('jctqWzBody') ? $.getdata('jctqWzBody') : "") -let jctqWzBodyArr = [] -let jctqWzBodys = "" - -let jctqTimeBody= $.isNode() ? (process.env.jctqTimeBody ? process.env.jctqTimeBody : "") : ($.getdata('jctqTimeBody') ? $.getdata('jctqTimeBody') : "") -let jctqTimeBodyArr = [] -let jctqTimeBodys = "" - -let skipFlag = 0; - -const jctqTimeHeader={ - 'device-platform': 'android', - 'Content-Type': 'application/x-www-form-urlencoded', - 'Content-Length': '1198', - 'Host': 'tq.xunsl.com', - 'app-type' : 'jcweather', -} -const jctqWzHeader = { - 'device-platform': 'android', - 'Content-Type': 'application/x-www-form-urlencoded', - 'Content-Length': '1201', - 'Host': 'tq.xunsl.com', - 'app-type' : 'jcweather', -} - - if (!jctqTimeBody) { - $.msg($.name, '【提示】请点击文章获取body,再跑一次脚本', '不知道说啥好', { - "open-url": "给您劈个叉吧" - }); - $.done() - } - else if (jctqTimeBody.indexOf("&") == -1) { - jctqTimeBodyArr.push(jctqTimeBody) - } - else if (jctqTimeBody.indexOf("&") > -1) { - jctqTimeBodys = jctqTimeBody.split("&") - } - else if (process.env.jctqTimeBody && process.env.jctqTimeBody.indexOf('&') > -1) { - jctqTimeBodyArr = process.env.jctqTimeBody.split('&'); - console.log(`您选择的是用"&"隔开\n`) - } - else { - jctqTimeBodys = [process.env.jctqTimeBody] - }; - Object.keys(jctqTimeBodys).forEach((item) => { - if (jctqTimeBodys[item]) { - jctqTimeBodyArr.push(jctqTimeBodys[item]) - } - }) - - if (!jctqWzBody) { - $.msg($.name, '【提示】请点击文章获取body,再跑一次脚本', '不知道说啥好', { - "open-url": "给您劈个叉吧" - }); - $.done() - } - else if (jctqWzBody.indexOf("&") == -1) { - jctqWzBodyArr.push(jctqWzBody) - } - else if (jctqWzBody.indexOf("&") > -1) { - jctqWzBodys = jctqWzBody.split("&") - } - else if (process.env.jctqWzBody && process.env.jctqWzBody.indexOf('&') > -1) { - jctqWzBodyArr = process.env.jctqWzBody.split('&'); - console.log(`您选择的是用"&"隔开\n`) - } - else { - jctqWzBodys = [process.env.jctqWzBody] - }; - Object.keys(jctqWzBodys).forEach((item) => { - if (jctqWzBodys[item]) { - jctqWzBodyArr.push(jctqWzBodys[item]) - } - }) - -!(async () => { - if (typeof $request !== "undefined") { - getjctqWzBody() - getjctqTimeBody() - $.done() - }else { - - console.log(`共${jctqWzBodyArr.length}个阅读body`) - for (let k = 0; k < jctqWzBodyArr.length; k++) { - // $.message = "" - jctqWzBody1 = jctqWzBodyArr[k]; - // console.log(`${jctqWzBody1}`) - console.log(`--------第 ${k + 1} 次阅读任务执行中--------\n`) - $.skipFlag = 1 - await wzjl() - if($.skipFlag == 0) - { - await $.wait(60000); - for (let k = 0; k < jctqTimeBodyArr.length; k++) { - jctqTimeBody1 = jctqTimeBodyArr[k]; - await timejl() - } - }else{ - await $.wait(400); - } - console.log("\n\n") - } - } - - - - // date = new Date() - // if ($.isNode() &&date.getHours() == 11 && date.getMinutes()<10) { - // if (message.length != 0) { - // await notify.sendNotify("晶彩天气文章阅读", `${message}\n\n shaolin-kongfu`); - // } - // } else { - // $.msg($.name, "", message) - // } - - })() - .catch((e) => $.logErr(e)) - .finally(() => $.done()) - - -function getjctqWzBody() { - if ($request.url.match(/\/tq.xunsl.com\/v5\/article\/info.json/)||$request.url.match(/\/tq.xunsl.com\/v5\/article\/detail.json/)) { - bodyVal1 = $request.url.split('p=')[1] - console.log(encodeURIComponent(bodyVal1)) - bodyVal = 'p='+encodeURIComponent(bodyVal1) - console.log(bodyVal) - - - if (jctqWzBody) { - if (jctqWzBody.indexOf(bodyVal) > -1) { - $.log("此阅读请求已存在,本次跳过") - } else if (jctqWzBody.indexOf(bodyVal) == -1) { - jctqWzBodys = jctqWzBody + "&" + bodyVal; - $.setdata(jctqWzBodys, 'jctqWzBody'); - $.log(`${$.name}获取阅读: 成功, jctqWzBodys: ${bodyVal}`); - bodys = jctqWzBodys.split("&") - $.msg($.name, "获取第" + bodys.length + "个阅读请求: 成功🎉", ``) - } - } else { - $.setdata(bodyVal, 'jctqWzBody'); - $.log(`${$.name}获取阅读: 成功, jctqWzBodys: ${bodyVal}`); - $.msg($.name, `获取第一个阅读请求: 成功🎉`, ``) - } - } - - } -//阅读文章奖励 -function wzjl(timeout = 0) { - return new Promise((resolve) => { - let url = { - url : 'https://tq.xunsl.com/v5/article/complete.json', - headers : jctqWzHeader, - body : jctqWzBody1,}//xsgbody,} - $.post(url, async (err, resp, data) => { - try { - - const result = JSON.parse(data) - if(result.items.read_score){ - if(result.items.read_score == 0){ - console.log('\n获得0金币,下一篇') - $.skipFlag = 1 - }else{ - console.log('\n浏览文章成功,获得:'+result.items.read_score + '金币') - $.skipFlag = 0 - } - }else{ - console.log('\n看太久了,换一篇试试') - $.skipFlag = 1 - } - } catch (e) { - } finally { - resolve() - } - },timeout) - }) -} - - -function getjctqTimeBody() { - if ($request.url.match(/\/tq.xunsl.com\/v5\/user\/stay.json/)) { - bodyVal=$request.body - console.log(bodyVal) - if (jctqTimeBody) { - if (jctqTimeBody.indexOf(bodyVal) > -1) { - $.log("此阅读时长请求已存在,本次跳过") - } else if (jctqTimeBody.indexOf(bodyVal) == -1) { - jctqTimeBodys = jctqTimeBody + "&" + bodyVal; - $.setdata(jctqTimeBodys,'jctqTimeBody'); - $.log(`${$.name}获取阅读: 成功, jctqTimeBodys: ${bodyVal}`); - bodys = jctqTimeBodys.split("&") - $.msg($.name, "获取第" + bodys.length + "个阅读时长请求: 成功🎉", ``) - } - } else { - $.setdata($request.body,'jctqTimeBody'); - $.log(`${$.name}获取阅读: 成功, jctqTimeBodys: ${bodyVal}`); - $.msg($.name, `获取第一个阅读时长请求: 成功🎉`, ``) - } - } -} - -function timejl(timeout = 0) { - return new Promise((resolve) => { - let url = { - url : 'https://tq.xunsl.com/v5/user/stay.json', - headers : jctqTimeHeader, - body : jctqTimeBody1,}//xsgbody,} - $.post(url, async (err, resp, data) => { - try { - - const result = JSON.parse(data) - if(result.success === true ){ - console.log('\n阅读时长:'+result.time + '秒') - }else{ - console.log('\n更新阅读时长失败') - } - } catch (e) { - } finally { - resolve() - } - },timeout) - }) -} - -function Env(t,e){"undefined"!=typeof process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0);class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} diff --git a/jrttjsb.js b/jrttjsb.js new file mode 100644 index 0000000..3ccd342 --- /dev/null +++ b/jrttjsb.js @@ -0,0 +1,1284 @@ +/* +IOS/安卓: 今日头条极速版 +邀请码: 1173836876 + +老用户每天几毛,新用户可能收益高点 +普通版定时: 1-59/15 6-23 * * * +激进版定时: 1-59/5 * * * * +多用户跑的时间会久一点,自己看着改定时吧 + +自定义UA:捉包拿到自己的UA,填到变量jrttjsbUA里,不填默认用安卓UA +自定义每次运行阅读文章的数量:填到变量jrttjsbReadNum,不填默认10篇 +农场和种树任务:默认不做,需要做的,把变量jrttjsbFarm填为1 + +V2P重写: +[task_local] +#今日头条极速版 +1-59/15 6-23 * * * https://raw.githubusercontent.com/leafxcy/JavaScript/main/jrttjsb.js, tag=今日头条极速版, enabled=true +[rewrite_local] +luckycat\/lite\/v1\/task\/page_data url script-request-header https://raw.githubusercontent.com/leafxcy/JavaScript/main/jrttjsb.js +[MITM] +#每个人的域名不同,都放进去MITM吧,还捉不到就自行捉包填写 +hostname = *.snssdk.com +hostname = *.toutiaoapi.com + +青龙把极速版捉包里面的cookie放到jrttjsbHeader里,多账户用@隔开 +*/ + +const jsname = '今日头条极速版' +const $ = Env(jsname) +const notifyFlag = 1; //0为关闭通知,1为打开通知,默认为1 +const logDebug = 0 + +//const notify = $.isNode() ? require('./sendNotify') : ''; +let notifyStr = '' + +let rndtime = "" //毫秒 +let httpResult //global buffer + +let host = 'i.snssdk.com' +let hostname = 'https://' + host + +let userAgent = ($.isNode() ? process.env.jrttjsbUA : $.getdata('jrttjsbUA')) || 'Dalvik/2.1.0 (Linux; U; Android 7.1.2; VOG-AL10 Build/HUAWEIVOG-AL10) NewsArticle/8.2.8 tt-ok/3.10.0.2'; +let userAgentArr = [] +let userHeader = ($.isNode() ? process.env.jrttjsbHeader : $.getdata('jrttjsbHeader')) || ''; +let userHeaderArr = [] +let jrttjsbFarm = ($.isNode() ? process.env.jrttjsbFarm : $.getdata('jrttjsbFarm')) || 0; + +let userIdx = 0 +let UAcount = 0 +let userStatus = [] +let maxReadPerRun = ($.isNode() ? process.env.jrttjsbReadNum : $.getdata('jrttjsbReadNum')) || 10; +let readList = [] + +let validList = [] +let adIdList = [26, 181, 186, 187, 188, 189, 190, 195, 210, 214, 216, 225, 308, 324, 327, 329] + +/////////////////////////////////////////////////////////////////// + +!(async () => { + + if(typeof $request !== "undefined") + { + await GetRewrite() + } + else + { + await showUpdateMsg() + + if(!(await checkEnv())) { + return + } + + await initAccountInfo() + await RunMultiUser() + } + + +})() +.catch((e) => $.logErr(e)) +.finally(() => $.done()) + +function showUpdateMsg() { + console.log('\n2021.12.15 9:30 更新:增加推送奖励,修复一个UA的bug,更改默认UA为安卓\n') +} + +//通知 +async function showmsg() { + + notifyBody = jsname + "运行通知\n\n" + notifyStr + + if (notifyFlag != 1) { + console.log(notifyBody); + } + + if (notifyFlag == 1) { + $.msg(notifyBody); + //if ($.isNode()){await notify.sendNotify($.name, notifyBody );} + } +} + +async function GetRewrite() { + if($request.url.indexOf('luckycat/lite/v1/task/page_data') > -1) { + let userCK = $request.headers.Cookie + + if(userHeader) { + if(userHeader.indexOf(userCK) == -1) { + userHeader = userHeader + '@' + userCK + $.setdata(userHeader, 'jrttjsbHeader'); + ckList = userHeader.split('@') + $.msg(jsname+` 获取第${ckList.length}个jrttjsbHeader成功: ${userCK}`) + } + } else { + $.setdata(userCK, 'jrttjsbHeader'); + $.msg(jsname+` 获取第1个jrttjsbHeader成功: ${userCK}`) + } + } +} + +async function checkEnv() { + if(userHeader) { + userHeaderArr = userHeader.split('@') + } else { + console.log('未找到jrttjsbHeader') + return false + } + if(userHeaderArr.length == 0) { + console.log('未找到有效的jrttjsbHeader') + return false + } + + if(userAgent) { + userAgentArr = userAgent.split('@') + } else { + console.log('未找到userAgent') + return false + } + UAcount = userAgentArr.length + + console.log(`共找到${userHeaderArr.length}个用户,${UAcount}个UA`) + return true +} + +async function initAccountInfo() { + for(userIdx=0; userIdx 0) await GetWalkBonus() + } else { + console.log(`用户${userIdx+1}走路状态失败:${result.err_tips}`) + } +} + +//走路奖励 +async function GetWalkBonus() { + let caller = printCaller() + let nowtime = Math.round(new Date().getTime()/1000) + let url = `${hostname}/luckycat/lite/v1/walk/bonus/?aid=35&update_version_code=85221&os_version=15.0&device_platform=iphone` + let body = `{"task_id":136,"enable_preload_exciting_video":0,"client_time":${nowtime},"rit":"","use_ecpm":0}` + let urlObject = populatePostUrl(url,body) + await httpPost(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.err_no == 0) { + console.log(`用户${userIdx+1}领取走路奖励获得${result.data.score_amount}金币`) + } else { + console.log(`用户${userIdx+1}领取走路奖励失败:${result.err_tips}`) + } +} + +//吃饭补贴 +async function DoneEat() { + let caller = printCaller() + let url = `${hostname}/luckycat/lite/v1/eat/done_eat/?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2` + let urlObject = populatePostUrl(url) + await httpPost(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.err_no == 0) { + console.log(`用户${userIdx+1}领取吃饭补贴获得${result.data.score_amount}金币`) + } else { + console.log(`用户${userIdx+1}领取吃饭补贴失败:${result.err_tips}`) + } +} + +//睡觉状态 +async function QuerySleepStatus() { + let caller = printCaller() + let curTime = new Date() + let curHour = curTime.getHours() + let url = `${hostname}/luckycat/lite/v1/sleep/status/?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.err_no == 0) { + let sleepHour = Math.floor(result.data.sleep_last_time/36)/100 + if(result.data.sleeping == true) { + if(sleepHour>=12) { + await SleepStop() + } else if(result.data.sleep_unexchanged_score==result.data.max_coin && curHour >= 7) { + let rnd = Math.random() + if(rnd>0.95) { + await SleepStop() + } else { + console.log(`用户${userIdx+1}随机醒来时间,本次不进行醒来,已经睡了${sleepHour}小时,可以获得${result.data.sleep_unexchanged_score}金币`) + } + } else { + console.log(`用户${userIdx+1}睡眠中,已经睡了${sleepHour}小时,可以获得${result.data.sleep_unexchanged_score}金币,上限${result.data.max_coin}金币`) + } + } else { + if(result.data.history_amount > 0) { + await SleepDone(result.data.history_amount) + } + if(curHour >= 22 || curHour < 2) { + await SleepStart() + } else if(curHour >= 20) { + let rnd = Math.random() + if(rnd>0.95) { + await SleepStart() + } else { + console.log(`用户${userIdx+1}随机睡眠时间,本次不进行睡眠`) + } + } else { + console.log(`用户${userIdx+1}未到睡觉时间`) + } + } + } else { + console.log(`用户${userIdx+1}查询睡觉状态失败:${result.err_tips}`) + } +} + +//睡觉醒来 +async function SleepStop() { + let caller = printCaller() + let url = `${hostname}/luckycat/lite/v1/sleep/stop/?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2` + let urlObject = populatePostUrl(url) + await httpPost(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.err_no == 0) { + let sleepHour = result.data.sleep_last_time/3600 + console.log(`用户${userIdx+1}结束睡眠,本次睡了${sleepHour}小时,可以领取${result.data.history_amount}金币`) + await SleepDone(result.data.history_amount) + } else { + console.log(`用户${userIdx+1}结束睡眠失败:${result.err_tips}`) + } +} + +//睡觉收金币 +async function SleepDone(amount) { + let caller = printCaller() + let timeInMS = Math.round(new Date().getTime()) + let url = `${hostname}/luckycat/lite/v1/sleep/done_task/?os_api=25&device_type=VOG-AL10&ssmix=a&manifest_version_code=8280&dpi=240&abflag=3&pass_through=default&use_ecpm=0&rom_version=25&rit=coin&app_name=news_article_lite&ab_client=a1%2Ce1%2Cf2%2Cg2%2Cf7&version_name=8.2.8&ab_version=668903%2C3491704%2C1859936%2C668908%2C3491714%2C668907%2C3491710%2C668905%2C3491678%2C668906%2C3491686%2C668904%2C3491669%2C3269751%2C3472846%2C3493942&plugin_state=7731332411413&sa_enable=0&ac=wifi&_request_from=web&update_version_code=82809&channel=lite2_tengxun&_rticket=${timeInMS}&status_bar_height=24&dq_param=0&device_platform=android&iid=1592553870724568&scm_build_version=1.0.0.1454&mac_address=88%3AB1%3A11%3A61%3A96%3A7B&version_code=828&polaris_version=1.0.5&tma_jssdk_version=1.95.0.28&is_pad=1&resolution=720*1280&os_version=7.1.2&language=zh&device_brand=HUAWEI&aid=35&ab_feature=z1&luckycat_version_name=4.2.0-rc.5&luckycat_version_code=420005` + let body = `{"score_amount":${amount},"enable_preload_exciting_video":0}` + let urlObject = populatePostUrl(url,body) + await httpPost(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.err_no == 0) { + console.log(`用户${userIdx+1}领取睡觉金币奖励${amount}金币成功`) + } else { + console.log(`用户${userIdx+1}领取睡觉金币奖励失败:${result.err_tips}`) + } +} + +//开始睡觉 +async function SleepStart() { + let caller = printCaller() + let url = `${hostname}/luckycat/lite/v1/sleep/start/?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2` + let urlObject = populatePostUrl(url) + await httpPost(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.err_no == 0) { + console.log(`用户${userIdx+1}开始睡觉,ZZZzzz...`) + await SleepDone(result.data.history_amount) + } else { + console.log(`用户${userIdx+1}开始睡觉失败:${result.err_tips}`) + } +} + +//查询农场状态 +async function QueryFarmInfo() { + let caller = printCaller() + let url = `${hostname}/ttgame/game_farm/polling_info?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.status_code == 0) { + if(result.data.info.offline_production) { + await FarmOfflineDouble() + } + if(result.data.info.water>=10) { + await FarmWater() + } + if(result.data.info.box_num>0) { + await FarmOpenBox() + } + } else { + console.log(`用户${userIdx+1}查询农场状态失败:${result.message}`) + } +} + +//进入农场 +async function EnterFarm() { + let caller = printCaller() + let url = `${hostname}/ttgame/game_farm/home_info?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + console.log(result) + if(result.status_code == 0) { + + } else { + console.log(`用户${userIdx+1}进入农场失败:${result.message}`) + } +} + +//农场-离线奖励翻倍 +async function FarmOfflineDouble() { + let caller = printCaller() + let url = `${hostname}/ttgame/game_farm/double_reward?watch_ad=1&aid=35` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.status_code == 0) { + console.log(`用户${userIdx+1}农场离线产量翻倍成功`) + } else { + console.log(`用户${userIdx+1}农场离线产量翻倍失败:${result.message}`) + } +} + +//农场-领取三餐礼包 +async function RewardFarmThreeGift(gift_id) { + let caller = printCaller() + let url = `${hostname}/ttgame/game_farm/reward/gift?game_client_version_code=2&gift_id=${gift_id}&watch_ad=0&double=0&aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.status_code == 0) { + console.log(`用户${userIdx+1}领取农场三餐礼包获得${result.data.reward_num}水滴`) + } else { + console.log(`用户${userIdx+1}领取农场三餐礼包失败:${result.message}`) + } +} + +//农场-三餐礼包状态 +async function QueryFarmThreeGift() { + let caller = printCaller() + let url = `${hostname}/ttgame/game_farm/gift/list?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.status_code == 0) { + for(let item of result.data) { + if(item.status==1) { + await RewardFarmThreeGift(item.gift_id) + } + } + } else { + console.log(`用户${userIdx+1}查询农场三餐礼包状态失败:${result.message}`) + } +} + +//查询农场任务列表 +async function QueryFarmTask() { + let caller = printCaller() + let url = `${hostname}/ttgame/game_farm/daily_task/list?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.status_code == 0) { + for(let item of result.data) { + if(item.status==1) { + await RewardFarmTask(item.task_id) + } + } + } else { + console.log(`用户${userIdx+1}查询农场任务列表失败:${result.message}`) + } +} + +//农场-领取任务奖励 +async function RewardFarmTask(id) { + let caller = printCaller() + let url = `${hostname}/ttgame/game_farm/reward/task?task_id=${id}&aid=35` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.status_code == 0) { + let typeStr = (result.data.reward_type==1) ? '水滴' : '化肥' + console.log(`用户${userIdx+1}领取农场任务奖励[task_id=${result.data.task_id}]获得${result.data.reward_num}${typeStr},剩余${typeStr}数量${result.data.current_num}`) + } else { + console.log(`用户${userIdx+1}领取农场任务奖励失败:${result.message}`) + } +} + +//农场-浇水 +async function FarmWater() { + let caller = printCaller() + let url = `${hostname}/ttgame/game_farm/land_water?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.status_code == 0) { + console.log(`用户${userIdx+1}农场浇水成功,剩余水滴:${result.data.water}`) + if(result.data.water>=10) { + await $.wait(1500) //min time 1000 + await FarmWater() + } + } else { + console.log(`用户${userIdx+1}农场浇水失败:${result.message}`) + } +} + +//农场-开宝箱 +async function FarmOpenBox() { + let caller = printCaller() + let url = `${hostname}/ttgame/game_farm/box/open?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.status_code == 0) { + console.log(`用户${userIdx+1}开农场宝箱获得${result.data.incr_coin}金币`) + if(result.data.excitation_ad_score_amount>0) await FarmOpenBoxVideo() + } else { + console.log(`用户${userIdx+1}开农场宝箱失败:${result.message}`) + } +} + +//农场-宝箱视频 +async function FarmOpenBoxVideo() { + let caller = printCaller() + let url = `${hostname}/ttgame/game_farm/excitation_ad/add?excitation_ad_score_amount=134&device_id=2392172203611735&aid=35&os_version=15.0&update_version_code=85221` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.status_code == 0) { + console.log(`用户${userIdx+1}看农场宝箱视频获得${result.data.incr_coin}金币`) + } else { + console.log(`用户${userIdx+1}看农场宝箱视频失败:${result.message}`) + } +} + +//农场-签到状态 +async function QueryFarmSignStatus() { + let caller = printCaller() + let url = `${hostname}/ttgame/game_farm/sign_in/list?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.status_code == 0) { + for(let item of result.data.sign) { + if(item.status==1) { + await FarmSign() + break + } + } + } else { + console.log(`用户${userIdx+1}查询签到状态失败:${result.message}`) + } +} + +//农场-签到 +async function FarmSign() { + let caller = printCaller() + let url = `${hostname}/ttgame/game_farm/reward/sign_in?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.status_code == 0) { + let str = (result.data.reward_type==1)?'水滴':'化肥' + console.log(`用户${userIdx+1}签到获得${result.data.reward_num}${str},剩余${str}数量${result.data.cur_reward_num}`) + } else { + console.log(`用户${userIdx+1}签到失败:${result.message}`) + } +} + +//农场-签到视频翻倍 +async function FarmSignDouble() { + let caller = printCaller() + let url = `${hostname}/ttgame/game_farm/reward/double_sign_in?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.status_code == 0) { + let str = (result.data.reward_type==1)?'水滴':'化肥' + console.log(`用户${userIdx+1}签到翻倍获得${result.data.reward_num}{str},剩余${str}数量${result.data.cur_reward_num}`) + } else { + console.log(`用户${userIdx+1}签到翻倍失败:${result.message}`) + } +} + +//农场-土地状态 +async function QueryFarmLandStatus() { + let caller = printCaller() + let url = `${hostname}/ttgame/game_farm/home_info?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.status_code == 0) { + for(let item of result.data.info.lands) { + if(item.status==false && item.unlock_able==true) { + await FarmUnlock(item.land_id) + break + } + } + } else { + console.log(`用户${userIdx+1}查询土地状态失败:${result.message}`) + } +} + +//农场-土地解锁 +async function FarmUnlock(land_id) { + let caller = printCaller() + let url = `${hostname}/ttgame/game_farm/land/unlock?land_id=${land_id}&aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.status_code == 0) { + console.log(`用户${userIdx+1}解锁${land_id}号土地成功`) + } else { + console.log(`用户${userIdx+1}解锁${land_id}号土地失败:${result.message}`) + } +} + +//种树-签到状态 +async function QueryTreeSignStatus() { + let caller = printCaller() + let url = `${hostname}/ttgame/game_orchard/sign_in/list?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.status_code == 0) { + if(result.data.today == false) { + await TreeSign() + } + } else { + console.log(`用户${userIdx+1}查询种树签到状态失败:${result.message}`) + } +} + +//种树-签到 +async function TreeSign() { + let caller = printCaller() + let url = `${hostname}/ttgame/game_orchard/sign_in/reward?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.status_code == 0) { + console.log(`用户${userIdx+1}种树签到获得${result.data.reward_item.num}${result.data.reward_item.name}`) + } else { + console.log(`用户${userIdx+1}种树签到失败:${result.message}`) + } +} + +//种树-二选一-选项 +async function QueryTreeChallenge() { + let caller = printCaller() + let url = `${hostname}/ttgame/game_orchard/challenge/list?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.status_code == 0) { + let bestChoice = 0 + let maxWater = 0 + for(let item of result.data.tasks) { + if(item.state==0 && item.water_times>maxWater) { + maxWater = item.water_times + bestChoice = item.id + } + } + if(bestChoice>0) await TreeChallengeChoose(bestChoice) + } else { + console.log(`用户${userIdx+1}查询挑战任务失败:${result.message}`) + } +} + +//种树-二选一-选择 +async function TreeChallengeChoose(id) { + let caller = printCaller() + let url = `${hostname}/ttgame/game_orchard/challenge/choose?task_id=${id}&aid=35` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.status_code == 0) { + console.log(`用户${userIdx+1}选择浇水${result.data.red_point.times}次挑战`) + } else { + console.log(`用户${userIdx+1}选择浇水挑战失败:${result.message}`) + } +} + +//种树-二选一-领奖 +async function TreeChallengeReward() { + let caller = printCaller() + let url = `${hostname}/ttgame/game_orchard/challenge/reward?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.status_code == 0) { + console.log(`用户${userIdx+1}领取浇水挑战奖励获得${result.data.reward_item.num}水滴`) + } else { + console.log(`用户${userIdx+1}领取浇水挑战奖励失败:${result.message}`) + } +} + +//种树-化肥签到 +async function TreeNutrientSign() { + let caller = printCaller() + let url = `${hostname}/ttgame/game_orchard/nutrient/sign_in?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.status_code == 0) { + if(result.data.is_rewarded==true) { + console.log(`用户${userIdx+1}种树化肥签到获得${result.data.reward_item.num}{result.data.reward_item.name}`) + } else { + console.log(`用户${userIdx+1}种树化肥签到成功`) + } + } else { + console.log(`用户${userIdx+1}种树化肥签到失败:${result.message}`) + } +} + +//种树-领取三餐礼包 +async function RewardTreeThreeGift(task_id) { + let caller = printCaller() + let url = `${hostname}/ttgame/game_orchard/three_gift/reward?task_id=${task_id}&watch_ad=0&extra_ad_num=0&aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.status_code == 0) { + console.log(`用户${userIdx+1}领取种树三餐礼包获得${result.data.reward_item.num}${result.data.reward_item.name}`) + } else { + console.log(`用户${userIdx+1}领取种树三餐礼包失败:${result.message}`) + } +} + +//种树-三餐礼包状态 +async function QueryTreeThreeGift() { + let caller = printCaller() + let curTime = new Date() + let curHour = curTime.getHours() + let url = `${hostname}/ttgame/game_orchard/three_gift/list?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.status_code == 0) { + for(let item of result.data.gift_list) { + if(item.rounds==1 && curHour >= item.available_time.begin && curHour < item.available_time.end) { + await RewardTreeThreeGift(item.id) + } + } + } else { + console.log(`用户${userIdx+1}查询种树三餐礼包状态失败:${result.message}`) + } +} + +//种树-水滴任务列表 +async function QueryTreeWaterTask() { + let caller = printCaller() + let url = `${hostname}/ttgame/game_orchard/tasks/list?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.status_code == 0) { + for(let item of result.data.tasks_v2) { + if(item.reward_item.state==4) { + await TreeWaterReward(item.id) + await $.wait(1500) + } + } + } else { + console.log(`用户${userIdx+1}查询种树水滴任务列表失败:${result.message}`) + } +} + +//种树-水滴领奖 +async function TreeWaterReward(task_id) { + let caller = printCaller() + let url = `${hostname}/ttgame/game_orchard/tasks/reward?task_id=${task_id}&do_action=0&aid=35` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.status_code == 0) { + console.log(`用户${userIdx+1}领取水滴任务[id=${task_id}]获得${result.data.reward_item.num}${result.data.reward_item.name}`) + } else { + console.log(`用户${userIdx+1}领取水滴任务[id=${task_id}]失败:${result.message}`) + } +} + +//种树-浇水 +async function TreeWater() { + let caller = printCaller() + let url = `${hostname}/ttgame/game_orchard/tree/water?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.status_code == 0) { + console.log(`用户${userIdx+1}种树浇水成功,剩余水滴:${result.data.kettle.water_num}`) + if(result.data.kettle.water_num>=100) { + await $.wait(1500) //min time 1000 + await TreeWaterTenTimes() + } else if(result.data.kettle.water_num>=10) { + await $.wait(1500) //min time 1000 + await TreeWater() + } + } else { + console.log(`用户${userIdx+1}种树浇水失败:${result.message}`) + } +} + +//种树-浇水10次 +async function TreeWaterTenTimes() { + let caller = printCaller() + let url = `${hostname}/ttgame/game_orchard/tree/tenfold_water?times=10&aid=35` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.status_code == 0) { + console.log(`用户${userIdx+1}种树浇水10次成功,剩余水滴:${result.data.kettle.water_num}`) + if(result.data.kettle.water_num>=100) { + await $.wait(1500) //min time 1000 + await TreeWaterTenTimes() + } else if(result.data.kettle.water_num>=10) { + await $.wait(1500) //min time 1000 + await TreeWater() + } + } else { + console.log(`用户${userIdx+1}种树浇水失败:${result.message}`) + } +} + +//种树-信息 +async function QueryTreeStatus() { + let caller = printCaller() + let url = `${hostname}/ttgame/game_orchard/polling_info?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.status_code == 0) { + if(result.data.red_points.challenge && result.data.red_points.challenge.state==4) { + await TreeChallengeReward() + } + if(result.data.bottle.state==1) { + await RewardTreeWaterBottle() + } + if(result.data.red_points.box && result.data.red_points.box.rounds>0 && result.data.red_points.box.state==4) { + await TreeOpenBox() + } + if(result.data.kettle.water_num >= 100) { + await TreeWaterTenTimes() + } else if(result.data.kettle.water_num>=10) { + await TreeWater() + } + } else { + console.log(`用户${userIdx+1}查询种树信息失败:${result.message}`) + } +} + +//种树-水瓶奖励 +async function RewardTreeWaterBottle() { + let caller = printCaller() + let url = `${hostname}/ttgame/game_orchard/water_bottle/reward?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.status_code == 0) { + console.log(`用户${userIdx+1}领取种树水瓶奖励获得${result.data.reward_item.num}水滴`) + } else { + console.log(`用户${userIdx+1}领取种树水瓶奖励失败:${result.message}`) + } +} + +//种树-开宝箱 +async function TreeOpenBox() { + let caller = printCaller() + let url = `${hostname}/ttgame/game_orchard/box2/open?watch_ad=0&aid=35` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + //console.log(result) + if(result.status_code == 0) { + console.log(`用户${userIdx+1}种树开宝箱获得${result.data.incr_coin}金币`) + } else { + console.log(`用户${userIdx+1}种树开宝箱失败:${result.message}`) + } +} +//////////////////////////////////////////////////////////////////// +function populatePostUrl(url,reqBody=''){ + let timeInMS = Math.round(new Date().getTime()) + let timeInSecond = Math.floor(timeInMS/1000) + let urlObject = { + url: url, + headers: { + 'Accept-Encoding' : 'gzip', + 'X-SS-REQ-TICKET' : timeInMS, + 'passport-sdk-version' : '30', + 'sdk-version' : '2', + 'x-vc-bdturing-sdk-version' : '2.0.0', + 'User-Agent' : userAgentArr[userIdx%UAcount], + 'Cookie' : userHeaderArr[userIdx], + 'X-Khronos' : timeInSecond, + 'Content-Type' : 'application/json; charset=utf-8', + 'Host' : host, + 'Connection' : 'Keep-Alive', + }, + body: reqBody + } + return urlObject; +} + +function populateGetUrl(url){ + let timeInMS = Math.round(new Date().getTime()) + let timeInSecond = Math.floor(timeInMS/1000) + let urlObject = { + url: url, + headers: { + 'Accept-Encoding' : 'gzip', + 'X-SS-REQ-TICKET' : timeInMS, + 'passport-sdk-version' : '30', + 'sdk-version' : '2', + 'x-vc-bdturing-sdk-version' : '2.0.0', + 'User-Agent' : userAgentArr[userIdx%UAcount], + 'Cookie' : userHeaderArr[userIdx], + 'X-Khronos' : timeInSecond, + 'Content-Type' : 'application/json; charset=utf-8', + 'Host' : host, + 'Connection' : 'Keep-Alive', + } + } + return urlObject; +} + +async function httpPost(url,caller) { + httpResult = null + return new Promise((resolve) => { + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log(caller + ": post请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + httpResult = JSON.parse(data); + if(logDebug) console.log(httpResult); + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +async function httpGet(url,caller) { + httpResult = null + return new Promise((resolve) => { + $.get(url, async (err, resp, data) => { + try { + if (err) { + console.log(caller + ": get请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data,caller)) { + httpResult = JSON.parse(data); + if(logDebug) console.log(httpResult); + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +function safeGet(data,caller) { + try { + if (typeof JSON.parse(data) == "object") { + return true; + } else { + console.log(`Function ${caller}: 未知错误`); + console.log(data) + } + } catch (e) { + console.log(e); + console.log(`Function ${caller}: 服务器访问数据为空,请检查自身设备网络情况`); + return false; + } +} + +function printCaller(){ + return (new Error()).stack.split("\n")[2].trim().split(" ")[1] +} + +function getMin(a,b){ + return ((a { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), a = { url: `http://${h}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(a, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null } setval(t, e) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null } initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) } get(t, e = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.get(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { try { if (t.headers["set-cookie"]) { const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar } } catch (t) { this.logErr(t) } }).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) })) } post(t, e = (() => { })) { if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.post(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) }); else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: s, ...i } = t; this.got.post(s, i).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) }) } } time(t) { let e = { "M+": (new Date).getMonth() + 1, "d+": (new Date).getDate(), "H+": (new Date).getHours(), "m+": (new Date).getMinutes(), "s+": (new Date).getSeconds(), "q+": Math.floor(((new Date).getMonth() + 3) / 3), S: (new Date).getMilliseconds() }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, ((new Date).getFullYear() + "").substr(4 - RegExp.$1.length))); for (let s in e) new RegExp("(" + s + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? e[s] : ("00" + e[s]).substr(("" + e[s]).length))); return t } msg(e = t, s = "", i = "", r) { const o = t => { if (!t) return t; if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : this.isSurge() ? { url: t } : void 0; if ("object" == typeof t) { if (this.isLoon()) { let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-url"]; return { openUrl: e, mediaUrl: s } } if (this.isQuanX()) { let e = t["open-url"] || t.url || t.openUrl, s = t["media-url"] || t.mediaUrl; return { "open-url": e, "media-url": s } } if (this.isSurge()) { let e = t.url || t.openUrl || t["open-url"]; return { url: e } } } }; this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))); let h = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="]; h.push(e), s && h.push(s), i && h.push(i), console.log(h.join("\n")), this.logs = this.logs.concat(h) } log(...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) } logErr(t, e) { const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); s ? this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack) : this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t) } wait(t) { return new Promise(e => setTimeout(e, t)) } done(t = {}) { const e = (new Date).getTime(), s = (e - this.startTime) / 1e3; this.log("", `\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } }(t, e) } diff --git a/txstock.js b/txstock.js index bb4da46..07125a7 100644 --- a/txstock.js +++ b/txstock.js @@ -1,10 +1,11 @@ /* 腾讯自选股APP & 微信微证券公众号 -改自@CenBoMin大佬的脚本 + 只适配了IOS,测试了青龙和V2P,其他平台请自行测试,安卓请自行测试 多用户用#隔开 -脚本只会在10点到13点之间进行猜涨跌,请务必在这段时间内跑一次脚本,猜涨跌开奖时间为15:15 +脚本只会在10点到13点之间进行猜涨跌,请务必在这段时间内跑一次脚本 +上证和个股猜涨跌开奖时间为15:15和16:30,建议16:30后再跑一次领奖 有些任务会提示任务完成发奖失败 -- 可以忽略 或者任务完成前置条件不符合 -- 一般为需要分享,会在完成日常任务后尝试做互助 @@ -37,7 +38,7 @@ MITM: wzq.tenpay.com 圈X: [task_local] #腾讯自选股 -16 12,15 * * * txstock.js, tag=腾讯自选股, enabled=true +35 11,16 * * * https://raw.githubusercontent.com/leafxcy/JavaScript/main/txstock.js, tag=腾讯自选股, enabled=true [rewrite_local] #获取APP和微信微证券的URL和header https://wzq.tenpay.com/cgi-bin/activity_task_daily.fcgi? url script-request-header https://raw.githubusercontent.com/leafxcy/JavaScript/main/txstock.js @@ -84,6 +85,12 @@ let scanList = [] let nickname = [] let bullStatusFlag = 0 +let guessOption = 0 +let guessStockFlag = 0 +let stockName = '' +let stockList = [] +let marketCode = {'sz':0, 'sh':1, 'hk':2, } + let appShareFlag = 1 let wxShareFlag = 1 let appTaskFlag = 1 @@ -246,12 +253,15 @@ async function getRewrite() if($request.url.indexOf("openid=") > -1) { //APP包 + let msgStr = '' $.setdata($request.url,'TxStockAppUrl') $.log(`获取TxStockAppUrl成功: ${$request.url}\n`) - $.msg(`获取TxStockAppUrl成功: ${$request.url}\n`) + msgStr += `获取TxStockAppUrl成功: ${$request.url}\n` $.setdata(JSON.stringify($request.headers),'TxStockAppHeader') $.log(`获取TxStockAppHeader成功: ${JSON.stringify($request.headers)}\n`) - $.msg(`获取TxStockAppHeader成功: ${JSON.stringify($request.headers)}\n`) + msgStr += `获取TxStockAppHeader成功: ${JSON.stringify($request.headers)}\n` + + $.msg(msgStr) } else { @@ -374,13 +384,17 @@ async function getEnvParam(userNum) app_UA = "" Object.keys(appHeaderArrVal).forEach((item) => { if(item.toLowerCase() == "cookie") { - app_ck = appHeaderArrVal[item] + //app_ck = appHeaderArrVal[item] + cookie = appHeaderArrVal[item] + //pgv_info_ssid = cookie.match(/pgv_info=ssid=([\w]+)/)[1] + pgv_pvid = cookie.match(/pgv_pvid=([\w]+)/)[1] + ts_sid = cookie.match(/ts_sid=([\w]+)/)[1] + ts_uid = cookie.match(/ts_uid=([\w]+)/)[1] } else if(item.toLowerCase() == "user-agent") { app_UA = appHeaderArrVal[item] } }) - app_ck = appHeaderArrVal["Cookie"] - app_UA = appHeaderArrVal["User-Agent"] + app_ck = `pgv_pvid=${pgv_pvid}; ts_sid=${ts_sid}; ts_uid=${ts_uid}` wx_ck_tmp = "" wx_UA = "" @@ -394,14 +408,14 @@ async function getEnvParam(userNum) pgv_info = wx_ck_tmp.match(/pgv_info=([\w=]+)/)[1] pgv_pvid = wx_ck_tmp.match(/pgv_pvid=([\w]+)/)[1] - ts_last = wx_ck_tmp.match(/ts_last=([\w\/]+)/)[1] - ts_refer = wx_ck_tmp.match(/ts_refer=([\w\/\.]+)/)[1] - ts_sid = wx_ck_tmp.match(/ts_sid=([\w]+)/)[1] - ts_uid = wx_ck_tmp.match(/ts_uid=([\w]+)/)[1] + //ts_last = wx_ck_tmp.match(/ts_last=([\w\/]+)/)[1] + //ts_refer = wx_ck_tmp.match(/ts_refer=([\w\/\.]+)/)[1] + //ts_sid = wx_ck_tmp.match(/ts_sid=([\w]+)/)[1] + //ts_uid = wx_ck_tmp.match(/ts_uid=([\w]+)/)[1] qlappid = wx_ck_tmp.match(/qlappid=([\w]+)/)[1] qlskey = wx_ck_tmp.match(/qlskey=([\w]+)/)[1] qluin = wx_ck_tmp.match(/qluin=([\w@\.]+)/)[1] - qq_logtype = wx_ck_tmp.match(/qq_logtype=([\w]+)/)[1] + //qq_logtype = wx_ck_tmp.match(/qq_logtype=([\w]+)/)[1] wzq_qlappid = wx_ck_tmp.match(/wzq_qlappid=([\w]+)/)[1] wzq_qlskey = wx_ck_tmp.match(/wzq_qlskey=([\w]+)/)[1] wzq_qluin = wx_ck_tmp.match(/wzq_qluin=([\w-]+)/)[1] @@ -409,7 +423,7 @@ async function getEnvParam(userNum) //wx_ck = `pgv_info=${pgv_info}; pgv_pvid=${pgv_pvid}; ts_last=${ts_last}; ts_refer=${ts_refer}; ts_sid=${ts_sid}; ts_uid=${ts_uid}; qlappid=${qlappid}; qlskey=${qlskey}; qluin=${qluin}; qq_logtype=${qq_logtype}; wx_session_time=${sessionTime}; wzq_qlappid=${wzq_qlappid}; wzq_qlskey=${wzq_qlskey}; wzq_qluin=${wzq_qluin}; zxg_openid=${zxg_openid}` - wx_ck = `pgv_info=${pgv_info}; pgv_pvid=${pgv_pvid}; ts_last=${ts_last}; ts_refer=${ts_refer}; ts_sid=${ts_sid}; ts_uid=${ts_uid}; qlappid=${qlappid}; qlskey=${qlskey}; qluin=${qluin}; qq_logtype=${qq_logtype}; wzq_qlappid=${wzq_qlappid}; wzq_qlskey=${wzq_qlskey}; wzq_qluin=${wzq_qluin}; zxg_openid=${zxg_openid}` + wx_ck = `pgv_info=${pgv_info}; pgv_pvid=${pgv_pvid}; qlappid=${qlappid}; qlskey=${qlskey}; qluin=${qluin}; wzq_qlappid=${wzq_qlappid}; wzq_qlskey=${wzq_qlskey}; wzq_qluin=${wzq_qluin}; zxg_openid=${zxg_openid}` } async function initAccountInfo() @@ -1977,10 +1991,11 @@ async function appGuessStatus() { curTime = new Date() rndtime = Math.round(curTime.getTime()) currentHour = curTime.getHours() - let isGuessTime = ((currentHour < 13) && (currentHour > 9)) ? 1 : 0 + currentDay = curTime.getDay() + let isGuessTime = ((currentHour < 13) && (currentHour > 9) && (currentDay < 6) && (currentDay > 0)) ? 1 : 0 return new Promise((resolve) => { let url = { - url: `https://zqact.tenpay.com/cgi-bin/guess_home.fcgi?channel=1&source=2&new_version=2&_=${rndtime}&openid=${app_openid}&fskey=${app_fskey}&access_token=${app_token}&_appName=${app_appName}&_appver=${app_appver}&_osVer=${app_osVer}&_devId=${app_devId}`, + url: `https://zqact.tenpay.com/cgi-bin/guess_home.fcgi?channel=1&source=2&new_version=3&_=${rndtime}&openid=${app_openid}&fskey=${app_fskey}&access_token=${app_token}&_appName=${app_appName}&_appver=${app_appver}&_osVer=${app_osVer}&_devId=${app_devId}`, headers: { 'Cookie': app_ck, 'Accept': `application/json, text/plain, */*`, @@ -2007,34 +2022,54 @@ async function appGuessStatus() { if(result.notice_info && result.notice_info[0]) { if(logDebug) console.log(result) if(result.notice_info[0].answer_status == 1) { - $.log(`上期猜涨跌回答正确,正在取得奖励\n`); + $.log(`上期猜上证指数涨跌回答正确,正在取得奖励\n`); await appGuessAward(result.notice_info[0].date) } else { - $.log(`上期猜涨跌回答错误\n`); + $.log(`上期猜上证指数涨跌回答错误\n`); + } + await $.wait(1000) + } + if(result.stock_notice_info && result.stock_notice_info[0]) { + if(logDebug) console.log(result) + if(result.stock_notice_info[0].guess_correct == 1) { + $.log(`上期猜个股涨跌回答正确,正在取得奖励\n`); + await appGuessStockAward(result.stock_notice_info[0].date) + } else { + $.log(`上期猜个股涨跌回答错误\n`); } await $.wait(1000) } if(isGuessTime) { if((result.T_info && result.T_info[0] && result.T_info[0].user_answer == 0) || (result.T1_info && result.T1_info[0] && result.T1_info[0].user_answer == 0)) { - let guessOption = 1 - if(result.stockinfo && result.stockinfo[0]) { - guessOption = (result.stockinfo[0].zdf.indexOf('-') > -1) ? 2 : 1 - let guessStr = (guessOption == 2) ? "跌" : "涨" - $.log(`当前上证指数涨幅为${result.stockinfo[0].zdf}%,为你猜${guessStr}\n`); - } else { - $.log(`未获取到上证指数状态,默认为你猜涨\n`); - } if(result.date_list) { for(let i=0; i 0) { + await $.wait(100) + await appGuessRiseFall(guessOption,guessItem.date) + } else { + $.log(`获取猜涨跌错误:guessOption=${guessOption}\n`); + } } } } } else { - $.log(`已竞猜当期涨跌\n`); + $.log(`已竞猜当期上证指数涨跌\n`); + } + if(result.recommend && Array.isArray(result.recommend)) { + recList = result.recommend + stockList = recList.sort(function(a,b){return Math.abs(b["zdf"])-Math.abs(a["zdf"])}); + guessStockFlag = 1 + for(let k=0; k { + let url = { + url: `https://zqact.tenpay.com/cgi-bin/open_stockinfo.fcgi?scode=${scode}&markets=${markets}&needfive=0&needquote=1&needfollow=0&type=0&channel=1&_=${rndtime}&openid=${app_openid}&fskey=${app_fskey}&access_token=${app_token}&_appName=${app_appName}&_appver=${app_appver}&_osVer=${app_osVer}&_devId=${app_devId}`, + headers: { + 'Cookie': app_ck, + 'Accept': `*/*`, + 'Connection': `keep-alive`, + 'Referer': `https://zqact.tenpay.com/activity/page/guessRiseFall/`, + 'Accept-Encoding': `gzip, deflate, br`, + 'Host': `zqact.tenpay.com`, + 'User-Agent': app_UA, + 'Accept-Language': `zh-cn`, + }, + }; + + $.get(url, async (err, resp, data) => { + try { + data = data.replace(/\\x/g,'') + if (err) { + console.log("腾讯自选股: API查询请求失败 ‼️‼️"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + let result = JSON.parse(data); + if(logDebug) console.log(result) + if(result.retcode == 0) { + stockName = result.secu_info.secu_name || '' + if(stockName) { + let dqj = result.secu_quote.dqj || 0 + let zsj = result.secu_quote.zsj || 0 + let raise = dqj - zsj + let ratio = raise/zsj*100 + let guessStr = (raise < 0) ? '跌' : '涨' + guessOption = (raise < 0) ? 2 : 1 + $.log(`${stockName}:当前价格${dqj},前天收市价${zsj},涨幅${Math.floor(ratio*100)/100}% (${Math.floor(raise*100)/100}),猜${guessStr}`); + } + } else { + $.log(`获取个股信息失败:${result.retmsg}`); + } + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +//猜上证指数涨跌奖励 async function appGuessAward(guessDate) { rndtime = Math.round(curTime.getTime()) return new Promise((resolve) => { @@ -2094,9 +2184,61 @@ async function appGuessAward(guessDate) { let result = JSON.parse(data); if(logDebug) console.log(result) if(result.retcode == 0) { - $.log(`获得猜涨跌奖励:${result.reward_memo} ${result.reward_value}金币\n`); + $.log(`获得上证指数猜涨跌奖励:${result.reward_memo} ${result.reward_value}金币\n`); + } else { + $.log(`获得上证指数猜涨跌奖励失败:${result.retmsg}\n`); + } + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +//猜个股涨跌奖励 +async function appGuessStockAward(guessDate) { + rndtime = Math.round(curTime.getTime()) + return new Promise((resolve) => { + let url = { + url: `https://zqact.tenpay.com/cgi-bin/activity/activity.fcgi?activity=guess_new&action=guess_stock_reward&guess_date=${guessDate}&channel=1&_=${rndtime}&openid=${app_openid}&fskey=${app_fskey}&access_token=${app_token}&_appName=${app_appName}&_appver=${app_appver}&_osVer=${app_osVer}&_devId=${app_devId}`, + headers: { + 'Cookie': app_ck, + 'Accept': `application/json, text/plain, */*`, + 'Connection': `keep-alive`, + 'Referer': `https://zqact.tenpay.com/activity/page/guessRiseFall/`, + 'Accept-Encoding': `gzip, deflate, br`, + 'Host': `zqact.tenpay.com`, + 'User-Agent': app_UA, + 'Accept-Language': `zh-cn` + }, + }; + $.get(url, async (err, resp, data) => { + try { + if (err) { + console.log("腾讯自选股: API查询请求失败 ‼️‼️"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + let result = JSON.parse(data); + if(logDebug) console.log(result) + if(result.retcode == 0) { + if(result.stock_rewards && Array.isArray(result.stock_rewards)) { + for(let i=0; i { + let url = { + url: `https://wzq.tenpay.com/cgi-bin/guess_home.fcgi?access_token=${app_token}&openid=${app_openid}&fskey=${app_fskey}&check=11&_dev=iPhone13,2&_devId=${app_devId}&_appver=${app_appver}&_osVer=${app_osVer}&_appName=${app_appName}&source=3&channel=1&symbol=${stockItem.symbol}&new_version=3`, + headers: { + 'Cookie': app_ck, + 'Accept': `application/json, text/plain, */*`, + 'Connection': `keep-alive`, + 'Referer': `https://zqact.tenpay.com/activity/page/guessRiseFall/`, + 'Accept-Encoding': `gzip, deflate, br`, + 'Host': `zqact.tenpay.com`, + 'User-Agent': app_UA, + 'Accept-Language': `zh-cn` + }, + }; + $.get(url, async (err, resp, data) => { + try { + if (err) { + console.log("腾讯自选股: API查询请求失败 ‼️‼️"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + let result = JSON.parse(data); + if(logDebug) console.log(result) if(result.retcode == 0) { - $.log(`用户 ${nickname[numUser]} 猜涨跌成功:${guessStr}\n`); + $.log(`剩余猜个股涨跌次数:${result.guess_times_left}`); + if(result.guess_times_left > 0) { + if(result.T_info.user_answer > 0) { + $.log(`已竞猜:${stockItem.stockname}\n`); + } else { + let guessStr = (stockItem.zdf < 0) ? '跌' : '涨' + let answer = (stockItem.zdf < 0) ? 2 : 1 + console.log(`${stockItem.stockname}今天涨幅为${stockItem.zdf}%,猜${guessStr}`) + await $.wait(1000) + await appGuessStock(stockItem,answer) + } + } else { + $.log(`竞猜个股次数已用完\n`); + guessStockFlag = 0 + } } else { - $.log(`用户 ${nickname[numUser]} ${guessStr}失败:${result.retmsg}\n`); + $.log(`获取猜个股涨跌次数失败:${result.retmsg}\n`); } } } @@ -2152,6 +2352,52 @@ async function appGuessRiseFall(answer,guessDate) { }); }); } + +//猜个股涨跌 +async function appGuessStock(stockItem,answer) { + rndtime = Math.round(curTime.getTime()) + return new Promise((resolve) => { + let url = { + url: `https://wzq.tenpay.com/cgi-bin/guess_op.fcgi?access_token=${app_token}&openid=${app_openid}&fskey=${app_fskey}&check=11&_dev=iPhone13,2&_devId=${app_devId}&_appver=${app_appver}&_osVer=${app_osVer}&_appName=${app_appName}&`, + headers: { + 'Cookie': app_ck, + 'Accept': `application/json, text/plain, */*`, + 'Connection': `keep-alive`, + 'Referer': `https://zqact.tenpay.com/activity/page/guessRiseFall/`, + 'Accept-Encoding': `gzip, deflate, br`, + 'Host': `zqact.tenpay.com`, + 'User-Agent': app_UA, + 'Accept-Language': `zh-cn` + }, + body: `source=3&channel=1&outer_src=0&new_version=3&symbol=${stockItem.symbol}&date=${todayDate}&action=2&user_answer=${answer}&access_token=${app_token}&openid=${app_openid}&fskey=${app_fskey}&check=11&`, + }; + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log("腾讯自选股: API查询请求失败 ‼️‼️"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + let result = JSON.parse(data); + if(logDebug) console.log(result) + let guessStr = (answer==1) ? "猜涨" : "猜跌" + if(result.retcode == 0) { + $.log(`${stockItem.stockname} 猜涨跌成功:${guessStr}\n`); + } else { + $.log(`${stockItem.stockname} ${guessStr}失败:${result.retmsg}\n`); + } + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + //////////////////////////////////////////////////////////////////// function time(time) { diff --git a/ydd.js b/ydd.js new file mode 100644 index 0000000..b3e3f2a --- /dev/null +++ b/ydd.js @@ -0,0 +1,1105 @@ +/* +IOS:看点宝/阅多多/悦看点 +三个APP分别捉包,可以共用一个脚本跑任务 +比较容易黑,不要跑太频繁,每天11次就可以领完任务奖励 +每天金币7毛以上,提现1元和5元需要做任务拿提现券 +看点宝下载注册地址:https://yuekandian.yichengw.cn/download?app=5&referrer=764084 + +可以在环境变量yddSkipWithdraw设置不想提现的金额,逗号隔开,填0就会尝试提现所有金额 +export yddSkipWithdraw='1' + +青龙: +捉取 https://yuekandian.yichengw.cn/api/v1/member/profile 的包里的Authorization(把前面的Bearer删掉),device和User-Agent,按顺序用#连起来写到yddCookie里,多账户用@隔开 +export yddCookie='账号1的Authorization#device#UA@账号2的Authorization#device#UA' + +V2P重写:打开APP即可获取CK,没有的话点一下我的页面或者赚钱页面 +[task_local] +#看点宝/阅多多/悦看点 +15 9-21 * * * https://raw.githubusercontent.com/leafxcy/JavaScript/main/ydd.js, tag=看点宝/阅多多/悦看点, enabled=true +[rewrite_local] +https://yuekandian.yichengw.cn/api/v1/member/profile url script-request-header https://raw.githubusercontent.com/leafxcy/JavaScript/main/ydd.js +[MITM] +hostname = yuekandian.yichengw.cn +*/ + +const jsname = '阅多多' +const $ = Env(jsname) +const notifyFlag = 1; //0为关闭通知,1为打开通知,默认为1 +const logDebug = 0 + +//const notify = $.isNode() ? require('./sendNotify') : ''; +let notifyStr = '' + +let rndtime = "" //毫秒 +let httpResult //global buffer + +let host = 'yuekandian.yichengw.cn' +let hostname = 'https://' + host + +let yddCookie = ($.isNode() ? process.env.yddCookie : $.getdata('yddCookie')) || ''; +let yddCookieArr = [] +let userToken = [] +let userDevice = [] +let userAgent = [] +let userCookie = [] + +let yddSkipWithdraw = ($.isNode() ? process.env.yddSkipWithdraw : $.getdata('yddSkipWithdraw')) || '0'; +let skipWithdraw = [] + +let userIdx = 0 +let taskIdx = 0 +let coinList = [] +let signFlag = [] +let contSignFlag = [] +let lotteryTicket = [] +let lotteryAdTicket = [] +let helpTicket = [] +let userTicket = [] +let userWaitTime = [] +let extraRewardFlag = [] +let userInfo = [] +let withdrawFlag = [] +let adVideoFlag = [] +let adVideoTicket = [] +let doAliFlag = [] +let barrierFlag = [] +let doneTaskList = [] +let doneTaskTicket = [] + +let NUM_PER_ROUND = 2 + +let LOTTERY_TYPE = 1 +let AD_TICKET_TYPE = 5 +let AD_VIDEO_TYPE = 10 +let HELP_TYPE = 13 +let COIN_TYPE = 14 + +/////////////////////////////////////////////////////////////////// + +!(async () => { + + if(typeof $request !== "undefined") + { + await GetRewrite() + } + else + { + if(!(await checkEnv())) { + return + } + + await initAccountInfo() + await RunMultiUser() + } + + +})() +.catch((e) => $.logErr(e)) +.finally(() => $.done()) + +//通知 +async function showmsg() { + + notifyBody = jsname + "运行通知\n\n" + notifyStr + + if (notifyFlag != 1) { + console.log(notifyBody); + } + + if (notifyFlag == 1) { + $.msg(notifyBody); + //if ($.isNode()){await notify.sendNotify($.name, notifyBody );} + } +} + +async function GetRewrite() { + if($request.url.indexOf('/api/v1/member/profile') > -1) { + let headers = $request.headers + let auth = headers.Authorization + if(!auth) return + auth = auth.replace(/Bearer /g,'') + let device = headers['device'] + if(!device) return + let ua = headers['User-Agent'] + if(!ua) return + let ck = auth + '#' + device + '#' + ua + + if(yddCookie) { + if(yddCookie.indexOf(ck) == -1) { + yddCookie = yddCookie + '@' + ck + $.setdata(yddCookie, 'yddCookie'); + ckList = yddCookie.split('@') + $.msg(jsname+` 获取第${ckList.length}个yddCookie成功: ${yddCookie}`) + } + } else { + $.setdata(ck, 'yddCookie'); + $.msg(jsname+` 获取第1个yddCookie成功: ${ck}`) + } + } +} + +async function checkEnv() { + if(yddCookie) { + yddCookie = yddCookie.replace(/Bearer/g,'') + if(yddCookie.indexOf('@') > -1) { + let yddCookies = yddCookie.split('@') + for(let i=0; i -1) { + skipWithdraw = yddSkipWithdraw.split(',') + } else { + skipWithdraw.push(yddSkipWithdraw) + } + } + + console.log(`共找到${yddCookieArr.length}个用户`) + return true +} + +async function initAccountInfo() { + for(userIdx=0; userIdx 0) { + console.log('\n开始领取首页气泡红包...') + for(let i=0; i 0) { + console.log('\n开始签到...') + for(userIdx=0; userIdx 0) { + console.log('\n开始领取连续签到奖励...') + for(userIdx=0; userIdx 0) { + console.log('\n开始抽奖...') + for(userIdx=0; userIdx0) needBarrier=1 + } + await $.wait(100) + + if(needBarrier > 0) { + for(userIdx=0; userIdx 0) { + console.log('\n开始领取任务奖励...') + for(taskIdx=0; taskIdx 0) { + console.log('\n开始做跳转支付宝任务...') + for(userIdx=0; userIdx 0) { + console.log('\n开始看广告...') + for(userIdx=0; userIdx 0) { + for(userIdx=0; userIdx 0; i++) { + haveTicket = 0 + console.log(`--- 开始刷第${i+1}轮 ---`) + + let waitTime = Math.floor(Math.random()*1000) + maxWaitTime*1000 + console.log(`随机等待${waitTime/1000}秒...`) + await $.wait(waitTime) + for(userIdx=0; userIdx 0) { + for(userIdx=0; userIdx 0; i++) { + haveTicket = 0 + console.log(`--- 开始刷第${i+1}轮 ---`) + + let waitTime = Math.floor(Math.random()*1000) + maxWaitTime*1000 + console.log(`随机等待${waitTime/1000}秒...`) + await $.wait(waitTime) + for(userIdx=0; userIdx= items.days) { + console.log(`用户${userIdx+1}可领取${items.desc}奖励`) + contSignFlag[userIdx] = 1 + } + } + } else { + console.log(`用户${userIdx+1}查询签到状态失败:${result.message}`) + } +} + +//签到 +async function DoSign() { + let caller = printCaller() + let url = `${hostname}/api/v1/reward/sign?` + let urlObject = populatePostUrl(url) + await httpPost(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.code == 0) { + console.log(`用户${userIdx+1}签到获得:${result.result.coin}金币`) + } else { + console.log(`用户${userIdx+1}签到失败:${result.message}`) + } +} + +//连续签到奖励 +async function RewardContinuesSign() { + let caller = printCaller() + let url = `${hostname}/api/v1/reward/sign/red_envelope?` + let urlObject = populatePostUrl(url) + await httpPost(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.code == 0) { + console.log(`用户${userIdx+1}获得连续签到奖励:${result.result.amount}元`) + } else { + console.log(`用户${userIdx+1}获得连续签到奖励失败:${result.message}`) + } +} + +//查询首页金币气泡 +async function QueryCoinInfo() { + let caller = printCaller() + let url = `${hostname}/api/v1/reward/coin?` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.code == 0) { + for(let items of result.result.coins) { + if(items.num > 0) { + coinList[userIdx].push(items) + } + } + console.log(`用户${userIdx+1}有${coinList[userIdx].length}个可以领取的首页气泡`) + } else { + console.log(`用户${userIdx+1}查询首页气泡信息失败:${result.message}`) + } +} + +//领取首页气泡 +async function GetCoin(id) { + let caller = printCaller() + let url = `${hostname}/api/v1/reward/coin?` + let body = `id=${id}&` + let urlObject = populatePostUrl(url,body) + await httpPost(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.code == 0) { + console.log(`用户${userIdx+1}领取首页气泡获得:${result.result.coin}金币`) + } else { + console.log(`用户${userIdx+1}领取首页气泡失败:${result.message}`) + } +} + +//查询抽奖状态 +async function QueryLotteryInfo() { + let caller = printCaller() + let url = `${hostname}/api/v1/reward/lottery/index?` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.code == 0) { + console.log(`用户${userIdx+1}今天剩余抽奖次数:${result.result.lottery_count}`) + if(result.result.lottery_count>0) { + lotteryTicket[userIdx] = result.result.ticket + } + } else { + console.log(`用户${userIdx+1}查询抽奖状态失败:${result.message}`) + } +} + +//抽奖 +async function DoLottery(ticket) { + let caller = printCaller() + let url = `${hostname}/api/v1/reward/lottery/index?` + let body = `ticket=${ticket}&` + let urlObject = populatePostUrl(url,body) + await httpPost(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.code == 0) { + if(result.result.type==2) { + lotteryAdTicket[userIdx] = result.result.ticket + console.log(`用户${userIdx+1}抽奖获得:${result.result.num}金币`) + } else if (result.result.type==1) { + console.log(`用户${userIdx+1}抽奖获得:${result.result.num}手机碎片`) + } else { + console.log(result) + } + } else { + console.log(`用户${userIdx+1}抽奖失败:${result.message}`) + } +} + +//助力领现金-看视频 +async function HelpClick() { + let caller = printCaller() + let url = `${hostname}/api/v1/reward/help/click?` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.code == 0) { + if(result.result && result.result.ticket) { + helpTicket[userIdx] = result.result.ticket + console.log(`用户${userIdx+1}看助力领现金视频将获得${result.result.coin/10000}元余额`) + } else { + console.log(`用户${userIdx+1}看助力领现金视频失败:${result.message}`) + } + } else { + console.log(`用户${userIdx+1}看助力领现金视频失败:${result.message}`) + } +} + +//助力领现金信息 +async function HelpInfo() { + let caller = printCaller() + let url = `${hostname}/api/v1/reward/help/index?` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.code == 0) { + console.log(`用户${userIdx+1}助力领现金金额:${result.result.jinbi}元,还差${result.result.diff_jinbi}元可以提现`) + } else { + console.log(`用户${userIdx+1}看助力领现金视频失败:${result.message}`) + } +} + +//开始广告 +async function WatchAd(type) { + let caller = printCaller() + let url = `${hostname}/api/v1/ad/topon/placement/id?type=${type}&` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.code == 0) { + console.log(`用户${userIdx+1}开始看广告`) + } else { + console.log(`用户${userIdx+1}看广告失败:${result.message}`) + } +} + +//完成广告 +async function LogAd(type,ticket='') { + let caller = printCaller() + let ticketStr = '' + if(ticket) ticketStr = `ticket=${ticket}&` + let url = `${hostname}/api/v1/ad/log?${ticketStr}type=${type}&` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.code == 0) { + console.log(`用户${userIdx+1}完成看广告`) + } else { + console.log(`用户${userIdx+1}完成看广告失败:${result.message}`) + } +} + +//获取ticket +async function GetTicket(suburl) { + userTicket[userIdx] = '' + userWaitTime[userIdx] = 0 + let caller = printCaller() + let url = `${hostname}/api/v1/reward/${suburl}` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.code == 0) { + if(result.result.coin_status==1) { + if(result.result.ticket) { + userTicket[userIdx] = result.result.ticket + userWaitTime[userIdx] = result.result.time + console.log(`用户${userIdx+1}获取到ticket`) + } else { + console.log(`用户${userIdx+1}获取ticket失败:${result.message}`) + } + } else { + console.log(`用户${userIdx+1}已无法获得更多金币`) + } + } else { + console.log(`用户${userIdx+1}获取ticket失败:${result.message}`) + } +} + +//记录时间 +async function TimeRecord(suburl,isEnd=false) { + let caller = printCaller() + let endStr = '' + let desc = '开始' + if(isEnd) { + endStr = 'end=1&' + desc = '结束' + } + let url = `${hostname}/api/v1/reward/${suburl}/interval?${endStr}` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.code == 0) { + console.log(`用户${userIdx+1}${desc}记录时长`) + } else { + console.log(`用户${userIdx+1}${desc}记录时长失败:${result.message}`) + } +} + +//获得奖励 +async function Reward(suburl,ticket,subbody='') { + extraRewardFlag[userIdx] = 0 + userTicket[userIdx] = '' + userWaitTime[userIdx] = 0 + let caller = printCaller() + let url = `${hostname}/api/v1/reward/${suburl}` + let body = `ticket=${ticket}&${subbody}` + let urlObject = populatePostUrl(url,body) + await httpPost(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.code == 0) { + if(result.result.count >= result.result.target && result.result.ren_status == 1) extraRewardFlag[userIdx]=1 + if(result.result.ticket) { + userTicket[userIdx] = result.result.ticket + userWaitTime[userIdx] = result.result.time + console.log(`用户${userIdx+1}获取到下一个ticket`) + } else { + console.log(`用户${userIdx+1}获取下一个ticket失败:${result.message}`) + } + console.log(`用户${userIdx+1}获得:${result.result.reward}金币,额外奖励次数${result.result.target},目前已刷${result.result.count}次`) + } else { + console.log(`用户${userIdx+1}获得奖励失败:${result.message}`) + } +} + +//额外次数奖励 +async function RewardOpen(suburl,body='') { + let caller = printCaller() + let url = `${hostname}/api/v1/reward/${suburl}/open?` + let urlObject = populatePostUrl(url,body) + await httpPost(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.code == 0) { + console.log(`用户${userIdx+1}获得额外奖励:${result.result.reward}金币`) + } else { + console.log(`用户${userIdx+1}获得额外奖励失败:${result.message}`) + } +} + +//账号信息 +async function QueryUserInfo() { + let caller = printCaller() + let url = `${hostname}/api/v1/member/profile?debug=0&` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.code == 0) { + console.log(`\n==== 用户${userIdx+1}: ${result.result.nickname} ====`) + console.log(`今日收益: ${result.result.today_point}`) + console.log(`提现券 : ${result.result.ticket}`) + console.log(`手机碎片: ${result.result.fragment}`) + console.log(`金币余额: ${result.result.point}`) + console.log(`历史收益: ${result.result.total_point}`) + userInfo[userIdx] = result.result + } else { + console.log(`用户${userIdx+1}查询账号信息失败:${result.message}`) + } +} + +//提现列表 +async function QueryWithdrawList() { + let caller = printCaller() + let url = `${hostname}/api/v1/cash/exchange?` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.code == 0) { + let sortList = result.result.items.sort(function(a,b){return b["jine"]-a["jine"]}); + for(let item of sortList) { + let skipFlag = 0 + if(skipWithdraw.length>0) { + for(let skipItem of skipWithdraw) { + if(item.jine == skipItem) { + skipFlag = 1 + break + } + } + } + if(skipFlag==1) { + console.log(`用户${userIdx+1}跳过提现${item.jine}元`) + continue + } + if(userInfo[userIdx].point>=item.jinbi && userInfo[userIdx].ticket>=item.cond && item.is_ok==1) { + console.log(`用户${userIdx+1}准备提现${item.jine}元`) + await Withdraw(item.jine) + if(withdrawFlag[userIdx]==1) break; + } + } + } else { + console.log(`用户${userIdx+1}查询提现列表失败:${result.message}`) + } +} + +//提现 +async function Withdraw(amount) { + let caller = printCaller() + let url = `${hostname}/api/v1/cash/exchange?` + let body = `amount=${amount}&gate=wechat&` + let urlObject = populatePostUrl(url,body) + await httpPost(urlObject,caller) + let result = httpResult; + if(!result) return false + + if(result.code == 0) { + withdrawFlag[userIdx] = 1 + console.log(`用户${userIdx+1}提现${amount}:${result.result.title}, ${result.result.message}`) + } else { + console.log(`用户${userIdx+1}提现${amount}失败:${result.message}`) + } + return false +} + +//获取任务列表状态 +async function QueryTaskList() { + let caller = printCaller() + let url = `${hostname}/api/v1/zhuan/index?` + let urlObject = populatePostUrl(url) + await httpPost(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.code == 0) { + for(let item of result.result.items) { + let str = (item.st==0) ? '未完成' : '已完成' + if(item.title.indexOf('观看广告视频') > -1) { + let matchItem = item.title.match(/"red">(\w+)<\/font>\/(\w+)/) + str = (parseInt(matchItem[2]) > parseInt(matchItem[1])) ? '未完成' : '已完成' + if(item.st==0) adVideoFlag[userIdx] = 1 + console.log(`用户${userIdx+1}${str}看广告任务,总次数${matchItem[2]}次,已完成${matchItem[1]}次`) + } else if(item.title.indexOf('支付宝红包') > -1) { + if(item.st==0) doAliFlag[userIdx] = 1 + console.log(`用户${userIdx+1}${str}跳转支付宝任务`) + } else if(item.title.indexOf('看资讯') > -1) { + let matchItem = item.rate.split('$') + console.log(`用户${userIdx+1}${str}看资讯任务,总次数${matchItem[1]}次,已完成${matchItem[0]}次`) + } else if(item.title.indexOf('刷视频') > -1) { + let matchItem = item.rate.split('$') + console.log(`用户${userIdx+1}${str}刷视频任务,总次数${matchItem[1]}次,已完成${matchItem[0]}次`) + } + if(item.st==1) { + if(item.id != 10 && item.time <= 0) { + doneTaskList[userIdx].push(item.id) + doneTaskTicket[userIdx].push('') + } + } + } + } else { + console.log(`用户${userIdx+1}获取任务列表状态失败:${result.message}`) + } +} + +//获取看广告视频任务ticket +async function DoAdVideo() { + let caller = printCaller() + let url = `${hostname}/api/v1/zhuan/video?` + let urlObject = populatePostUrl(url) + await httpPost(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.code == 0) { + if(result.result.ticket) { + adVideoTicket[userIdx] = result.result.ticket + console.log(`用户${userIdx+1}获取看广告视频ticket成功,将获得:${result.result.coin}金币,${result.result.coupon}提现券`) + } else { + console.log(`用户${userIdx+1}获取看广告视频ticket失败`) + } + } else { + console.log(`用户${userIdx+1}获取看广告视频ticket失败:${result.message}`) + } +} + +//跳转支付宝 +async function DoAliTask() { + let caller = printCaller() + let url = `${hostname}/api/v1/zhuan/aliaaa?` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.code == 0) { + console.log(`用户${userIdx+1}完成跳转支付宝任务`) + } else { + console.log(`用户${userIdx+1}完成跳转支付宝任务失败:${result.message}`) + } +} + +//闯关换手机状态 +async function QueryBarrierInfo() { + let caller = printCaller() + let url = `${hostname}/api/v1/reward/barrier/index?` + let urlObject = populateGetUrl(url) + await httpGet(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.code == 0) { + console.log(`用户${userIdx+1}今天已闯关${result.result.current_barrier}次`) + if(result.result.current_barrier<7) { + barrierFlag[userIdx] = parseInt(result.result.current_barrier) + 1 + } + } else { + console.log(`用户${userIdx+1}获取看广告视频ticket失败:${result.message}`) + } +} + +//闯关 +async function DoBarrier(num) { + let caller = printCaller() + let url = `${hostname}/api/v1/reward/barrier/index?` + let body = `no=${num}&` + let urlObject = populatePostUrl(url,body) + await httpPost(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.code == 0) { + console.log(`用户${userIdx+1}闯关获得:${result.result.coin}金币,${result.result.fragment}手机碎片`) + } else { + console.log(`用户${userIdx+1}闯关失败:${result.message}`) + } +} + +//领任务奖励 +async function doneTaskReward(id) { + let caller = printCaller() + let url = `${hostname}/api/v1/zhuan/done?` + let body = `id=${id}&` + let urlObject = populatePostUrl(url,body) + await httpPost(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.code == 0) { + if(result.result.ticket) doneTaskTicket[userIdx][taskIdx] = result.result.ticket + console.log(`用户${userIdx+1}领取任务[id=${id}]奖励获得:${result.result.coin}金币`) + } else { + console.log(`用户${userIdx+1}领取任务[id=${id}]奖励失败:${result.message}`) + } +} +//////////////////////////////////////////////////////////////////// +function populatePostUrl(url,reqBody=''){ + let urlObject = { + url: url, + headers: { + 'Host' : 'yuekandian.yichengw.cn', + 'version' : '8', + 'Authorization' : 'Bearer ' + userToken[userIdx], + 'Accept-Language' : 'zh-CN,zh-Hans;q=0.9', + 'Accept-Encoding' : 'gzip, deflate, br', + 'platform' : '2', + 'Accept' : '*/*', + 'User-Agent' : userAgent[userIdx], + 'Connection' : 'keep-alive', + 'device' : userDevice[userIdx], + 'store' : '100', + }, + body: reqBody + } + if(userAgent[userIdx].indexOf('CBD') > -1) { + urlObject.headers['version'] = '2' + urlObject.headers['app'] = '3' + } else if(userAgent[userIdx].indexOf('KDB') > -1) { + urlObject.headers['version'] = '1' + urlObject.headers['app'] = '5' + } + return urlObject; +} + +function populateGetUrl(url){ + let urlObject = { + url: url, + headers: { + 'Host' : 'yuekandian.yichengw.cn', + 'version' : '8', + 'Authorization' : 'Bearer ' + userToken[userIdx], + 'Accept-Language' : 'zh-CN,zh-Hans;q=0.9', + 'Accept-Encoding' : 'gzip, deflate, br', + 'platform' : '2', + 'Accept' : '*/*', + 'User-Agent' : userAgent[userIdx], + 'Connection' : 'keep-alive', + 'device' : userDevice[userIdx], + 'store' : '100', + } + } + if(userAgent[userIdx].indexOf('CBD') > -1) { + urlObject.headers['version'] = '2' + urlObject.headers['app'] = '3' + } else if(userAgent[userIdx].indexOf('KDB') > -1) { + urlObject.headers['version'] = '1' + urlObject.headers['app'] = '5' + } + return urlObject; +} + +async function httpPost(url,caller) { + httpResult = null + return new Promise((resolve) => { + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log(caller + ": post请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + httpResult = JSON.parse(data); + if(logDebug) console.log(httpResult); + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +async function httpGet(url,caller) { + httpResult = null + return new Promise((resolve) => { + $.get(url, async (err, resp, data) => { + try { + if (err) { + console.log(caller + ": get请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data,caller)) { + httpResult = JSON.parse(data); + if(logDebug) console.log(httpResult); + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +function safeGet(data,caller) { + try { + if (typeof JSON.parse(data) == "object") { + return true; + } else { + console.log(`Function ${caller}: 未知错误`); + console.log(data) + } + } catch (e) { + console.log(e); + console.log(`Function ${caller}: 服务器访问数据为空,请检查自身设备网络情况`); + return false; + } +} + +function printCaller(){ + return (new Error()).stack.split("\n")[2].trim().split(" ")[1] +} + +function getMin(a,b){ + return ((a { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), a = { url: `http://${h}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(a, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null } setval(t, e) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null } initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) } get(t, e = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.get(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { try { if (t.headers["set-cookie"]) { const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar } } catch (t) { this.logErr(t) } }).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) })) } post(t, e = (() => { })) { if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.post(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) }); else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: s, ...i } = t; this.got.post(s, i).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) }) } } time(t) { let e = { "M+": (new Date).getMonth() + 1, "d+": (new Date).getDate(), "H+": (new Date).getHours(), "m+": (new Date).getMinutes(), "s+": (new Date).getSeconds(), "q+": Math.floor(((new Date).getMonth() + 3) / 3), S: (new Date).getMilliseconds() }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, ((new Date).getFullYear() + "").substr(4 - RegExp.$1.length))); for (let s in e) new RegExp("(" + s + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? e[s] : ("00" + e[s]).substr(("" + e[s]).length))); return t } msg(e = t, s = "", i = "", r) { const o = t => { if (!t) return t; if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : this.isSurge() ? { url: t } : void 0; if ("object" == typeof t) { if (this.isLoon()) { let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-url"]; return { openUrl: e, mediaUrl: s } } if (this.isQuanX()) { let e = t["open-url"] || t.url || t.openUrl, s = t["media-url"] || t.mediaUrl; return { "open-url": e, "media-url": s } } if (this.isSurge()) { let e = t.url || t.openUrl || t["open-url"]; return { url: e } } } }; this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))); let h = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="]; h.push(e), s && h.push(s), i && h.push(i), console.log(h.join("\n")), this.logs = this.logs.concat(h) } log(...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) } logErr(t, e) { const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); s ? this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack) : this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t) } wait(t) { return new Promise(e => setTimeout(e, t)) } done(t = {}) { const e = (new Date).getTime(), s = (e - this.startTime) / 1e3; this.log("", `\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } }(t, e) } diff --git a/zqkd/zqkd_risk.js b/zqkd/zqkd_risk.js new file mode 100644 index 0000000..e1e801c --- /dev/null +++ b/zqkd/zqkd_risk.js @@ -0,0 +1,312 @@ +/* +安卓:中青看点 风险查询+今日收益详情 + +需要用到zqkdCookie,只测试了青龙,理论上V2P也能用 +本脚本没有设置重写,请自己复制zq_cookie到青龙环境下使用,多账号用@隔开 +例子: export zqkdCookie='uid=xxx&zqkey=yyy&zqkey_id=zzz@uid=aaa&zqkey=bbb&zqkey_id=ccc@uid=qqq&zqkey=sss&zqkey_id=ttt' +*/ + +const jsname = '中青看点风险查询' +const $ = Env(jsname) +const notifyFlag = 1; //0为关闭通知,1为打开通知,默认为1 +const logDebug = 0 + +const notify = $.isNode() ? require('./sendNotify') : ''; +let notifyStr = '' + +let rndtime = "" //毫秒 +let httpResult //global buffer + +let userCookie = ($.isNode() ? process.env.zqkdCookie : $.getdata('zqkdCookie')) || ''; +let userCookieArr = [] + +let nickname = [] +/////////////////////////////////////////////////////////////////// + +!(async () => { + + if(typeof $request !== "undefined") + { + $.msg(jsname+': 此脚本不做重写,请检查重写设置') + } + else + { + if(!(await checkEnv())) { + return + } + + await initAccountInfo() + await RunRiskInfo() + await RunUserBalance() + + await showmsg() + } + + +})() +.catch((e) => $.logErr(e)) +.finally(() => $.done()) + +//通知 +async function showmsg() { + + notifyBody = jsname + "运行通知\n\n" + notifyStr + + if (notifyFlag != 1) { + console.log(notifyBody); + } + + if (notifyFlag == 1) { + $.msg(notifyBody); + if($.isNode()){await notify.sendNotify($.name, notifyBody );} + } +} + +async function checkEnv() { + if(userCookie) { + if(userCookie.indexOf('@') > -1) { + let userCookies = userCookie.split('@') + for(let i=0; i -1) { + for(let j=0; j { + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log(caller + ": post请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + httpResult = JSON.parse(data); + if(logDebug) console.log(httpResult); + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +async function httpGet(url,caller) { + httpResult = null + return new Promise((resolve) => { + $.get(url, async (err, resp, data) => { + try { + if (err) { + console.log(caller + ": get请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data,caller)) { + httpResult = JSON.parse(data); + if(logDebug) console.log(httpResult); + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +function safeGet(data,caller) { + try { + if (typeof JSON.parse(data) == "object") { + return true; + } else { + console.log(`Function ${caller}: 未知错误`); + console.log(data) + } + } catch (e) { + console.log(e); + console.log(`Function ${caller}: 服务器访问数据为空,请检查自身设备网络情况`); + return false; + } +} + +function printCaller(){ + return (new Error()).stack.split("\n")[2].trim().split(" ")[1] +} + +function Env(t, e) { class s { constructor(t) { this.env = t } send(t, e = "GET") { t = "string" == typeof t ? { url: t } : t; let s = this.get; return "POST" === e && (s = this.post), new Promise((e, i) => { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), a = { url: `http://${h}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(a, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null } setval(t, e) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null } initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) } get(t, e = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.get(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { try { if (t.headers["set-cookie"]) { const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar } } catch (t) { this.logErr(t) } }).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) })) } post(t, e = (() => { })) { if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.post(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) }); else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: s, ...i } = t; this.got.post(s, i).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) }) } } time(t) { let e = { "M+": (new Date).getMonth() + 1, "d+": (new Date).getDate(), "H+": (new Date).getHours(), "m+": (new Date).getMinutes(), "s+": (new Date).getSeconds(), "q+": Math.floor(((new Date).getMonth() + 3) / 3), S: (new Date).getMilliseconds() }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, ((new Date).getFullYear() + "").substr(4 - RegExp.$1.length))); for (let s in e) new RegExp("(" + s + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? e[s] : ("00" + e[s]).substr(("" + e[s]).length))); return t } msg(e = t, s = "", i = "", r) { const o = t => { if (!t) return t; if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : this.isSurge() ? { url: t } : void 0; if ("object" == typeof t) { if (this.isLoon()) { let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-url"]; return { openUrl: e, mediaUrl: s } } if (this.isQuanX()) { let e = t["open-url"] || t.url || t.openUrl, s = t["media-url"] || t.mediaUrl; return { "open-url": e, "media-url": s } } if (this.isSurge()) { let e = t.url || t.openUrl || t["open-url"]; return { url: e } } } }; this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))); let h = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="]; h.push(e), s && h.push(s), i && h.push(i), console.log(h.join("\n")), this.logs = this.logs.concat(h) } log(...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) } logErr(t, e) { const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); s ? this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack) : this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t) } wait(t) { return new Promise(e => setTimeout(e, t)) } done(t = {}) { const e = (new Date).getTime(), s = (e - this.startTime) / 1e3; this.log("", `\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } }(t, e) } diff --git a/zqkd/zqkd_shareRead.js b/zqkd/zqkd_shareRead.js new file mode 100644 index 0000000..9b0690f --- /dev/null +++ b/zqkd/zqkd_shareRead.js @@ -0,0 +1,328 @@ +/* +安卓:中青看点 + +转发和分享阅读,请勿贪心,小心黑号 +*/ + +const jsname = '中青看点分享阅读' +const $ = Env(jsname) +const notifyFlag = 1; //0为关闭通知,1为打开通知,默认为1 +const logDebug = 0 + +//const notify = $.isNode() ? require('./sendNotify') : ''; +let notifyStr = '' + +let rndtime = "" //毫秒 +let httpResult //global buffer + +let zqkdCookie = ($.isNode() ? process.env.zq_cookie : $.getdata('zq_cookie')) || ''; +let zqkdCookieArr = [] + +let userCk = '' +let readCount = 0 + +let zqkdShareNum = ($.isNode() ? process.env.zqkdShareNum : $.getdata('zqkdShareNum')) || 0; + +let newsItem = '' +let UserAgent = '' +let si = '' + +/////////////////////////////////////////////////////////////////// + +!(async () => { + + if(typeof $request !== "undefined") + { + $.msg(jsname+': 此脚本不做重写,请检查重写设置') + } + else + { + if(!(await checkEnv())){ + return + } + + for(let j=0; j maxWaitTime ? maxWaitTime : seedFactor + let randomTime = Math.floor(Math.random()*factor) + 1000 + let second = Math.floor(randomTime/1000) + UserAgent = `Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.16(0x1800102c) NetType/WIFI Language/zh_CN` + si = randomString(32) + console.log(`--随机延迟${second}秒后开始模拟第${readCount}次分享阅读`) + await $.wait(randomTime) + console.log(`----模拟第${readCount}次阅读,使用si=${si}`) + await shareReadStep1() + await $.wait(Math.floor(Math.random()*500)+500) + await shareReadStep2() + await $.wait(Math.floor(Math.random()*1000)+2000) + await shareReadStep3() + await $.wait(Math.floor(Math.random()*1000)+2000) + await shareReadStep4() + console.log(`----模拟第${readCount}次阅读完成`) + } + + } + } + } + + +})() +.catch((e) => $.logErr(e)) +.finally(() => $.done()) + +//通知 +async function showmsg() { + + notifyBody = jsname + "运行通知\n\n" + notifyStr + + if (notifyFlag != 1) { + console.log(notifyBody); + } + + if (notifyFlag == 1) { + $.msg(notifyBody); + //if ($.isNode()){await notify.sendNotify($.name, notifyBody );} + } +} + +async function checkEnv() { + + if(zqkdShareNum == 0) { + console.log('当前分享次数设置为0。如果需要开启分享阅读,请设置环境变量zqkdShareNum为要被阅读的次数。') + return false + } + + if(zqkdCookie) { + if(zqkdCookie.indexOf('@') > -1) { + let zqkdCookies = zqkdCookie.split('@') + for(let i=0; i { + $.post(url, async (err, resp, data) => { + try { + if (err) { + console.log(caller + ": post请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + if (safeGet(data)) { + httpResult = JSON.parse(data,caller); + if(logDebug) console.log(httpResult); + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +async function httpGet(url,caller) { + httpResult = null + return new Promise((resolve) => { + $.get(url, async (err, resp, data) => { + try { + if (err) { + console.log(caller + ": get请求失败"); + console.log(JSON.stringify(err)); + $.logErr(err); + } else { + // + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +function safeGet(data,caller) { + try { + if (typeof JSON.parse(data) == "object") { + return true; + } else { + console.log(`Function ${caller}: 未知错误`); + console.log(data) + } + } catch (e) { + console.log(e); + console.log(`Function ${caller}: 服务器访问数据为空,请检查自身设备网络情况`); + return false; + } +} + +function printCaller(){ + return (new Error()).stack.split("\n")[2].trim().split(" ")[1] +} + +function Env(t, e) { class s { constructor(t) { this.env = t } send(t, e = "GET") { t = "string" == typeof t ? { url: t } : t; let s = this.get; return "POST" === e && (s = this.post), new Promise((e, i) => { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), a = { url: `http://${h}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(a, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null } setval(t, e) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null } initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) } get(t, e = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.get(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { try { if (t.headers["set-cookie"]) { const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar } } catch (t) { this.logErr(t) } }).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) })) } post(t, e = (() => { })) { if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.post(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) }); else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: s, ...i } = t; this.got.post(s, i).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) }) } } time(t) { let e = { "M+": (new Date).getMonth() + 1, "d+": (new Date).getDate(), "H+": (new Date).getHours(), "m+": (new Date).getMinutes(), "s+": (new Date).getSeconds(), "q+": Math.floor(((new Date).getMonth() + 3) / 3), S: (new Date).getMilliseconds() }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, ((new Date).getFullYear() + "").substr(4 - RegExp.$1.length))); for (let s in e) new RegExp("(" + s + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? e[s] : ("00" + e[s]).substr(("" + e[s]).length))); return t } msg(e = t, s = "", i = "", r) { const o = t => { if (!t) return t; if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : this.isSurge() ? { url: t } : void 0; if ("object" == typeof t) { if (this.isLoon()) { let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-url"]; return { openUrl: e, mediaUrl: s } } if (this.isQuanX()) { let e = t["open-url"] || t.url || t.openUrl, s = t["media-url"] || t.mediaUrl; return { "open-url": e, "media-url": s } } if (this.isSurge()) { let e = t.url || t.openUrl || t["open-url"]; return { url: e } } } }; this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))); let h = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="]; h.push(e), s && h.push(s), i && h.push(i), console.log(h.join("\n")), this.logs = this.logs.concat(h) } log(...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) } logErr(t, e) { const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); s ? this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack) : this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t) } wait(t) { return new Promise(e => setTimeout(e, t)) } done(t = {}) { const e = (new Date).getTime(), s = (e - this.startTime) / 1e3; this.log("", `\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } }(t, e) }