| Crates.io | blivedm |
| lib.rs | blivedm |
| version | 0.5.2 |
| created_at | 2025-10-08 03:13:20.763447+00 |
| updated_at | 2026-01-21 07:55:26.577187+00 |
| description | Bilibili live room danmaku WebSocket client with TTS and plugin support |
| homepage | |
| repository | https://github.com/jiahaoxiang2000/blivedm_rs |
| max_upload_size | |
| id | 1873369 |
| size | 302,516 |
一个功能强大的 Bilibili 直播间弹幕 WebSocket 客户端 Rust 库,支持实时弹幕监控、文字转语音(TTS)和浏览器 Cookie 自动检测。
Bilibili Video start point v0.4 v0.5
无需手动提取 Cookie! 客户端现在可以自动从您的浏览器检测 bilibili cookies。
支持 Linux、macOS 和 Windows 上的 Chrome、Firefox、Edge、Chromium 和 Opera。详情请参阅浏览器 Cookie 文档。
如果您已安装 Rust,可以直接从 crates.io 安装:
cargo install --locked blivedm
安装后即可在任何位置使用 blivedm 命令。
# 克隆仓库
git clone https://github.com/jiahaoxiang2000/blivedm_rs.git
cd blivedm_rs
# 构建并安装到本地
cargo install --locked --path .
安装后即可在任何位置使用 blivedm 命令。
# v0.4.0 新功能:启用自动回复插件
blivedm --room-id 12345 --auto-reply
# 自动检测浏览器 cookies(推荐)
blivedm --room-id 24779526
# 使用配置文件
blivedm --config config.toml
# 查看有效配置
blivedm --print-config
# 手动 cookies(必须包含 SESSDATA)
blivedm --cookies "SESSDATA=your_sessdata; other_cookie=..." --room-id 12345
# 使用 TTS REST API 服务器
blivedm --room-id 12345 --tts-server http://localhost:8000 --tts-volume 0.7
# 使用本地 TTS(macOS)
blivedm --room-id 12345 --tts-command say --tts-args "-v,Mei-Jia"
# 使用本地 TTS(Linux)
blivedm --room-id 12345 --tts-command espeak-ng --tts-args "-v,cmn"
# ⚠️ Windows 用户建议:使用 TTS 服务器获得更好的语音体验
# 本地 PowerShell TTS 存在技术限制,推荐使用远程 TTS 服务器:
blivedm --room-id 12345 --tts-server http://localhost:8000
# 显示所有可用选项
blivedm --help
Windows 用户特别推荐使用 TTS 服务器! 相比受限的本地 PowerShell TTS,服务器提供更好的语音质量和功能。
# 克隆并设置 TTS 服务器
git clone https://github.com/jiahaoxiang2000/danmu-tts.git
cd danmu-tts
# 按照仓库中的设置说明进行操作
TTS 服务器优势:
详细设置说明请参阅 danmu-tts 仓库。
新功能! 现在支持 TOML 配置文件,简化复杂命令行参数:
客户端按以下顺序查找配置文件:
--config 指定的路径config.toml~/.config/blivedm_rs/config.toml(XDG 配置目录)创建 config.toml 文件:
# 连接设置
[connection]
room_id = "24779526"
# cookies = "SESSDATA=your_sessdata; other_cookie=value"
# v0.4.0 新功能:自动回复配置
[auto_reply]
enabled = true
triggers = [
{ keywords = ["测试", "test"], response = "这是一个测]试回复" },
]
cooldown_seconds = 3
# TTS 配置
[tts]
server = "http://localhost:8000"
voice = "zh-CN-XiaoxiaoNeural"
backend = "edge"
quality = "medium"
format = "wav"
sample_rate = 22050
volume = 0.8
# 或使用本地 TTS 命令
# command = "say"
# args = "--voice=Kyoko"
# 调试日志
debug = false
配置值按以下优先级解析(从高到低):
ROOM_ID、Cookie)# 使用指定配置文件
blivedm --config path/to/config.toml
# 查看有效配置(调试用)
blivedm --print-config
# 命令行参数覆盖配置文件
blivedm --config config.toml --room-id 12345 --debug
# v0.4.0 新功能:启用自动回复功能
blivedm --config config.toml --auto-reply
提示: 如果未找到配置文件,程序会自动创建示例配置文件 config.toml.example 供参考。
如果您希望从源码构建或进行开发,可以按照以下步骤:
# 克隆仓库
git clone https://github.com/jiahaoxiang2000/blivedm_rs.git
cd blivedm_rs
# 构建项目
cargo build --release
# 运行弹幕客户端(自动检测浏览器 cookies)
./target/release/blivedm --room-id 24779526
# 使用配置文件
./target/release/blivedm --config config.toml
# 或使用手动 cookies(必须包含 SESSDATA)
./target/release/blivedm --cookies "SESSDATA=your_sessdata; other_cookie=..." --room-id 24779526
sudo apt-get install libasound2-devsudo apt-get install pkg-config libssl-devsudo apt-get install espeak-ngsay 命令进行 TTS)详细使用指南请参阅 Danmu 页面。
完整文档位于 docs/ 文件夹中。主要部分包括: