You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1376 lines
41 KiB
1376 lines
41 KiB
/*
|
|
低保版,开宝箱需kuaishou.api_st和did两个参数,抓安卓完整ck丢进去即可
|
|
export ksjshd='ck1
|
|
ck2
|
|
ck3'
|
|
ck回车符分割
|
|
ksWithdrawTime 提现时间
|
|
ksjsbAggressive 最大化提现
|
|
*/
|
|
|
|
const $ = new Env('快手极速版低保');
|
|
|
|
const notify = $.isNode() ? require('./sendNotify') : '';
|
|
|
|
let notifyStr=''
|
|
let notifyFlag=1
|
|
let otherts=false
|
|
|
|
let res,
|
|
ksjsbCookie = process.env.ksjsbCookie || '',
|
|
Users = [],
|
|
ksjsbCash = process.env.ksjsbCash || '',
|
|
ksWithdrawTime = process.env.ksjsbWithdrawTime || 15,
|
|
ksjsbAggressive = process.env.ksjsbAggressive || 0,
|
|
ksjsbNotify = process.env.ksjsbNotify || 1,
|
|
index = 0,
|
|
count = 0;
|
|
|
|
|
|
|
|
|
|
//let curHours = new Date().getHours();
|
|
class ksUser {
|
|
constructor(cookie) {
|
|
let api_st = cookie.match(/(kuaishou.api_st=[\w\-]+)/)[1] + ';';
|
|
let did = cookie.match(/(did=[\w\-]+)/)[1] + ';';
|
|
|
|
this.index = ++index;
|
|
this.cookie =
|
|
'kpn=NEBULA; kpf=ANDROID_PHONE; '+did+' ver=9.10; appver=9.10.40.2474; language=zh-cn; countryCode=CN; sys=ANDROID_5.1; client_key=2ac2a76d; ' +
|
|
api_st;
|
|
this.name = this.index;
|
|
this.valid = false;
|
|
this.bindAlipay = false;
|
|
this.alipay = '';
|
|
this.bindWechat = false;
|
|
this.wechat = '';
|
|
this.needSms = false;
|
|
this.hasLuckydraw = true;
|
|
}
|
|
//获取用户信息
|
|
async getUserInfo() {
|
|
let url =
|
|
'https://nebula.kuaishou.com/rest/n/nebula/activity/earn/overview/basicInfo';
|
|
let body = '';
|
|
let options = getOptions(url, this.cookie, body);
|
|
await doRequest('get', options);
|
|
if (!res) {
|
|
return;
|
|
}
|
|
if (res.result == 1) {
|
|
this.valid = true;
|
|
this.name = res.data.userData.nickname;
|
|
this.cashBalance = res.data.totalCash;
|
|
this.coinBalance = res.data.totalCoin;
|
|
this.allCash = res.data.allCash;
|
|
/* console.log(
|
|
`🎉${this.name}=>|账户余额${this.cashBalance}元,${
|
|
this.coinBalance
|
|
}金币,未审核余额${Math.floor(
|
|
parseFloat(this.allCash) - parseFloat(this.cashBalance)
|
|
)}元`
|
|
); */
|
|
} else {
|
|
console.log(`🎉${this.name}=>|查询账户信息失败:${res.error_msg}`);
|
|
}
|
|
}
|
|
//分享获得3000金币
|
|
async setShare() {
|
|
let url =
|
|
'https://nebula.kuaishou.com/rest/n/nebula/account/withdraw/setShare';
|
|
let body = '';
|
|
let options = getOptions(url, this.cookie, body);
|
|
await doRequest('post', options);
|
|
if (!res) {
|
|
return;
|
|
}
|
|
if (res.result == 1) {
|
|
console.log(`🎉${this.name}=>|准备分享得金币`);
|
|
await $.wait(200);
|
|
await this.taskReward(122);
|
|
} else {
|
|
console.log(`🎉${this.name}=>|分享失败:${res.error_msg}`);
|
|
}
|
|
}
|
|
//做任务
|
|
async taskReward(taskId) {
|
|
let url = `https://nebula.kuaishou.com/rest/n/nebula/daily/report?taskId=${taskId}`;
|
|
let body = '';
|
|
let options = getOptions(url, this.cookie, body);
|
|
await doRequest('get', options);
|
|
if (!res) {
|
|
return;
|
|
}
|
|
if (res.result == 1) {
|
|
console.log(
|
|
`🎉${this.name}=>|完成任务[${taskId}]成功,获得${res.data.amount}金币`
|
|
);
|
|
} else {
|
|
console.log(
|
|
`🎉${this.name}=>|完成任务[${taskId}]失败:${res.error_msg}`
|
|
);
|
|
}
|
|
}
|
|
//签到详情
|
|
async getSignInfo() {
|
|
let url = 'https://nebula.kuaishou.com/rest/n/nebula/sign/queryPopup';
|
|
let body = '';
|
|
let options = getOptions(url, this.cookie, body);
|
|
await doRequest('get', options);
|
|
if (!res) {
|
|
return;
|
|
}
|
|
if (res.result == 1) {
|
|
let todaySigned = res.data.nebulaSignInPopup.todaySigned;
|
|
console.log(`🎉${this.name}=>|今天${todaySigned ? '已' : '未'}签到`);
|
|
if (!todaySigned) {
|
|
await $.wait(200);
|
|
await this.doSign();
|
|
await $.wait(200);
|
|
await this.TaskSignIn();
|
|
await $.wait(200);
|
|
await this.setShare();
|
|
}
|
|
} else {
|
|
console.log(`🎉${this.name}=>|查询签到信息失败:${res.error_msg}`);
|
|
}
|
|
}
|
|
//签到领现金
|
|
async TaskSignIn() {
|
|
let body = '';
|
|
let url = `https://nebula.kuaishou.com/rest/n/nebula/cashSign/goldenAreaTaskSignIn`
|
|
let options = getOptions(url, this.cookie, body);
|
|
await doRequest('get', options);
|
|
if (!res) {
|
|
return;
|
|
}
|
|
if (res.result == 1) {
|
|
console.log(`🎉${this.name}=>|新手任务:${res.data.currentDay}/${res.data.activityDays}`);
|
|
|
|
let rewardlist=res.data.rewardList
|
|
for (let list of rewardlist){
|
|
if (list.bottomText=='今天')console.log(`🎉${this.name}=>|今日已领取:${parseFloat(list.amount/100)}元`)
|
|
}
|
|
console.log(`🎉${this.name}=>|${res.data.instructionText}`)
|
|
} else {
|
|
console.log(`🎉${this.name}=>|新手任务:${res.error_msg}`)
|
|
}
|
|
}
|
|
|
|
//签到
|
|
async doSign() {
|
|
let url =
|
|
'https://nebula.kuaishou.com/rest/n/nebula/sign/sign?source=activity';
|
|
let body = '';
|
|
let options = getOptions(url, this.cookie, body);
|
|
await doRequest('get', options);
|
|
if (!res) {
|
|
return;
|
|
}
|
|
if (res.result == 1) {
|
|
console.log(`🎉${this.name}=>|签到成功:${res.data.toast}`);
|
|
await $.wait(200);
|
|
} else {
|
|
console.log(`🎉${this.name}=>|签到失败:${res.error_msg}`);
|
|
}
|
|
}
|
|
|
|
async withdraw(_0x543a47) {
|
|
if (!this.bindAlipay && !this.bindWechat) {
|
|
console.log('账号[' + this.name + ']未绑定提现账号,不执行提现');
|
|
|
|
return;
|
|
}
|
|
|
|
let _0x11aa57 = parseInt(_0x543a47 * 100),
|
|
_0x551907 = this.bindAlipay ? 'ALIPAY' : 'WECHAT',
|
|
_0x4281dd = _0x551907 == 'ALIPAY' ? '支付宝' : '微信',
|
|
_0x45b85a = _0x551907 == 'ALIPAY' ? this.alipay : this.wechat,
|
|
_0x5540cb = 'https://nebula.kuaishou.com/rest/n/nebula/outside/withdraw/apply',
|
|
_0x36e14a = `{"channel":"${_0x551907}","amount":${_0x543a47}}`,
|
|
_0x2afd84 = getOptions(_0x5540cb, this.cookie, _0x36e14a);
|
|
_0x2afd84.headers['Content-Type']='application/json;charset=UTF-8'
|
|
//console.log(_0x2afd84)
|
|
await doRequest('post', _0x2afd84);
|
|
|
|
let result = res;
|
|
console.log(result)
|
|
|
|
if (!result) {
|
|
return;
|
|
}
|
|
otherts=true
|
|
if (result.result == 1) {
|
|
console.log('🎉' + this.name + '=>|提现' + _0x543a47 +'元到' + _0x4281dd +'[' + _0x45b85a +']成功')
|
|
notifyStr +='🎉' + this.name + '=>|提现' + _0x543a47 +'元到' + _0x4281dd +'[' + _0x45b85a +']成功\n'
|
|
}
|
|
else {
|
|
notifyStr +='🎉' + this.name + '=>|提现' + _0x543a47 +'元到' + _0x4281dd +'[' + _0x45b85a +']失败:' + result.msg+'\n'
|
|
console.log('🎉' + this.name + '=>|提现' + _0x543a47 +'元到' + _0x4281dd +'[' + _0x45b85a +']失败:' + result.msg );
|
|
}
|
|
}
|
|
|
|
async withdrawOverview() {
|
|
let _0x2236be =
|
|
'https://nebula.kuaishou.com/rest/n/nebula/outside/withdraw/overview?appver=9.9.10.1646',
|
|
_0x564ca9 = '',
|
|
_0x418fbc = getOptions(_0x2236be, this.cookie, _0x564ca9);
|
|
|
|
await doRequest('get', _0x418fbc);
|
|
|
|
let result = res;
|
|
|
|
if (!result) {
|
|
return;
|
|
}
|
|
|
|
if (result.result == 1) {
|
|
if (result.data.isLimit == true) {
|
|
console.log('🎉' + this.name + '=>|今天已提现');
|
|
return;
|
|
}
|
|
|
|
let _0x57539e = parseFloat(this.cashBalance);
|
|
|
|
if (ksjsbAggressive == 1) {
|
|
if (_0x57539e < 0.3) {
|
|
console.log('🎉' + this.name + '=>|余额不足0.3元,不提现');
|
|
} else {
|
|
let _0xc81e7b = Math.floor(_0x57539e * 10) / 10;
|
|
|
|
_0xc81e7b = _0xc81e7b > 50 ? 50 : _0xc81e7b;
|
|
|
|
console.log(
|
|
'🎉' + this.name + '=>|准备最大化提现' + _0xc81e7b + '元'
|
|
);
|
|
|
|
await $.wait(200);
|
|
await this.withdraw(_0xc81e7b);
|
|
}
|
|
} else {
|
|
if (!ksjsbCash) {
|
|
let lists=result.data.newWithdrawList
|
|
let enList=[]
|
|
for (let i=0;i<lists.length;i++)
|
|
enList.push(lists[i].amount)
|
|
//console.log(enList)
|
|
for (let withdrawlist of enList.sort(function (
|
|
_0x5357e2,
|
|
_0xc5d50f
|
|
) {
|
|
return _0xc5d50f - _0x5357e2;
|
|
})) {
|
|
if (_0x57539e >= parseFloat(withdrawlist)) {
|
|
console.log('🎉' + this.name + '=>|准备提现' + withdrawlist + '元');
|
|
|
|
await $.wait(200);
|
|
await this.withdraw(withdrawlist);
|
|
return;
|
|
}
|
|
}
|
|
|
|
console.log(
|
|
'🎉' + this.name + '=>|余额不足,可提现额度:' +
|
|
enList.join(',')
|
|
);
|
|
} else {
|
|
_0x57539e >= parseFloat(ksjsbCash)
|
|
? (console.log(
|
|
'🎉' + this.name + '=>|准备提现' + ksjsbCash + '元'
|
|
),
|
|
await $.wait(200),
|
|
await this.withdraw(ksjsbCash))
|
|
: console.log(
|
|
'🎉' + this.name + '=>|余额不足' + ksjsbCash + '元,不提现'
|
|
);
|
|
}
|
|
}
|
|
} else {
|
|
console.log(
|
|
'🎉' + this.name + '=>|查询提现列表失败:' + result.error_msg
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
async accountOverview() {
|
|
let _0x512fe7 =
|
|
'https://nebula.kuaishou.com/rest/n/nebula/account/overview',
|
|
_0x251847 = '',
|
|
_0x39f16d = getOptions(_0x512fe7, this.cookie, _0x251847);
|
|
|
|
await doRequest('get', _0x39f16d);
|
|
let _0xa69994 = res;
|
|
|
|
if (!_0xa69994) {
|
|
return;
|
|
}
|
|
|
|
if (_0xa69994.result == 1) {
|
|
this.coinBalance = _0xa69994.data.coinBalance;
|
|
this.cashBalance = _0xa69994.data.cashBalance;
|
|
this.totalAmount=_0xa69994.data.accumulativeAmount;
|
|
|
|
let _0x54aac5 = _0xa69994.data.exchangeCoinState;
|
|
|
|
console.log('🎉' + this.name +'=>|账户余额' + this.cashBalance + '元,' + this.coinBalance + '金币, 共领取' + this.totalAmount +'元' );
|
|
notifyStr += '🎉'+ this.name +'余额' + this.cashBalance + '元 ' + this.coinBalance + '金币 共' + this.totalAmount +'元\n'
|
|
|
|
_0x54aac5 == 2 && (await $.wait(200), await this.changeExchangeType(0));
|
|
} else {
|
|
console.log(
|
|
'🎉' + this.name + '=>|查询账户信息失败:' + _0xa69994.error_msg
|
|
);
|
|
}
|
|
}
|
|
|
|
//开箱子
|
|
async openBox(_0x412555) {
|
|
let _0x513362 =
|
|
'https://nebula.kuaishou.com/rest/n/nebula/box/explore?isOpen=' +
|
|
_0x412555 +
|
|
'&isReadyOfAdPlay=true',
|
|
_0x3ef8d9 = '',
|
|
_0x48334f = getOptions(_0x513362, this.cookie, _0x3ef8d9);
|
|
|
|
await doRequest('get', _0x48334f);
|
|
let _0x15220b = res;
|
|
|
|
if (!_0x15220b) {
|
|
return;
|
|
}
|
|
|
|
_0x15220b.result == 1
|
|
? _0x412555 == true
|
|
? _0x15220b.data.commonAwardPopup &&
|
|
_0x15220b.data.commonAwardPopup.awardAmount
|
|
? (console.log(
|
|
'🎉' +
|
|
this.name +
|
|
'=>|开宝箱获得' +
|
|
_0x15220b.data.commonAwardPopup.awardAmount +
|
|
'金币'
|
|
),
|
|
await $.wait(200))
|
|
: console.log('🎉' + this.name + '=>|开宝箱没有获得金币')
|
|
: _0x15220b.data.openTime > -1
|
|
? (console.log(
|
|
'🎉' +
|
|
this.name +
|
|
'=>|开宝箱冷却时间还有' +
|
|
Math.floor(_0x15220b.data.openTime / 1000) +
|
|
'秒'
|
|
),
|
|
_0x15220b.data.openTime == 0 &&
|
|
(await $.wait(200), await this.openBox(true)))
|
|
: console.log('🎉' + this.name + '=>|开宝箱次数已用完')
|
|
: _0x412555 == true
|
|
? console.log('🎉' + this.name + '=>|开宝箱失败:' + _0x15220b.error_msg)
|
|
: console.log(
|
|
'🎉' + this.name + '=>|查询宝箱状态失败:' + _0x15220b.error_msg
|
|
);
|
|
}
|
|
|
|
//兑换
|
|
async changeExchangeType(_0x1bd22f) {
|
|
let _0x4e7ea7 =
|
|
'https://nebula.kuaishou.com/rest/n/nebula/exchange/changeExchangeType',
|
|
_0x6250c8 = '{"type":' + _0x1bd22f + '}',
|
|
_0x2c1c9f = getOptions(_0x4e7ea7, this.cookie, _0x6250c8);
|
|
|
|
_0x2c1c9f.headers['Content-Type'] = 'application/json';
|
|
await doRequest('post', _0x2c1c9f);
|
|
let _0x4df55c = res;
|
|
|
|
if (!_0x4df55c) {
|
|
return;
|
|
}
|
|
|
|
let _0x1fdd87 = _0x1bd22f == 0 ? '自动兑换' : '手动兑换';
|
|
|
|
_0x4df55c.result == 1
|
|
? console.log(
|
|
'🎉' +
|
|
this.name +
|
|
'=>|兑换方式更改成功,目前兑换方式为:' +
|
|
_0x1fdd87
|
|
)
|
|
: console.log(
|
|
'🎉' + this.name + '=>|兑换方式更改失败:' + _0x4df55c.error_msg
|
|
);
|
|
}
|
|
|
|
//金币兑换奖券
|
|
async exchangeCoin() {
|
|
if (this.coinBalance < 100) {
|
|
console.log('🎉' + this.name + '=>|金币余额不足100,不执行兑换');
|
|
return;
|
|
}
|
|
|
|
let _0x54ee74 =
|
|
'https://nebula.kuaishou.com/rest/n/nebula/exchange/coinToCash/submit',
|
|
_0x365938 =
|
|
'{"coinAmount":' +
|
|
this.coinBalance +
|
|
',"token":"rE2zK-Cmc82uOzxMJW7LI2-wTGcKMqqAHE0PhfN0U4bJY4cAM5Inxw"}',
|
|
_0x4650af = getOptions(_0x54ee74, this.cookie, _0x365938);
|
|
|
|
_0x4650af.headers['Content-Type'] = 'application/json';
|
|
await doRequest('post', _0x4650af);
|
|
let _0x2ae7ad = res;
|
|
|
|
if (!_0x2ae7ad) {
|
|
return;
|
|
}
|
|
|
|
if (_0x2ae7ad.result == 1) {
|
|
let _0x1e5bfa = Math.floor(this.coinBalance / 100) * 100,
|
|
_0xd2629a = Math.floor(this.coinBalance / 100) / 100;
|
|
|
|
console.log(
|
|
'🎉' +
|
|
this.name +
|
|
'=>|兑换金币成功,将' +
|
|
_0x1e5bfa +
|
|
'金币兑换成' +
|
|
_0xd2629a +
|
|
'元'
|
|
);
|
|
} else {
|
|
console.log(
|
|
'🎉' + this.name + '=>|兑换金币失败:' + _0x2ae7ad.error_msg
|
|
);
|
|
}
|
|
}
|
|
async luckdrawInfo() {
|
|
let _0x2fda4d = 'https://activity.e.kuaishou.com/rest/r/game/user/info',
|
|
_0x59d2d4 = '',
|
|
_0x50c63f = getOptions(_0x2fda4d, this.cookie, _0x59d2d4);
|
|
|
|
await doRequest('get', _0x50c63f);
|
|
|
|
let _0x1d97ad = res;
|
|
|
|
if (!_0x1d97ad) {
|
|
return;
|
|
}
|
|
|
|
if (_0x1d97ad.result == 1) {
|
|
console.log(
|
|
'🎉' + this.name + '=>|现有' +
|
|
_0x1d97ad.data.userDiamondResult.diamondPercent +
|
|
'钻石,剩余抽奖次数:' +
|
|
_0x1d97ad.data.userDailyLotteryTimesResult.remainTimes
|
|
);
|
|
|
|
for (
|
|
let _0x5387e7 = 0;
|
|
_0x5387e7 < _0x1d97ad.data.userDailyLotteryTimesResult.remainTimes;
|
|
_0x5387e7++
|
|
) {
|
|
await $.wait(200);
|
|
await this.luckydraw();
|
|
}
|
|
} else {
|
|
console.log(
|
|
'🎉' + this.name + '=>|查询抽奖次数失败:' + _0x1d97ad.error_msg
|
|
);
|
|
}
|
|
}
|
|
|
|
async luckydraw() {
|
|
let _0x5aeb3b =
|
|
'https://activity.e.kuaishou.com/rest/r/game/lottery?wheelVersion=1',
|
|
_0x16fa83 = '',
|
|
_0x5b3172 = getOptions(_0x5aeb3b, this.cookie, _0x16fa83);
|
|
|
|
await doRequest('post', _0x5b3172);
|
|
|
|
let _0x5099f1 = res;
|
|
|
|
if (!_0x5099f1) {
|
|
return;
|
|
}
|
|
|
|
if (_0x5099f1.result == 1) {
|
|
let _0x355997 = _0x5099f1.data.coinCount
|
|
? _0x5099f1.data.coinCount + '金币'
|
|
: _0x5099f1.data.diamondCount
|
|
? _0x5099f1.data.diamondCount + '钻石'
|
|
: '空气';
|
|
|
|
console.log('🎉' + this.name + '=>|抽奖获得' + _0x355997);
|
|
|
|
if (_0x5099f1.data.videoCoinCount) {
|
|
console.log('额外奖励:' + _0x5099f1.data.videoCoinCount);
|
|
}
|
|
|
|
if (_0x5099f1.data.schema) {
|
|
try {
|
|
console.log(Base64.decode(_0x5099f1.data.schema));
|
|
} catch (_0x2cd9ad) {
|
|
console.log(_0x5099f1.data.schema);
|
|
} finally {
|
|
}
|
|
}
|
|
|
|
if (this.hasLuckydraw) {
|
|
await this.luckdrawTasks();
|
|
}
|
|
} else {
|
|
console.log('🎉' + this.name + '=>|抽奖失败:' + _0x5099f1.error_msg);
|
|
}
|
|
}
|
|
|
|
async luckydrawSign() {
|
|
let _0x19e391 = 'https://activity.e.kuaishou.com/rest/r/game/sign-in',
|
|
_0x364621 = '',
|
|
_0x17553a = getOptions(_0x19e391, this.cookie, _0x364621);
|
|
|
|
await doRequest('get', _0x17553a);
|
|
|
|
let _0x3dc187 = res;
|
|
|
|
if (!_0x3dc187) {
|
|
return;
|
|
}
|
|
|
|
_0x3dc187.result == 1
|
|
? _0x3dc187.data.isShow &&
|
|
console.log('🎉' + this.name + '=>|抽奖页签到成功')
|
|
: (console.log(
|
|
'🎉' + this.name + '=>|查询抽奖签到情况失败:' + _0x3dc187.error_msg
|
|
),
|
|
_0x3dc187.error_msg.indexOf('激励游戏未在运营') > -1 &&
|
|
(this.hasLuckydraw = false));
|
|
}
|
|
|
|
async luckdrawTimerInfo() {
|
|
let _0x41f4dd =
|
|
'https://activity.e.kuaishou.com/rest/r/game/timer-reward/info',
|
|
_0x57d99c = '',
|
|
_0x188ea7 = getOptions(_0x41f4dd, this.cookie, _0x57d99c);
|
|
|
|
await doRequest('get', _0x188ea7);
|
|
|
|
let _0x9de9b6 = res;
|
|
|
|
if (!_0x9de9b6) {
|
|
return;
|
|
}
|
|
|
|
if (_0x9de9b6.result == 1) {
|
|
if (_0x9de9b6.data) {
|
|
let _0x53217e = new Date().getTime(),
|
|
_0x2d8627 = _0x9de9b6.data.lastTimerTime,
|
|
_0x42feaa = _0x9de9b6.data.minutesInterval * 60 * 1000,
|
|
_0x25bdde = _0x2d8627 + _0x42feaa;
|
|
|
|
_0x53217e < _0x25bdde
|
|
? console.log(
|
|
'🎉' + this.name + '=>|抽奖页奖励冷却时间还有' +
|
|
(_0x25bdde - _0x53217e) / 1000 +
|
|
'秒'
|
|
)
|
|
: (await $.wait(200),
|
|
await this.luckdrawTimerReward(_0x9de9b6.data.goldNum));
|
|
} else {
|
|
console.log('🎉' + this.name + '=>|抽奖页定时奖励次数已用完');
|
|
}
|
|
} else {
|
|
console.log(
|
|
'🎉' + this.name + '=>|查询抽奖页定时奖励情况失败:' +
|
|
_0x9de9b6.error_msg
|
|
);
|
|
}
|
|
}
|
|
|
|
async luckdrawTimerReward(_0x571114) {
|
|
let _0xeaee4 = 'https://activity.e.kuaishou.com/rest/r/game/timer-reward',
|
|
_0x4f1a45 = '',
|
|
_0x44f25f = getOptions(_0xeaee4, this.cookie, _0x4f1a45);
|
|
|
|
await doRequest('post', _0x44f25f);
|
|
|
|
let _0x3a934e = res;
|
|
|
|
if (!_0x3a934e) {
|
|
return;
|
|
}
|
|
|
|
_0x3a934e.result == 1
|
|
? console.log(
|
|
'🎉' + this.name + '=>|领取抽奖页定时奖励获得' + _0x571114 + '金币'
|
|
)
|
|
: console.log(
|
|
'🎉' + this.name + '=>|领取抽奖页定时奖励失败:' +
|
|
_0x3a934e.error_msg
|
|
);
|
|
}
|
|
|
|
async luckdrawTasks() {
|
|
let _0x464ad5 = 'https://activity.e.kuaishou.com/rest/r/game/tasks',
|
|
_0x2bfcad = '',
|
|
_0x15101f = getOptions(_0x464ad5, this.cookie, _0x2bfcad);
|
|
|
|
await doRequest('get', _0x15101f);
|
|
await $.wait(3000);
|
|
let _0x4e8b19 = res;
|
|
|
|
if (!_0x4e8b19) {
|
|
return;
|
|
}
|
|
|
|
if (_0x4e8b19.result == 1) {
|
|
for (let _0x2e65d8 of _0x4e8b19.data.dailyTasks) {
|
|
// _0x2e65d8.taskState == 1 &&
|
|
// (await $.wait(200), await this.luckdrawTasksReward(_0x2e65d8));
|
|
}
|
|
|
|
for (let _0x4e5c51 of _0x4e8b19.data.growthTasks) {
|
|
// _0x4e5c51.taskState == 1 &&
|
|
// (await $.wait(200), await this.luckdrawTasksReward(_0x4e5c51));
|
|
}
|
|
} else {
|
|
console.log(
|
|
'🎉' + this.name + '=>|查询抽奖页任务失败:' + _0x4e8b19.error_msg
|
|
);
|
|
}
|
|
}
|
|
|
|
async luckdrawTasksReward(_0x548292) {
|
|
let _0x452703 =
|
|
'https://activity.e.kuaishou.com/rest/r/game/task/reward-receive?taskName=' +
|
|
_0x548292.taskName,
|
|
_0x4038c0 = '',
|
|
_0x2242b2 = getOptions(_0x452703, this.cookie, _0x4038c0);
|
|
|
|
await doRequest('get', _0x2242b2);
|
|
|
|
let _0x3417ed = res;
|
|
|
|
if (!_0x3417ed) {
|
|
return;
|
|
}
|
|
|
|
_0x3417ed.result == 1
|
|
? console.log(
|
|
'🎉' + this.name + '=>|领取抽奖任务[' +
|
|
_0x548292.taskTitle +
|
|
']奖励获得' +
|
|
_0x3417ed.data.popUp.taskRewardName
|
|
)
|
|
: console.log(
|
|
'🎉' + this.name + '=>|领取抽奖任务[' +
|
|
_0x548292.taskTitle +
|
|
']奖励失败:' +
|
|
_0x3417ed.error_msg
|
|
);
|
|
}
|
|
|
|
//获取用户ID
|
|
async getUserid() {
|
|
let _0x579d90 =
|
|
'https://nebula.kuaishou.com/rest/n/nebula/activity/invitation/relationLink?version=1.2.0',
|
|
_0xb20aec = '',
|
|
_0x5a5910 = getOptions(_0x579d90, this.cookie, _0xb20aec);
|
|
|
|
await doRequest('get', _0x5a5910);
|
|
let _0x450eae = res;
|
|
|
|
if (!_0x450eae) {
|
|
return;
|
|
}
|
|
|
|
_0x450eae.result == 1
|
|
? (this.userId = _0x450eae.data.userId)
|
|
: console.log(
|
|
'🎉' + this.name + '=>|获取userId失败:' + _0x450eae.error_msg
|
|
);
|
|
}
|
|
|
|
|
|
async bindInfo() {
|
|
let _0x328bd6 =
|
|
'https://www.kuaishoupay.com/pay/account/h5/provider/bind_info',
|
|
_0x2f2b1b = 'account_group_key=NEBULA_CASH_ACCOUNT&bind_page_type=3',
|
|
_0x32746d = getOptions(_0x328bd6, this.cookie, _0x2f2b1b);
|
|
|
|
await doRequest('post', _0x32746d);
|
|
|
|
let _0x4d5493 = res;
|
|
|
|
if (!_0x4d5493) {
|
|
return;
|
|
}
|
|
|
|
if (_0x4d5493.result == 'SUCCESS') {
|
|
let _0x4015b0 = '未绑定支付宝',
|
|
_0x3840b8 = '未绑定微信';
|
|
_0x4d5493.alipay_bind == true &&
|
|
((this.bindAlipay = true),
|
|
(this.alipay = _0x4d5493.alipay_nick_name),
|
|
(_0x4015b0 = '已绑定支付宝[' + _0x4d5493.alipay_nick_name + ']'));
|
|
_0x4d5493.wechat_bind == true &&
|
|
((this.bindWechat = true),
|
|
(this.wechat = _0x4d5493.wechat_nick_name),
|
|
(_0x3840b8 = '已绑定微信[' + _0x4d5493.wechat_nick_name + ']'));
|
|
console.log('🎉' + this.name + '=>|' + _0x3840b8 + ',' + _0x4015b0);
|
|
} else {
|
|
console.log(
|
|
'🎉' + this.name + '=>|查询提现账号绑定情况失败:' +
|
|
_0x4d5493.error_msg
|
|
);
|
|
}
|
|
}
|
|
|
|
//账号详情
|
|
async accountInfo() {
|
|
let _0x308f69 =
|
|
'https://www.kuaishoupay.com/pay/account/h5/withdraw/account_info',
|
|
_0xfe05d = 'account_group_key=NEBULA_CASH_ACCOUNT&providers=',
|
|
_0x52286e = getOptions(_0x308f69, this.cookie, _0xfe05d);
|
|
|
|
await doRequest('post', _0x52286e);
|
|
let _0x25e462 = res;
|
|
|
|
if (!_0x25e462) {
|
|
return;
|
|
}
|
|
|
|
_0x25e462.result == 'SUCCESS'
|
|
? (this.needSms = _0x25e462.need_mobile_code)
|
|
: console.log(
|
|
'🎉' + this.name + '=>|查询账号提现情况失败:' + _0x25e462.error_msg
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
//执行任务,前面的async是异步,现在处理
|
|
!(async () => {
|
|
if (!(await formatCookie())) {
|
|
return;
|
|
}
|
|
//console.log('\n============== 🎉登录🎉 ==============');
|
|
for (let user of Users) {
|
|
await user.getUserInfo();
|
|
await $.wait(100);
|
|
}
|
|
|
|
let CurrentUser = Users.filter((u) => u.valid == true);
|
|
if (CurrentUser.length == 0) {
|
|
return;
|
|
}
|
|
let curHours = new Date().getHours();
|
|
|
|
for (let u of CurrentUser) {
|
|
console.log('\n=========== 🎉' + u.name + ' 🎉===========');
|
|
await u.getSignInfo();
|
|
await $.wait(200);
|
|
if (curHours<9) await u.TaskSignIn(),await u.setShare();
|
|
await $.wait(200);
|
|
await u.openBox(false);
|
|
await $.wait(200);
|
|
await u.luckydrawSign();
|
|
await $.wait(200);
|
|
if (u.hasLuckydraw == true) {
|
|
await u.luckdrawTimerInfo();
|
|
await $.wait(200);
|
|
await u.luckdrawTasks();
|
|
await $.wait(200);
|
|
await u.luckdrawInfo();
|
|
await $.wait(200);
|
|
}
|
|
}
|
|
console.log('\n============== 🎉账户情况🎉 ==============');
|
|
let tips = '按提现列表自动提现';
|
|
if (ksjsbAggressive>0) {
|
|
tips = '最大化提现';
|
|
}
|
|
if (curHours == ksWithdrawTime) {
|
|
console.log(`提现时间,现在设置为${tips}`);
|
|
} else {
|
|
console.log(`非提现时间,现在设置为${ksWithdrawTime}点${tips}`);
|
|
}
|
|
for (let u of CurrentUser) {
|
|
await u.accountOverview();
|
|
await $.wait(200);
|
|
await u.accountInfo();
|
|
await $.wait(200);
|
|
if (curHours==`${ksWithdrawTime}`) {
|
|
await u.bindInfo();
|
|
await $.wait(200);
|
|
await u.withdrawOverview()
|
|
}
|
|
}
|
|
await showmsg()
|
|
|
|
})()
|
|
.catch((error) => $.logErr(error))
|
|
.finally(() => $.done());
|
|
|
|
|
|
//通知
|
|
async function showmsg() {
|
|
|
|
let notifyBody = "\n///////////////////////\n快手极速版运行通知\n" + notifyStr
|
|
//console.log(notifyBody);
|
|
let hour = new Date().getHours();
|
|
if (notifyFlag==1) {
|
|
if (hour==12 || hour==18 || otherts ) {
|
|
if ($.isNode()) await notify.sendNotify($.name, notifyBody )
|
|
otherts=false
|
|
}
|
|
}
|
|
}
|
|
|
|
async function formatCookie() {
|
|
if (ksjsbCookie) {
|
|
for (let ck of ksjsbCookie.split('\n')) {
|
|
if (ck) {
|
|
Users.push(new ksUser(ck));
|
|
}
|
|
}
|
|
count = Users.length;
|
|
} else {
|
|
console.log('未找到CK');
|
|
return;
|
|
}
|
|
console.log('共找到' + count + '个账号');
|
|
return true;
|
|
}
|
|
function getOptions(url, cookie, body = '') {
|
|
const options = {
|
|
url: url,
|
|
headers: {
|
|
Cookie: cookie,
|
|
},
|
|
};
|
|
if (body) {
|
|
options.body = body;
|
|
options.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
}
|
|
return options;
|
|
}
|
|
|
|
//http请求
|
|
|
|
async function doRequest(method, options) {
|
|
res = null;
|
|
return new Promise((resolve) => {
|
|
$[method](options, async (err, resp, data) => {
|
|
try {
|
|
if (err) {
|
|
console.log(method + '请求失败');
|
|
console.log(JSON.stringify(err));
|
|
$.logErr(err);
|
|
} else {
|
|
if (safeGet(data)) {
|
|
res = JSON.parse(data);
|
|
}
|
|
}
|
|
} catch (error) {
|
|
$.logErr(error, 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 _0x1ab8b7(T) {
|
|
console["log"](T);
|
|
_0x279d25 += T;
|
|
_0x279d25 += "\n";
|
|
}
|
|
function randomString(e = 12) {
|
|
let t = 'abcdef0123456789',
|
|
a = t.length,
|
|
n = '';
|
|
for (let i = 0; i < e; i++) n += t.charAt(Math.floor(Math.random() * a));
|
|
return n;
|
|
}
|
|
var Base64 = {
|
|
encode: function encode(input) {
|
|
var _keyStr =
|
|
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
var output = '';
|
|
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
|
|
var i = 0;
|
|
input = $.util.Charset.utf8_encode(input);
|
|
while (i < input.length) {
|
|
chr1 = input.charCodeAt(i++);
|
|
chr2 = input.charCodeAt(i++);
|
|
chr3 = input.charCodeAt(i++);
|
|
enc1 = chr1 >> 2;
|
|
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
|
|
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
|
|
enc4 = chr3 & 63;
|
|
if (isNaN(chr2)) {
|
|
enc3 = enc4 = 64;
|
|
} else if (isNaN(chr3)) {
|
|
enc4 = 64;
|
|
}
|
|
output =
|
|
output +
|
|
_keyStr.charAt(enc1) +
|
|
_keyStr.charAt(enc2) +
|
|
_keyStr.charAt(enc3) +
|
|
_keyStr.charAt(enc4);
|
|
}
|
|
return output;
|
|
},
|
|
decode: function (input) {
|
|
var _keyStr =
|
|
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
var output = '';
|
|
var chr1, chr2, chr3;
|
|
var enc1, enc2, enc3, enc4;
|
|
var i = 0;
|
|
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, '');
|
|
while (i < input.length) {
|
|
enc1 = _keyStr.indexOf(input.charAt(i++));
|
|
enc2 = _keyStr.indexOf(input.charAt(i++));
|
|
enc3 = _keyStr.indexOf(input.charAt(i++));
|
|
enc4 = _keyStr.indexOf(input.charAt(i++));
|
|
chr1 = (enc1 << 2) | (enc2 >> 4);
|
|
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
|
|
chr3 = ((enc3 & 3) << 6) | enc4;
|
|
output = output + String.fromCharCode(chr1);
|
|
if (enc3 != 64) {
|
|
output = output + String.fromCharCode(chr2);
|
|
}
|
|
if (enc4 != 64) {
|
|
output = output + String.fromCharCode(chr3);
|
|
}
|
|
}
|
|
output = $.util.Charset.utf8_decode(output);
|
|
return output;
|
|
},
|
|
};
|
|
|
|
|
|
|
|
//青龙等模块
|
|
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);
|
|
}
|