2023.10.1 Update

This content may be outdated—please cross-check with the official repo .

Heads-up:

As of 2023.10.1, new users can pull the Debian image docker pull whyour/qinglong:debian.

It’s more compatible with some Python deps: e.g., ddddocr installs on the Debian tag but not on the default image.

Preface

After sharing the Qinglong setup and JD beans task , I found another fun project: BiliTools.

Based on the original docs , here’s my configuration tutorial plus personal notes. Take what you need.

Note:

vercel.app was recently blocked in China; you’ll need a proxy to read the original docs.

Prerequisites

A running Qinglong server (local or cloud).

Setup guide: click here .

The project supports many environments (local, Qinglong, Docker, serverless, etc.). This post only covers Qinglong.

Tutorial

Install dependency

In Qinglong Panel -> Dependency Management -> NodeJs -> New dependency, enter @catlair/bilitools and install.

Install dependency

Pull the script

In Qinglong Panel -> Cron Jobs -> New job, set Name (anything), Command (ql raw https://gitee.com/Kudouran/BiliTools/raw/main/tools/bilitools_npm.js), Schedule (0 0 0 * * *), then create and run once manually.

About the cron rule:

This uses a Java-style cron expression. 0 0 0 * * * means once daily at midnight. Adjust with an online tool if needed.

Cron expression

Pull script

Update npm package

Auto-update looks like this:

Update npm package

pnpm remove -g @catlair/bilitools && pnpm add -g @catlair/bilitools

Without pnpm remove -g @catlair/bilitools, old versions linger on disk.

Get cookies

Example with Firefox/Chrome/Edge. Final cookie resembles (line breaks added for readability):

_uuid=D2282D0F-257B-845A-BDF5-C770ED288F4001440infoc; buvid3=BF17608E-FB87-4F49-A922-56FD2E284D6F18534infoc;
fingerprint=5502cd4fe9637738de04bd9c3d1bdbc5;
buvid_fp=BF17608E-FB87-4F49-A922-56FD2E284D6F18534infoc;
SESSDATA=21607773%2C1631089673%2C71a42%2A31; bili_jct=dd92c55a6d67041ce2f3fb1650889ea8;
DedeUserID=521268093; DedeUserID__ckMd5=47d541f04b605da9;
sid=ivie73r8; fingerprint3=792b32adfecbe31a4aca53ab7be1ad76;
fingerprint_s=bb6736758e7344a295c2ed6070cc642e;
buvid_fp_plain=BF17608E-FB87-4F49-A922-56FD2E284D6F18534infoc;
CURRENT_FNVAL=80; blackside_state=1; rpdid=|(kmJYYJ)lkR0J'uYu)llkJYJ; _dfcaptcha=a46d7562a42065d43a88c053e283e876;
LIVE_BUVID=AUTO8016188357987702; bsource=search_baidu; PVID=2

To avoid cookie refresh/invalidations (e.g., if you frequently browse Bilibili, the session might rotate), don’t copy cookies from your everyday session. Instead, open a private/incognito window, log in, and capture a fresh cookie. Close the window directly—don’t log out or the cookie dies immediately.

Incognito shortcuts (examples):

Incognito window

Chrome

Open an incognito window, visit Bilibili, log in. Press F12 (or right-click -> Inspect), switch to Network, refresh, click a request (often the first nav request), then copy the cookie.

Chrome cookie

When copying in Chromium browsers, choose Copy (not “Copy value”).

Firefox

Open a private window, visit Bilibili, log in. Press F12 (or right-click -> Inspect), go to Network, refresh.

Firefox network

Firefox cookie

Mobile

Not recommended—too many pitfalls.

Config file (important)

Configuration is the core of the project. Only a correct config will run properly—read carefully.

Lazy single-user template (edit as needed)

[
  // Lines starting with // are comments
  {
    // Browser User-Agent; grab from http://service.spiritsoft.cn/ua.html
    userAgent: '',
    // General API delay range (seconds)
    apiDelay: [2, 6],
    // Bilibili cookie (see above)
    cookie: "",
    // Features to run
    function: {
      silver2Coin: true,
      addCoins: true,
      liveSignTask: true,
      shareAndWatch: true,
      mangaTask: true,
      supGroupSign: false,
      useCouponBp: true,
      getVipPrivilege: true,
      giveGift: false,
      matchGame: false,
      batchUnfollow: true,
      liveLottery: false,
      liveRedPack: true,
      liveIntimacy: false,
      bigPoint: false,
      judgement: false,
      activityLottery: false,
    },
    // Live red packet
    redPack: {
      // 1: activity link (may be outdated); 2: scan; other = try all
      source: 0,
      // Activity link
      uri: 'https://api.live.bilibili.com/xlive/fuxi-interface/AugRedPacket2022Controller/redPocketPlaying',
      // Interval between rounds (seconds)
      intervalActive: 60,
      // Mid-break: [count, rest minutes (<1 ends)]
      restTime: [-1, -1],
      // Suspected risk cooldown: [count, rest minutes (<1 ends)]
      riskTime: [-1, -1],
      // Concurrent rooms
      linkRoomNum: 1,
      // Bullet comments sent while waiting [fixed] or [min,max]
      dmNum: [10],
      // Handle followed users while waiting (read/move)
      moveUpInWait: true,
      /** Move followed UPs into group */
      moveTag: 'rp关注',
      /** Follow reply handling */
      actFollowMsg: 'read',
      // Total participation limit (-1 = none)
      totalNum: -1,
      // Stop after N consecutive losses (<1 = no limit)
      noWinNum: 10,
      // Stop after N suspected risk events (<1 = no limit)
      riskNum: 5,
    },
    // Auto unfollow
    unFollow: {
      // Interval per unfollow (seconds)
      delay: 3,
      // Mid-break [count, rest minutes] (positive only)
      restTime: [20, -1],
      // Total limit (-1 = none)
      totalNum: -1,
      // Tags to unfollow
      tags: ['天选时刻', 'rp关注'],
    },
    // Notifications
    message: {
      br: '\n',
      // Qinglong-friendly example: WeCom webhook key
      'QYWX_KEY': "Fill your key here",
    },
    // Coin settings
    coin: {
      targetLevel: 6,
      stayCoins: 0,
      targetCoins: 5,
      customizeUp: [],
      todayCoins: 0,
      upperAccMatch: false,
    },
    // Use B-coins
    couponBalance: {
      /** Default charge target (self by default) */
      mid: 0,
      /** Preset days; empty = daily */
      presetTime: [10, 20],
      /** Mode: charge/battery */
      use: '充电',
    },
    // Live gifts
    gift: {
      // Custom gift targets (randomly chosen)
      mids: [],
      // Other fields omitted
    },
    // Intimacy
    intimacy: {
      liveSendMessage: true,
      liveLike: true,
      limitFeed: 1500,
      liveHeart: false,
      whiteList: [],
      blackList: [],
    },
    // Manga
    manga: {
      sign: true,
      buy: false,
      mc: [],
      name: [],
      love: true,
      buyInterval: 2,
      buyWeek: [],
    },
    // Jury
    jury: {
      mode: 1,
      vote: [0, 0, 1],
      once: true,
      opinionMin: 3,
      waitTime: 20,
    },
    // Big points
    bigPoint: {
      isRetry: true,
      isWatch: true,
      epids: [],
      watchDelay: 40,
    },
  },
]

If you use the template, edit these four places:

  1. User-Agent required — copy the red text from this site .

  2. Cookie required — see above.

  3. Coin settings — adjust as needed (e.g., disable once you reach Lv6).

    coin: {
          targetLevel: 6,
          stayCoins: 0,
          targetCoins: 5,
          customizeUp: [],
          todayCoins: 0,
          upperAccMatch: false,
        }
  4. Notification — recommended to fill.

    message: {
          br: '\n',
          'QYWX_KEY': "Fill your key here",
          // Other providers are also supported (GOBOT, SCKEY, QQ, etc.)
        }

Add environment variable

  • Config uses json5 (supports comments). Validate with an online json5 validator before use.

  • Paste the validated config into the Gzip tool , choose Gzip compress, then copy the output.

    Gzip compress config

  • In Qinglong Panel -> Environment variables -> New variable, set Name BILITOOLS_CONFIG, Value = the Gzip output, then save.

    Add variable

Run manually

Back on the Qinglong tasks page you should see three BiliBili jobs:

Bilibili tasks

Names can be anything—watch the commands:

  • First: update dependency
  • Third: pull repo
  • Second: main program (visible after running the pull once)

When ready, run the main job manually.

Thanks

BiliTools