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..7862ff4 --- /dev/null +++ b/blackUnique.js @@ -0,0 +1,1669 @@ +/* +APP:全球购骑士特权 + +直接appstore搜索下载,方便的话可以微信扫下面图片二维码走邀请注册,谢谢 +https://raw.githubusercontent.com/leafxcy/JavaScript/main/blackUnique.jpg + +定时为每小时一次,务必在0分到5分之间运行,目前只写了每日领勋章和领取存钱罐的任务,大概每天3毛 +提现需要关注微信公众号,在公众号里申请提现 +请手动点一下签到页面的【收零花钱】领一次金币,去【果园】里选择水果种子 +只测试了IOS的青龙和V2P,暂不支持多账号 + +青龙: +捉https://market.chuxingyouhui.com/promo-bargain-api/activity/mqq/api/indexTopInfo?的包,获得appId +捉https://pyp-api.chuxingyouhui.com/api/app/userCenter/v1/info的包,获得其他header +然后填在blackJSON里面,注意按照JSON格式填写。用青龙面板的环境变量或者外面用双引号的,字符串内需要用\"转义 +export blackJSON='{"black-token":"", "token":"", "User-Agent":"", "device-value":"", "device-type":"", "phpUserId":"", "appId":""}' + +V2P,圈X:重写方法 -- 点击右下角【我的】-> 【每日签到赚现金】 +[task_local] +#全球购骑士特权 +0 * * * * https://raw.githubusercontent.com/leafxcy/JavaScript/main/blackUnique.js, tag=全球购骑士特权, enabled=true +[rewrite_local] +https://pyp-api.chuxingyouhui.com/api/app/userCenter/v1/info url script-request-header https://raw.githubusercontent.com/leafxcy/JavaScript/main/blackUnique.js +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 = *.chuxingyouhui.com + +*/ + +const jsname = '全球购骑士特权' +const $ = Env(jsname) +const notifyFlag = 1; //0为关闭通知,1为打开通知,默认为1 +const logDebug = 0 + +//const notify = $.isNode() ? require('./sendNotify') : ''; +let notifyStr = '' + +let blankJSON = {"black-token":"", "token":"", "User-Agent":"", "device-value":"", "device-type":"", "phpUserId":"", "appId":""} +let blackJSONStr = ($.isNode() ? (process.env.blackJSON) : ($.getval('blackJSON'))) || '' +let blackJSON = blackJSONStr ? JSON.parse(blackJSONStr) : blankJSON + +let reqTime = '' +let userSign = '' +let redPacketId = '' +let fruitId = '' +let userFruitId = '' +let activityId = '' +let redPacketCount = 0 +let waterCount = 0 +let fertilizerCount = 0 +let clickTreeTimes = 5 +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提现需要关注微信公众号,在公众号里申请提现') + + await querySignStatus() + + await listUserTask() + + //await listRedPacket() + + await queryPiggyInfo() + + //翻卡看视频需要前置条件 + //await getUserFlopRecord() + + await userFruitDetail() + + await waterTaskList() + + await nutrientTaskList() + + await userFertilizerDetail() + + await getTreeCoupon() + + await userInfo() + + 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 getRewrite() +{ + if($request.url.indexOf("userCenter/v1/info") > -1) { + if($request.headers['black-token']) { + blackJSON['black-token'] = $request.headers['black-token'] + $.log(`获取到black-token: ${blackJSON['black-token']}`) + $.msg(`获取到black-token: ${blackJSON['black-token']}`) + } + if($request.headers['token']) { + blackJSON['token'] = $request.headers['token'] + $.log(`获取到token: ${blackJSON['token']}`) + $.msg(`获取到token: ${blackJSON['token']}`) + } + if($request.headers['User-Agent']) { + blackJSON['User-Agent'] = $request.headers['User-Agent'] + $.log(`获取到User-Agent: ${blackJSON['User-Agent']}`) + $.msg(`获取到User-Agent: ${blackJSON['User-Agent']}`) + } + if($request.headers['device-value']) { + blackJSON['device-value'] = $request.headers['device-value'] + $.log(`获取到device-value: ${blackJSON['device-value']}`) + $.msg(`获取到device-value: ${blackJSON['device-value']}`) + } + if($request.headers['device-type']) { + blackJSON['device-type'] = $request.headers['device-type'] + $.log(`获取到device-type: ${blackJSON['device-type']}`) + $.msg(`获取到device-type: ${blackJSON['device-type']}`) + } + if($request.headers['phpUserId']) { + blackJSON['phpUserId'] = $request.headers['phpUserId'] + $.log(`获取到phpUserId: ${blackJSON['phpUserId']}`) + $.msg(`获取到phpUserId: ${blackJSON['phpUserId']}`) + } + $.setdata(JSON.stringify(blackJSON),'blackJSON') + } + + if($request.url.indexOf("mqq/api/indexTopInfo?appId=") > -1) { + blackJSON['appId'] = $request.url.match(/appId=([\w]+)/)[1] + $.log(`获取到appId: ${blackJSON['appId']}`) + $.msg(`获取到appId: ${blackJSON['appId']}`) + $.setdata(JSON.stringify(blackJSON),'blackJSON') + } +} + +async function checkEnv() +{ + if(!blackJSON['black-token'] || !blackJSON['token'] || !blackJSON['User-Agent'] || !blackJSON['device-value'] || !blackJSON['device-type'] || !blackJSON['phpUserId'] || !blackJSON['appId']) + { + $.log(`捉包信息不全,请检查空白字段并重新捉包: ${JSON.stringify(blackJSON)}\n`) + $.msg(`捉包信息不全,请检查空白字段并重新捉包: ${JSON.stringify(blackJSON)}\n`) + return false + } + + 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' : blackJSON['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackJSON['User-Agent'], + 'black-token' : blackJSON['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='+blackJSON['appId'], + headers: { + 'Host' : 'market.chuxingyouhui.com', + 'Origin' : 'https://m.black-unique.com', + 'Accept-Encoding' : 'gzip, deflate, br', + 'Connection' : 'keep-alive', + 'black-token' : blackJSON['black-token'], + 'Accept' : 'application/json, text/plain, */*', + 'User-Agent' : blackJSON['User-Agent'], + 'Referer' : 'https://m.black-unique.com/', + 'token' : blackJSON['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='+blackJSON['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' : blackJSON['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackJSON['User-Agent'], + 'black-token' : blackJSON['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' : blackJSON['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackJSON['User-Agent'], + 'black-token' : blackJSON['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' : blackJSON['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackJSON['User-Agent'], + 'black-token' : blackJSON['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='+blackJSON['appId'], + headers: { + 'Host' : 'market.chuxingyouhui.com', + 'Origin' : 'https://m.black-unique.com', + 'Accept-Encoding' : 'gzip, deflate, br', + 'Connection' : 'keep-alive', + 'black-token' : blackJSON['black-token'], + 'Accept' : 'application/json, text/plain, */*', + 'User-Agent' : blackJSON['User-Agent'], + 'Referer' : 'https://m.black-unique.com/', + 'token' : blackJSON['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 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":"${blackJSON['appId']}"}` + 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' : blackJSON['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackJSON['User-Agent'], + 'black-token' : blackJSON['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":"${blackJSON['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' : blackJSON['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackJSON['User-Agent'], + 'black-token' : blackJSON['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' : blackJSON['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackJSON['User-Agent'], + 'black-token' : blackJSON['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', + 'phpUserId' : blackJSON['phpUserId'], + 'device-value' : blackJSON['device-value'], + 'device-type' : blackJSON['device-type'], + 'Accept-Language' : 'zh-CN,zh-Hans;q=0.9', + 'newcomer' : 'true', + 'Accept-Encoding' : 'gzip, deflate, br', + 'token' : blackJSON['token'], + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackJSON['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, */*', + 'phpUserId' : blackJSON['phpUserId'], + 'device-value' : blackJSON['device-value'], + 'ymd' : '0', + 'device-type' : blackJSON['device-type'], + 'newcomer' : 'true', + 'token' : blackJSON['token'], + 'Accept-Language' : 'zh-CN,zh-Hans;q=0.9', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackJSON['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, */*', + 'phpUserId' : blackJSON['phpUserId'], + 'device-value' : blackJSON['device-value'], + 'device-type' : blackJSON['device-type'], + 'Accept-Language' : 'zh-CN,zh-Hans;q=0.9', + 'token' : blackJSON['token'], + 'Accept-Encoding' : 'gzip, deflate, br', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackJSON['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":"${blackJSON['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' : blackJSON['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackJSON['User-Agent'], + 'black-token' : blackJSON['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":"${blackJSON['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' : blackJSON['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackJSON['User-Agent'], + 'black-token' : blackJSON['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' : blackJSON['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackJSON['User-Agent'], + 'black-token' : blackJSON['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' : blackJSON['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackJSON['User-Agent'], + 'black-token' : blackJSON['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' : blackJSON['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackJSON['User-Agent'], + 'black-token' : blackJSON['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' : blackJSON['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackJSON['User-Agent'], + 'black-token' : blackJSON['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' : blackJSON['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackJSON['User-Agent'], + 'black-token' : blackJSON['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' : blackJSON['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackJSON['User-Agent'], + 'black-token' : blackJSON['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' : blackJSON['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackJSON['User-Agent'], + 'black-token' : blackJSON['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' : blackJSON['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackJSON['User-Agent'], + 'black-token' : blackJSON['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' : blackJSON['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackJSON['User-Agent'], + 'black-token' : blackJSON['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":"${blackJSON['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' : blackJSON['token'], + 'Content-Type' : 'application/json;charset=utf-8', + 'Origin' : 'https://m.black-unique.com', + 'User-Agent' : blackJSON['User-Agent'], + 'black-token' : blackJSON['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}`) + } + await $.wait(1000) + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(); + } + }); + }); +} + +//查询账户信息 +async function userInfo() { + console.log(`\n========= 账户信息 =========`) + notifyStr += `========= 账户信息 =========\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' : '*/*', + 'phpUserId' : blackJSON['phpUserId'], + 'device-value' : blackJSON['device-value'], + 'device-type' : blackJSON['device-type'], + 'Accept-Language' : 'zh-Hans-CN;q=1', + 'token' : blackJSON['token'], + 'User-Agent' : blackJSON['User-Agent'], + 'black-token' : blackJSON['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.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='+blackJSON['appId'], + headers: { + 'Host' : 'market.chuxingyouhui.com', + 'Origin' : 'https://m.black-unique.com', + 'Accept-Encoding' : 'gzip, deflate, br', + 'Connection' : 'keep-alive', + 'black-token' : blackJSON['black-token'], + 'Accept' : 'application/json, text/plain, */*', + 'User-Agent' : blackJSON['User-Agent'], + 'Referer' : 'https://m.black-unique.com/', + 'token' : blackJSON['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}`) + notifyStr += `【勋章余额】:${result.data.score}\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/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..b22a9c0 --- /dev/null +++ b/jctq/jctq_daily.js @@ -0,0 +1,581 @@ +/* +安卓:晶彩天气(v8.3.7) + +此脚本负责: +领转发页定时宝箱,领福利页定时宝箱,领首页气泡红包,时段转发,刷福利视频,抽奖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 jctqCookie = ($.isNode() ? process.env.jctqCookie : $.getdata('jctqCookie')) || ''; +let jctqBubbleBody = ($.isNode() ? process.env.jctqBubbleBody : $.getdata('jctqBubbleBody')) || ''; +let jctqGiveBoxBody = ($.isNode() ? process.env.jctqGiveBoxBody : $.getdata('jctqGiveBoxBody')) || ''; + +let jctqBubbleBodyArr = [] +let jctqGiveBoxBodyArr = [] + +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() + + await queryShareStatus() + await $.wait(1000) + + await queryGiveBoxStatus() + await $.wait(1000) + + await queryBubbleStatus() + await $.wait(1000) + + await getTaskListByWeather() + await $.wait(1000) + + await queryRotaryTable() + await $.wait(1000) + } + + +})() +.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(jctqCookie) { + if(jctqCookie.indexOf('@') > -1) { + jctqCookies = jctqCookie.split('@') + jctqCookie = jctqCookies[0] + console.log('检测到多于一个jctqCookie,开始跑第一个账户。请注意本脚本只支持单账户,如需多账户请自行修改。') + } + if(jctqCookie.indexOf('cookie=') == -1 && jctqCookie.indexOf('zqkey=') > -1) { + jctqCookie = jctqCookie.replace(/zqkey=/, "cookie=") + } + if(jctqCookie.indexOf('cookie_id=') == -1 && jctqCookie.indexOf('zqkey_id=') > -1) { + jctqCookie = jctqCookie.replace(/zqkey_id=/, "cookie_id=") + } + if(jctqCookie.indexOf('app_version=') == -1) { + jctqCookie = 'app_version=8.3.7&' + jctqCookie + } + } + + if(jctqBubbleBody) { + if(jctqBubbleBody.indexOf('&') > -1) { + let jctqBubbleBodyArrs = jctqBubbleBody.split('&') + for(let i=0; i -1) { + let jctqGiveBoxBodyArrs = jctqGiveBoxBody.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,jctqCookie) + 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,jctqCookie) + 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 = jctqCookie + '&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 = jctqCookie + '&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?' + jctqCookie + 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 = jctqCookie + '&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,jctqCookie) + 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?' + jctqCookie + 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 { + $.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..1201419 --- /dev/null +++ b/jctq/jctq_kkz.js @@ -0,0 +1,359 @@ +/* +安卓:晶彩天气(v8.3.7) + +此脚本负责: +完成看看赚任务,删除重复和失效的body +*/ + +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 jctqLookStartbodyArr = [] + +let bannerIdList = [] +let duplicatedCount = 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(!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) { + jctqCookies = jctqCookie.split('@') + jctqCookie = jctqCookies[0] + console.log('检测到多于一个jctqCookie,开始跑第一个账户。请注意本脚本只支持单账户,如需多账户请自行修改。') + } + if(jctqCookie.indexOf('cookie=') == -1 && jctqCookie.indexOf('zqkey=') > -1) { + jctqCookie = jctqCookie.replace(/zqkey=/, "cookie=") + } + if(jctqCookie.indexOf('cookie_id=') == -1 && jctqCookie.indexOf('zqkey_id=') > -1) { + jctqCookie = jctqCookie.replace(/zqkey_id=/, "cookie_id=") + } + if(jctqCookie.indexOf('app_version=') == -1) { + jctqCookie = 'app_version=8.3.7&' + jctqCookie + } + } + + return true +} + +/////////////////////////////////////////////////////////////////// + +//看看赚任务 +async function adlickstart(lookStartBody,idx) { + let caller = printCaller() + let url = 'https://tq.xunsl.com/v5/nameless/adlickstart.json' + let urlObject = populatePostUrl(url,lookStartBody) + await httpPost(urlObject,caller) + let result = httpResult; + if(!result) return + + if(result.success == true) { + let bannerId = result.items.banner_id + if(await checkDuplicated(lookStartBody,bannerId)) { + if(result.items.comtele_state == 1) { + console.log(`第${idx+1}个看看赚[id:${bannerId}]已完成`) + } else { + let readNum = result.items.see_num - result.items.read_num + if(readNum == 0) readNum++ + console.log(`开始做第${idx+1}个看看赚[id:${bannerId}]任务,还需要阅读${readNum}次,开始阅读...`) + for(let i=0; i 0) notifyStr += `删除了${duplicatedCount}个重复的body\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_read.js b/jctq/jctq_read.js new file mode 100644 index 0000000..aa27f08 --- /dev/null +++ b/jctq/jctq_read.js @@ -0,0 +1,258 @@ +/* +安卓:晶彩天气(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 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..94812ed --- /dev/null +++ b/jctq/jctq_reward.js @@ -0,0 +1,306 @@ +/* +安卓:晶彩天气(v8.3.7) + +此脚本负责: +签到和翻倍,任务奖励领取,统计今日收益,自动提现 + +请将定时放在看看赚和阅读任务后面 +如果不想自动提现的,请不要捉提现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 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 jctqWithdraw = ($.isNode() ? process.env.jctqWithdraw : $.getdata('jctqWithdraw')) || ''; +let jctqCookie = ($.isNode() ? process.env.jctqCookie : $.getdata('jctqCookie')) || ''; + +let jctqRewardBodyArr = [] + +let withdrawSuccess = 0 + +/////////////////////////////////////////////////////////////////// + +!(async () => { + + if(typeof $request !== "undefined") + { + $.msg(jsname+': 此脚本不做重写,请检查重写设置') + } + else + { + await checkEnv() + + let numBoxbody = jctqRewardBodyArr.length + console.log(`找到${numBoxbody}个签到/奖励body`) + + for(let i=0; i 0 && jctqWithdraw) { + await withdraw() + await $.wait(1000) + } else if(jctqWithdraw == 0) { + console.log(`你设置了不自动提现`) + } else if(!jctqWithdraw) { + console.log(`没有找到提现body`) + } + + if(jctqCookie) { + await getBalance() + await showmsg() + } else { + console.log(`没有找到用户CK,无法统计今日收益`) + } + + } + + +})() +.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(jctqCookie) { + if(jctqCookie.indexOf('@') > -1) { + jctqCookies = jctqCookie.split('@') + jctqCookie = jctqCookies[0] + console.log('检测到多于一个jctqCookie,开始跑第一个账户。请注意本脚本只支持单账户,如需多账户请自行修改。') + } + if(jctqCookie.indexOf('cookie=') == -1 && jctqCookie.indexOf('zqkey=') > -1) { + jctqCookie = jctqCookie.replace(/zqkey=/, "cookie=") + } + if(jctqCookie.indexOf('cookie_id=') == -1 && jctqCookie.indexOf('zqkey_id=') > -1) { + jctqCookie = jctqCookie.replace(/zqkey_id=/, "cookie_id=") + } + if(jctqCookie.indexOf('app_version=') == -1) { + jctqCookie = 'app_version=8.3.7&' + jctqCookie + } + } + + if(jctqWithdraw && jctqWithdraw.indexOf('@') > -1) { + jctqWithdraws = jctqWithdraw.split('@') + jctqWithdraw = jctqWithdraws[0] + console.log('检测到多于一个提现body,使用第一个body') + } + + if(jctqQdBody) { + if(jctqQdBody.indexOf('&') > -1) { + let jctqQdBodyArr = jctqQdBody.split('&') + for(let i=0; i -1) { + let jctqBoxbodyArr = jctqBoxbody.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 getBalance() { + let caller = printCaller() + let url = 'https://tq.xunsl.com/wap/user/balance?keyword_wyq=woyaoq.com&' + jctqCookie + 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..d7e076d --- /dev/null +++ b/jctq/jctq_rewrite.js @@ -0,0 +1,189 @@ +/* +安卓:晶彩天气(v8.3.7) + +此脚本负责:捉包重写 + + +注意单脚本不支持多账户,建议多容器跑。如果需要多账户在同一个脚本跑,请自行修改 +脚本会自动提现,如果不想自动提现的,请不要捉提现body,或者新建环境变量jctqWithdrawFlag,写成0 + +重写: +https://tq.xunsl.com/v17/NewTask/getTaskListByWeather.json -- 点开福利页即可获取jctqCookie,注意只支持单账户,新ck会覆盖旧ck +https://tq.xunsl.com/v5/CommonReward/toGetReward.json -- 签到,观看签到翻倍视频,和福利页任务奖励(目前应该只有激励视频和20篇文章的奖励),获取完建议关掉重写 +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,新获取的提现body会覆盖旧的 + +任务: +jctq_daily.js -- 领转发页定时宝箱,领福利页定时宝箱,领首页气泡红包,时段转发,刷福利视频,抽奖5次 +jctq_reward.js -- 签到和翻倍,任务奖励领取,统计今日收益,自动提现 +jctq_kkz.js -- 完成看看赚任务,删除重复和失效的body +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')) || ''; + +/////////////////////////////////////////////////////////////////// + +!(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 + if(jctqCookie.indexOf(uidStr) > -1) { + $.msg(jsname+` 已获取过此用户的jctqCookie`) + } else { + jctqCookie = `app_version=${app_version}&cookie=${zqkey}&cookie_id=${zqkey_id}&uid=${uid}` + $.setdata(jctqCookie, '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+` 获取第1个签到/奖励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+` 获取第1个文章/视频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+` 获取第1个时长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+` 获取第1个看看赚body成功`) + } + } + + if($request.url.indexOf('v5/wechat/withdraw2.json') > -1) { + rBody = $request.body + $.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+` 获取第1个福利页宝箱/翻倍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+` 获取第1个首页气泡/翻倍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..d09930d 100644 --- a/jctq/jctq_rewrite_subscribe.json +++ b/jctq/jctq_rewrite_subscribe.json @@ -3,49 +3,63 @@ "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 } ], @@ -55,92 +69,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_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_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/shangtuo.js b/shangtuo.js index 41664f4..e19ed6a 100644 --- a/shangtuo.js +++ b/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);