1 Star 1 Fork 2

chinjiaqing/juejin-helper

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
growth.js 1.49 KB
一键复制 编辑 原始数据 按行查看 历史
const JuejinHttp = require('./juejin/api')
const { getCookie } = require('./juejin/cookie')
const { handleTask } = require("./juejin/task")
const { sendEmail } = require(`./utils/email`)
const config = require("./config/index")
const growth = async () => {
try {
const cookie = await getCookie()
const API = new JuejinHttp(cookie)
const { growth_tasks = {} } = await API.getTaskList()
const data = Object.values(growth_tasks)
let taskHasDone = 0
for (let items of data) {
for (let task of items) {
if (task.limit > 0 && task.done < task.limit && ![4, 15, 16].includes(task.task_id)) {
console.log(`---开始任务:<${task.title}> ---`)
await handleTask(task)
taskHasDone += 1
}
}
}
const { today_jscore } = await API.getTaskList()
console.log(`成长任务已完成, 今日掘友分+${today_jscore}`)
if (taskHasDone > 0) {
await sendEmail({
to: config.user.email,
text: `成长任务已完成, 今日掘友分+${today_jscore}`,
subject: '【掘金】上分成功'
})
}
} catch (err) {
console.log(err)
await sendEmail({
to: config.user.email,
text: `任务失败:${err.message}`,
subject: '【掘金】上分失败'
})
}
}
// growth()
module.exports = {
growth
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/chinjiaqing/juejin-helper.git
[email protected]:chinjiaqing/juejin-helper.git
chinjiaqing
juejin-helper
juejin-helper
main

搜索帮助