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

1
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):

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
_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)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
[
  // 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).

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

    1
    2
    3
    4
    5
    
    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