npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

juejin-helper

v1.7.2

Published

稀土掘金助手:签到、抽奖、沾喜气、海底淘金、BugFix、自动化工作流。

Downloads

14,854

Readme

示例

签到示例

const JuejinHelper = require("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("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("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("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();

Browser 浏览器访问示例

const JuejinHelper = require("juejin-helper");

async function run() {
  const juejin = new JuejinHelper();
  await juejin.login("你的掘金Cookie");

  const browser = juejin.browser();

  await browser.open();

  try {
    await browser.visitPage("/");
    console.log("掘金首页:页面访问成功");
  } catch (e) {
    console.log("掘金首页:页面访问失败");
  }

  try {
    await browser.visitPage("/user/center/signin");
    console.log("掘金每日签到:页面访问成功");
  } catch (e) {
    console.log("掘金每日签到:页面访问失败");
  }

  // const page = await browser.visitPage("/");
  // const screenshotBuffer = await page.screenshot(); // 获取页面快照

  await browser.close();
}

问题

如何获取Cookie

掘金网站Cookie, 打开浏览器,登录 掘金, 打开控制台DevTools(快捷键F12) -> Network,复制 cookie, 掘金Cookie有效期约1个月需定期更新.

DevTools截图:

赞赏

☕️微信赞赏!鼓励升级!

许可

Apache-2.0