Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
lz0423 authored Feb 27, 2021
1 parent 1bae879 commit 4478990
Show file tree
Hide file tree
Showing 77 changed files with 16,355 additions and 0 deletions.
68 changes: 68 additions & 0 deletions commands/52pojie.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@

const path = require('path')
const { scheduler } = require('../utils/scheduler')

exports.command = '52pojie'

exports.describe = '52pojie签到任务'

exports.builder = function (yargs) {
return yargs
.option('htVD_2132_auth', {
describe: 'cookie项htVD_2132_auth的值',
type: 'string'
})
.option('htVD_2132_saltkey', {
describe: 'cookie项htVD_2132_saltkey的值',
type: 'string'
})
.help()
.showHelpOnFail(true, '使用--help查看有效选项')
.epilog('copyright 2020 LunnLew');
}

exports.handler = async function (argv) {
var command = argv._[0]
var accounts = []
if ('accountSn' in argv && argv.accountSn) {
let accountSns = argv.accountSn.split(',')
for (let sn of accountSns) {
if (('htVD_2132_auth-' + sn) in argv) {
let account = {
htVD_2132_auth: argv['htVD_2132_auth-' + sn],
htVD_2132_saltkey: argv['htVD_2132_saltkey-' + sn],
tasks: argv['tasks-' + sn]
}
if (('tryrun-' + sn) in argv) {
account['tryrun'] = true
}
accounts.push(account)
}
}
} else {
accounts.push({
...argv
})
}
console.log('总账户数', accounts.length)
for (let account of accounts) {
await require(path.join(__dirname, 'tasks', command, command)).start({
cookies: {
htVD_2132_auth: account.htVD_2132_auth,
htVD_2132_saltkey: account.htVD_2132_saltkey
},
options: {}
}).catch(err => console.log("52pojie签到任务:", err.message))
let hasTasks = await scheduler.hasWillTask(command, {
tryrun: 'tryrun' in argv,
taskKey: account.htVD_2132_auth
})
if (hasTasks) {
scheduler.execTask(command, account.tasks).catch(err => console.log("52pojie签到任务:", err.message)).finally(() => {
console.log('当前任务执行完毕!')
})
} else {
console.log('暂无可执行任务!')
}
}
}
105 changes: 105 additions & 0 deletions commands/bilibili.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@

const path = require('path')
const { scheduler } = require('../utils/scheduler')

exports.command = 'bilibili'

exports.describe = 'bilibili签到任务'

exports.builder = function (yargs) {
return yargs
.option('cookies', {
describe: 'cookies',
type: 'string'
})
.option('username', {
describe: '登陆账号',
type: 'string'
})
.option('password', {
describe: '登陆密码',
type: 'string'
})
.option('NumberOfCoins', {
describe: '视频投币的目标数量',
default: 5,
type: 'number'
})
.option('CoinsForVideo', {
describe: '每个视频投币数量,最多2',
default: 1,
type: 'number'
})
.option('SelectLike', {
describe: '视频投币时是否点赞',
default: true,
type: 'boolean'
})
.option('DayOfReceiveVipPrivilege', {
describe: '指定的某一天取得会员权益',
default: 1,
type: 'number'
})
.help()
.showHelpOnFail(true, '使用--help查看有效选项')
.epilog('copyright 2020 LunnLew');
}

exports.handler = async function (argv) {
var command = argv._[0]
var accounts = []
if ('accountSn' in argv && argv.accountSn) {
let accountSns = argv.accountSn.split(',')
for (let sn of accountSns) {
if (('username-' + sn) in argv) {
let account = {
cookies: argv['cookies-' + sn],
NumberOfCoins: argv['NumberOfCoins-' + sn],
CoinsForVideo: argv['CoinsForVideo-' + sn],
SelectLike: argv['SelectLike-' + sn],
username: argv['username-' + sn] + '',
password: argv['password-' + sn] + '',
tasks: argv['tasks-' + sn]
}
if (('tryrun-' + sn) in argv) {
account['tryrun'] = true
}
accounts.push(account)
}
}
} else {
accounts.push({
cookies: argv['cookies'],
NumberOfCoins: argv['NumberOfCoins'],
CoinsForVideo: argv['CoinsForVideo'],
SelectLike: argv['SelectLike'],
username: argv['username'] + '',
password: argv['password'] + '',
tasks: argv['tasks']
})
}
console.log('总账户数', accounts.length)
for (let account of accounts) {
await require(path.join(__dirname, 'tasks', command, command)).start({
cookies: account.cookies,
options: {
NumberOfCoins: account.NumberOfCoins,
CoinsForVideo: account.CoinsForVideo,
SelectLike: account.SelectLike,
username: account.username,
password: account.password,
}
}).catch(err => console.log("bilibili签到任务:", err.message))
let hasTasks = await scheduler.hasWillTask(command, {
tryrun: 'tryrun' in argv,
taskKey: account.username
})
if (hasTasks) {
scheduler.execTask(command, account.tasks).catch(err => console.log("bilibili签到任务:", err.message)).finally(() => {
console.log('当前任务执行完毕!')
})
} else {
console.log('暂无可执行任务!')
}
}
}
86 changes: 86 additions & 0 deletions commands/iqiyi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@

const path = require('path')
const { scheduler } = require('../utils/scheduler')

exports.command = 'iqiyi'

exports.describe = 'iqiyi签到任务'

exports.builder = function (yargs) {
return yargs
.option('P00001', {
describe: 'Cookie中P00001的值',
default: '',
type: 'string'
})
.option('P00PRU', {
describe: 'Cookie中P00PRU的值',
default: '',
type: 'string'
})
.option('dfp', {
describe: 'Cookie中_dfp的值',
default: '',
type: 'string'
})
.help()
.showHelpOnFail(true, '使用--help查看有效选项')
.epilog('copyright 2020 LunnLew');
}

exports.handler = async function (argv) {
var command = argv._[0]
var accounts = []
if ('accountSn' in argv && argv.accountSn) {
let accountSns = argv.accountSn.split(',')
for (let sn of accountSns) {
if (('P00PRU-' + sn) in argv) {
let account = {
P00001: argv['P00001-' + sn],
P00003: argv['P00003-' + sn],
P00PRU: argv['P00PRU-' + sn] + '',
QC005: argv['QC005-' + sn],
dfp: argv['dfp-' + sn],
tasks: argv['tasks-' + sn]
}
if (('tryrun-' + sn) in argv) {
account['tryrun'] = true
}
accounts.push(account)
}
}
} else {
accounts.push({
P00001: argv['P00001'],
P00003: argv['P00003'],
P00PRU: argv['P00PRU'] + '',
QC005: argv['QC005'],
dfp: argv['dfp'],
tasks: argv['tasks']
})
}
console.log('总账户数', accounts.length)
for (let account of accounts) {
await require(path.join(__dirname, 'tasks', command, command)).start({
cookies: {
P00001: account.P00001,
P00003: account.P00003,
P00PRU: account.P00PRU,
QC005: account.QC005,
_dfp: account.dfp
},
options: {}
}).catch(err => console.log("iqiyi签到任务:", err.message))
let hasTasks = await scheduler.hasWillTask(command, {
tryrun: 'tryrun' in argv,
taskKey: account.P00PRU
})
if (hasTasks) {
scheduler.execTask(command, account.tasks).catch(err => console.log("iqiyi签到任务:", err.message)).finally(() => {
console.log('当前任务执行完毕!')
})
} else {
console.log('暂无可执行任务!')
}
}
}
42 changes: 42 additions & 0 deletions commands/tasks/52pojie/52pojie.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
const _request = require("../../../utils/request");
// const { scheduler } = require("../../../utils/scheduler");
var start = async (params) => {
const { cookies, options, scheduler } = params;

let init = async (request, savedCookies) => {
if (!savedCookies) {
if (
!cookies ||
!("htVD_2132_auth" in cookies) ||
!cookies["htVD_2132_auth"]
) {
throw new Error("需要提供htVD_2132_auth参数");
}

if (!("htVD_2132_saltkey" in cookies) || !cookies["htVD_2132_saltkey"]) {
throw new Error("需要提供htVD_2132_saltkey参数");
}
return {
request: _request(cookies),
};
} else {
return {
request,
};
}
};
let taskOption = {
init,
};

await scheduler.regTask(
"dailySign",
async (request) => {
await require("./sign")(request);
},
taskOption
);
};
module.exports = {
start,
};
46 changes: 46 additions & 0 deletions commands/tasks/52pojie/sign.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
const iconv = require("iconv-lite");
const cheerio = require("cheerio");

var loadSign = async (axios, url) => {
let chunks = [];
let str = await new Promise((resolve, reject) => {
axios
.request({
url: url,
responseType: "stream",
})
.then((res) => {
res.data.on("data", (chunk) => {
chunks.push(chunk);
});
res.data.on("end", () => {
let buffer = Buffer.concat(chunks);
let str = iconv.decode(buffer, "gbk");
resolve(str);
});
});
});
let $ = cheerio.load(str);
let msg = $("#messagetext").text();
return msg;
};

module.exports = async (axios) => {
let msg = await loadSign(
axios,
"https://www.52pojie.cn/home.php?mod=task&do=apply&id=2"
);
if (msg.indexOf("需要先登录才能继续本操作") !== -1) {
console.log("需要先登录才能继续本操作,跳过本期任务");
return;
}
if (msg.indexOf("本期您已申请过此任务") !== -1) {
console.log("本期您已申请过此任务,跳过本期任务");
return;
}
msg = await loadSign(
axios,
"https://www.52pojie.cn/home.php?mod=task&do=draw&id=2"
);
console.log("52pojie签到:", msg);
};
Loading

0 comments on commit 4478990

Please sign in to comment.