cx-juejin-helper
v1.0.4
Published
稀土掘金助手:签到、抽奖、沾喜气、海底淘金、BugFix、自动化工作流。
Downloads
69
Readme
示例
签到示例
const JuejinHelper = require("cx-juejin-helper");
async function run() {
const juejin = new JuejinHelper();
await juejin.login("你的掘金Cookie");
const growth = juejin.growth();
// 签到
await growth.checkIn();
// 获取当前矿石数
// await growth.getCurrentPoint();
// 获取统计签到天数
// await growth.getCounts();
// 获取今日签到状态
// await growth.getTodayStatus();
// 获取抽奖配置
// await growth.getLotteryConfig();
// 抽奖
// await growth.drawLottery();
// 获取抽奖幸运用户
// await growth.getLotteriesLuckyUsers({ page_no = 1, page_size = 5 }); // => { lotteries: [{ lottery_history_id }, ...] }
// 获取我的幸运值
// await growth.getMyLucky();
// 沾喜气
// await growth.dipLucky(lottery_history_id); // => { has_dip, dip_value, total_value, dip_action }
await juejin.logout();
}
run();
海底掘金游戏示例
const JuejinHelper = require("cx-juejin-helper");
async function run() {
const juejin = new JuejinHelper();
await juejin.login("你的掘金Cookie");
const seagold = juejin.seagold();
await seagold.gameLogin(); // 登陆游戏
let gameInfo = null;
const info = await seagold.gameInfo(); // 游戏状态
if (info.gameStatus === 1) {
gameInfo = info.gameInfo; // 继续游戏
} else {
gameInfo = await seagold.gameStart(); // 开始游戏
}
const command = ["U", "L"];
await seagold.gameCommand(gameInfo.gameId, command); // 执行命令
const result = await seagold.gameOver(); // 游戏结束
console.log(result); // => { ... }
await juejin.logout();
}
run();
bugfix 游戏示例
const JuejinHelper = require("cx-juejin-helper");
async function run() {
const juejin = new JuejinHelper();
await juejin.login("你的掘金Cookie");
const bugfix = juejin.bugfix();
const notCollectBugList = await bugfix.getNotCollectBugList();
await bugfix.collectBugBatch(notCollectBugList);
console.log(`收集Bug ${notCollectBugList.length}`);
const competition = await bugfix.getCompetition();
const bugfixInfo = await bugfix.getUser(competition);
console.log(`未消除Bug数量 ${bugfixInfo.user_own_bug}`);
}
SDK示例
const JuejinHelper = require("cx-juejin-helper");
async function run() {
const juejin = new JuejinHelper();
await juejin.login("你的掘金Cookie");
const sdk = juejin.sdk();
await sdk.slardarSDKSetting(); // SDK设置
await sdk.list(/* events */); // 埋点数据
}
run();
问题
如何获取Cookie
掘金网站Cookie, 打开浏览器,登录 掘金, 打开控制台DevTools(快捷键F12) -> Network,复制 cookie, 掘金Cookie有效期约1个月需定期更新.
DevTools截图: