docker + webhook 懒人部署B站录播姬并自动化B站投稿、百度云与阿里云上传
# 2023/02/14 新增biliup支持,自动化B站投稿。
# 2023/01/25 新增阿里云支持,没有阿里云,请大家帮忙测试下。
# 2023/01/26 发现云盘cli的exit code不可靠,增加上传结果检查。
仓库:https://github.com/puzzlemoondev/BililiveRecorder-webhook-docker

因 ec2 免费硬盘太小而诞生。原理是用 docker 包装 webhook 服务器及录播姬(使用官方镜像),并在接到文件关闭 webhook 时执行上传任務。 任务管理使用celery。

部署流程
1. 准备一台有 git 和 docker 的机器
2. git clone 并 cd 到专案
3. 创建 .env 文件并填入以下内容
要上传百度云请提供 BDUSS 和 STOKEN ,参考:https://github.com/qjfoidnh/BaiduPCS-Go#登录百度帐号
要上传阿里云请提供 RTOKEN ,参考:https://github.com/tickstep/aliyunpan#如何获取RefreshToken
百度云和阿里云的的认证都有的话会开两个process同时上传两个平台。
4. 启动 docker 容器
5. 加入 webhook
访问录播姬(http://[远端ip或localhost]:2356)。并进入录播姬WebUI -> 设置,下拉到底找到Webhook V2,填入:
6. 开香槟
Biliup整合
將 config.yml 檔放到 biliup 文件夾,有封面也可以放到裡面。在 docker 容器裡的地址為 /etc/biliup。
示例見:https://biliup.github.io/biliup/Guide.html#完整配置文件示例
目前只支援 user 和 streamers 配置。
title和description支持主播、直播间标题和strftime日期插值,详见示例。
Config.yml
更新方法
細節
監控
docker compose up 会部署 flower,访问 http://[远端ip或localhost]:5555 可以监控任务队列。
supervisor web ui 访问 http://[远端ip或localhost]:9001。
依賴
B站录播姬:https://github.com/BililiveRecorder/BililiveRecorder
webhook:https://github.com/adnanh/webhook
BaiduPCS-Go:https://github.com/qjfoidnh/BaiduPCS-Go
aliyunpan:https://github.com/tickstep/aliyunpan
biliup: https://github.com/biliup/biliup
celery: https://github.com/celery/celery
flower: https://github.com/mher/flower