MyGit

puzzlemoondev/BililiveRecorder-webhook-docker

Fork: 2 Star: 23 (更新于 2024-11-03 16:30:11)

license: MIT

Language: Python .

Dockerized BililiveRecorder with biliup, DanmakuFactory, baidupcs and aliyunpan upload webhook with caddy reverse proxy support for automated HTTPS

最后发布版本: v0.3.8 ( 2024-05-16 16:20:04)

GitHub网址

BililiveRecorder-webhook-docker

Test Publish Docker Image Version (latest semver) Docker Image Size (latest semver)

Dockerized BililiveRecorder with biliup, DanmakuFactory, baidupcs and aliyunpan upload webhook with caddy reverse proxy support for automated HTTPS.

The webhook server listens for FileClosed events, uploads files, and removes them after upload success.

B 站专栏

Why

  • Parallelism (celery task queue)
  • Lightweight enough to run on t2.micro
  • Real time service & task monitoring and management (using supervisor & flower)
  • Automated HTTPS (using caddy)

Why not

  • No GUI for configuration
  • No GPU acceleration for ffmpeg tasks
  • Multiple services in a docker container (to keep memory footprint low)
  • Python

How to use

⚠️ DO NOT TURN BURN_DANMAKU ON if your machine is low on resource.

  • Add a .env file with these variables. Note that every variable is optional. For baidupcs, provide both bduss and stoken. For aliyunpan, provide rtoken. Providing credentials for both platform at the same time triggers upload to both platform concurrently.
    • RECORDER_USER: username for BiliveRecorder
    • RECORDER_PASS: password for BiliveRecorder
    • RECORDER_ADDRESS: needed if you want to use reverse proxy. defaults to localhost. If you have an A record in your DNS records you should use that instead.
    • BAIDUPCS_UPLOAD_DIR: baidupcs folder to upload files into
    • BAIDUPCS_BDUSS: bduss for baidupcs login. See baidupcs for how to retrieve.
    • BAIDUPCS_STOKEN: stoken for baidupcs login. See baidupcs for how to retrieve.
    • BAIDUPCS_MAX_UPLOAD_PARALLEL: parallel upload setting for SVIP user. Max 100.
    • ALIYUNPAN_UPLOAD_DIR: aliyunpan folder to upload files into
    • ALIYUNPAN_RTOKEN: refresh token for aliyunpan login. See aliyunpan for how to retrieve.
    • BURN_DANMAKU: pass 1 to turn danmaku burning on. This creates a separate video file with hardcoded danmaku.
    • BILIBILI_UPLOAD_BURNED: pass 1 to upload video with danmaku instead of the original.
    • REMOVE_LOCAL: pass 1 to remove local files after upload.
# without reverse proxy
make up
# with reverse proxy
make proxy-up
  • Add webhook to settings
    • Go to Settings -> Webhook -> Webhook V2
    • Add this line: http://localhost:9000/hooks/recorder-file-closed

How to Update

# without reverse proxy
make update
# with reverse proxy
make proxy-update

Biliup Integration

  • To use biliup, add your cookies.json under biliup. This directory will be mounted to /etc/biliup in the container. Alternatively, run docker compose run --rm -w /etc/biliup webhook biliup login to login interactively.
  • (Optional) Add your config yaml and cover files (optional) under biliup. See sample for all supported fields. title and desc supports string interpolation. Run biliup upload --help to see default values.
  • If you have multiple bilibili accounts, put all their cookies json inside /etc/biliup and specify their name in your config yaml.

Sample config.yml

line: kodo
limit: 3
streamers:
  "弥瑟里*": # supports unix glob syntax
    title: "【弥瑟里seri】%Y-%m-%dT%H:%M:%S录播_{title}"
    tid: 27
    copyright: 1
    tag:
      - 虚拟UP主
      - 直播
      - 录播
      - 直播录像
      - 弥瑟里seri
      - 弥瑟里
      - seri
  "*": # all supported fields
    user_cookie: cookies_for_another_account.json # defaults to cookies.json
    copyright: 1
    source: ''
    tid: 27
    cover: /etc/biliup/cover.png
    title: "【{streamer}】%Y-%m-%dT%H:%M:%S录播_{title}"
    desc: |
      streamer: {streamer}
      title: {title}
      date: %Y-%m-%dT%H:%M:%S
    dynamic: ''
    tag:
      - 虚拟UP主
      - 直播
      - 录播
      - 直播录像
    dtime: 28800
    dolby: 0
    hires: 0
    no_reprint: 1
    open_elec: 0

DanmakuFactory Integration

  • To use DanmakuFactory, add your DanmakuFactoryConfig.json under DanmakuFactory. If not, default values will be used. This directory will be mounted to /etc/DanmakuFactory in the container.

Sample DanmakuFactoryConfig.json

This is the default config file from https://github.com/hihkm/DanmakuFactory

{
    "resolution": [1920, 1080],
    "scrolltime": 12.000000,
    "fixtime": 5.000000,
    "density": 0,
    "fontname": "Microsoft YaHei",
    "fontsize": 38,
    "opacity": 180,
    "outline": 0,
    "shadow": 1,
    "displayArea": 1.000000,
    "scrollArea": 1.000000,
    "bold": true,
    "showUsernames": true,
    "showMsgbox": true,
    "msgboxSize": [500, 1080],
    "msgboxPos": [20, 0],
    "msgboxFontsize": 38,
    "giftMinPrice": 0.00,
    "blockmode": [],
    "statmode": []
}

Monitoring

  • We use flower to monitor task queues. Visit http://[RECORDER_ADDRESS]:5555/flower (or https://[RECORDER_ADDRESS]/flower for reverse proxy) to see the panel.
  • For supervisor, visit http://[RECORDER_ADDRESS]:9001 (or https://[RECORDER_ADDRESS]/supervisor for reverse proxy). Note that supervisor does not fully support reverse proxy so expect some weird behavior under reverse proxy.

Dependencies

最近版本更新:(数据更新于 2024-08-29 13:55:59)

2024-05-16 16:20:04 v0.3.8

2023-11-07 21:47:40 v0.3.7

2023-10-13 01:57:08 v0.3.6

2023-10-13 00:34:47 v0.3.5

2023-10-05 18:11:27 v0.3.4

2023-10-02 01:52:12 v0.3.3

2023-09-05 17:47:52 v0.3.2

2023-08-24 02:26:24 v0.3.1

2023-08-10 19:37:39 v0.3.0

2023-08-07 10:43:38 v0.2.14

主题(topics):

bilibili, bilibili-live

puzzlemoondev/BililiveRecorder-webhook-docker同语言 Python最近更新仓库

2024-11-22 02:39:01 goauthentik/authentik

2024-11-22 00:03:47 comfyanonymous/ComfyUI

2024-11-21 22:06:18 rashevskyv/dbi

2024-11-21 21:09:02 xtekky/gpt4free

2024-11-21 20:03:58 ultralytics/ultralytics

2024-11-21 00:54:04 hect0x7/JMComic-Crawler-Python