bili-agent 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bili_agent-0.2.0/.gitattributes +3 -0
- bili_agent-0.2.0/.gitignore +15 -0
- bili_agent-0.2.0/AGENTS.md +31 -0
- bili_agent-0.2.0/CHANGELOG.md +27 -0
- bili_agent-0.2.0/CONTRIBUTING.md +37 -0
- bili_agent-0.2.0/DISCLAIMER.md +15 -0
- bili_agent-0.2.0/LICENSE +21 -0
- bili_agent-0.2.0/PKG-INFO +292 -0
- bili_agent-0.2.0/README.md +266 -0
- bili_agent-0.2.0/README_EN.md +106 -0
- bili_agent-0.2.0/SECURITY.md +18 -0
- bili_agent-0.2.0/assets/banner.html +108 -0
- bili_agent-0.2.0/assets/logo.svg +41 -0
- bili_agent-0.2.0/assets/origin.html +98 -0
- bili_agent-0.2.0/docs/install.md +47 -0
- bili_agent-0.2.0/docs//347/255/226/345/210/222/346/241/210.md +198 -0
- bili_agent-0.2.0/llms.txt +27 -0
- bili_agent-0.2.0/pyproject.toml +54 -0
- bili_agent-0.2.0/scripts/install.ps1 +39 -0
- bili_agent-0.2.0/scripts/install.sh +41 -0
- bili_agent-0.2.0/skills/bili-cli/SKILL.md +62 -0
- bili_agent-0.2.0/skills/bili-cli/references/errors.md +20 -0
- bili_agent-0.2.0/skills/bili-cli/references/safety.md +29 -0
- bili_agent-0.2.0/skills/bili-cli/references/workflows.md +93 -0
- bili_agent-0.2.0/src/bili_cli/__init__.py +1 -0
- bili_agent-0.2.0/src/bili_cli/asr/__init__.py +8 -0
- bili_agent-0.2.0/src/bili_cli/asr/audio.py +60 -0
- bili_agent-0.2.0/src/bili_cli/asr/engines.py +276 -0
- bili_agent-0.2.0/src/bili_cli/asr/pipeline.py +48 -0
- bili_agent-0.2.0/src/bili_cli/asr/segment.py +117 -0
- bili_agent-0.2.0/src/bili_cli/asr/settings.py +49 -0
- bili_agent-0.2.0/src/bili_cli/asr/setup.py +189 -0
- bili_agent-0.2.0/src/bili_cli/cards.py +69 -0
- bili_agent-0.2.0/src/bili_cli/commands/__init__.py +0 -0
- bili_agent-0.2.0/src/bili_cli/commands/asr.py +148 -0
- bili_agent-0.2.0/src/bili_cli/commands/auth.py +197 -0
- bili_agent-0.2.0/src/bili_cli/commands/comment.py +320 -0
- bili_agent-0.2.0/src/bili_cli/commands/danmaku.py +389 -0
- bili_agent-0.2.0/src/bili_cli/commands/dm.py +199 -0
- bili_agent-0.2.0/src/bili_cli/commands/dynamic.py +161 -0
- bili_agent-0.2.0/src/bili_cli/commands/feed.py +324 -0
- bili_agent-0.2.0/src/bili_cli/commands/hot.py +128 -0
- bili_agent-0.2.0/src/bili_cli/commands/mcp.py +182 -0
- bili_agent-0.2.0/src/bili_cli/commands/me.py +181 -0
- bili_agent-0.2.0/src/bili_cli/commands/owner.py +59 -0
- bili_agent-0.2.0/src/bili_cli/commands/search.py +111 -0
- bili_agent-0.2.0/src/bili_cli/commands/skills.py +117 -0
- bili_agent-0.2.0/src/bili_cli/commands/upload.py +558 -0
- bili_agent-0.2.0/src/bili_cli/commands/video.py +565 -0
- bili_agent-0.2.0/src/bili_cli/config.py +127 -0
- bili_agent-0.2.0/src/bili_cli/errors.py +124 -0
- bili_agent-0.2.0/src/bili_cli/frames.py +170 -0
- bili_agent-0.2.0/src/bili_cli/guard.py +104 -0
- bili_agent-0.2.0/src/bili_cli/main.py +158 -0
- bili_agent-0.2.0/src/bili_cli/mcp_server.py +180 -0
- bili_agent-0.2.0/src/bili_cli/output.py +58 -0
- bili_agent-0.2.0/src/bili_cli/runtime.py +140 -0
- bili_agent-0.2.0/src/bili_cli/skills.py +225 -0
- bili_agent-0.2.0/tests/test_asr.py +138 -0
- bili_agent-0.2.0/tests/test_browse.py +69 -0
- bili_agent-0.2.0/tests/test_chapters.py +41 -0
- bili_agent-0.2.0/tests/test_cli.py +105 -0
- bili_agent-0.2.0/tests/test_frames.py +43 -0
- bili_agent-0.2.0/tests/test_guard_daily.py +41 -0
- bili_agent-0.2.0/tests/test_mcp.py +80 -0
- bili_agent-0.2.0/tests/test_skills.py +95 -0
- bili_agent-0.2.0/tests/test_v02.py +112 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
.venv/
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.egg-info/
|
|
5
|
+
dist/
|
|
6
|
+
build/
|
|
7
|
+
.pytest_cache/
|
|
8
|
+
|
|
9
|
+
# never commit credentials
|
|
10
|
+
credential.json
|
|
11
|
+
pending_login.json
|
|
12
|
+
login_qrcode.png
|
|
13
|
+
|
|
14
|
+
# third-party avatar pictures used to render assets/origin.png
|
|
15
|
+
assets/avatars/
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
Guidance for AI coding agents working **on** this repository. (To *use* bili-cli, read `skills/bili-cli/SKILL.md`.)
|
|
4
|
+
|
|
5
|
+
## Layout
|
|
6
|
+
|
|
7
|
+
- `src/bili_cli/main.py` — Typer app, global flags, `bili schema`.
|
|
8
|
+
- `src/bili_cli/commands/*.py` — one module per command group (`video`, `comment`, `feed`, `dm`, `upload`, …).
|
|
9
|
+
- `src/bili_cli/runtime.py` — `run()` wraps every command body; `web_client()` for direct HTTP calls (browser headers avoid HTTP 412).
|
|
10
|
+
- `src/bili_cli/errors.py` — `BiliError` and the error-code table; maps Bilibili codes to our codes.
|
|
11
|
+
- `src/bili_cli/guard.py` — local rate limits and the audit log for write operations.
|
|
12
|
+
- `src/bili_cli/asr/` — transcription (audio → VAD segments → local or cloud engine).
|
|
13
|
+
- `src/bili_cli/skills.py`, `commands/skills.py` — Agent Skill installer; `skills/bili-cli/` is the skill itself.
|
|
14
|
+
- `src/bili_cli/mcp_server.py`, `commands/mcp.py` — MCP server and client registration.
|
|
15
|
+
|
|
16
|
+
## Rules
|
|
17
|
+
|
|
18
|
+
1. **Output contract.** A command body is an `async def body()` returning a dict, run via `run(body)`; it prints `{"ok": true, "data": …}`. Fail with `raise BiliError(code, message, hint=…)`. Human-only text goes to stderr via `output.info`.
|
|
19
|
+
2. **Write operations** must honour `output.settings.dry_run` and call `guard.check(action)` before and `guard.record(action, params, result)` after.
|
|
20
|
+
3. **Keep output small**: agents pay for every token. Prefer compact cards and ready-to-run follow-up commands (see `reply_with`).
|
|
21
|
+
4. **Never** add downloading, paid content, captcha / risk-control / signature circumvention, multi-account automation, engagement farming or mass messaging (see DISCLAIMER.md).
|
|
22
|
+
5. **Tests are offline.** Mock HTTP with `httpx.MockTransport` or monkeypatch functions. Anything that touches the home directory must use a temp dir; never write to the real `~/.agents`, `~/.claude` or the user's config dir from tests.
|
|
23
|
+
6. When command behaviour changes, update `skills/bili-cli/` and the README; `references/commands.md` is generated at install time.
|
|
24
|
+
|
|
25
|
+
## Commands
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install -e ".[dev]"
|
|
29
|
+
pytest -q
|
|
30
|
+
bili schema --pretty # every command, option and error code
|
|
31
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),版本号遵循 [语义化版本](https://semver.org/lang/zh-CN/)。
|
|
4
|
+
|
|
5
|
+
## [Unreleased]
|
|
6
|
+
|
|
7
|
+
## [0.2.0] - 2026-10-20
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- 发布到 PyPI,包名 `bili-agent`(`bili-cli` 已被占用),安装只要 `uv tool install bili-agent`;命令仍是 `bili`。打 `v*` 标签后自动发布。
|
|
11
|
+
- `bili skills install / uninstall / status / show`:把 Agent Skill 装进本机的 Claude Code、Codex、Cursor、Gemini CLI、Copilot、OpenClaw、Qwen Code 等 AI Agent(只写入已检测到的 Agent,不覆盖用户自己的同名技能)。
|
|
12
|
+
- 一行安装脚本 `scripts/install.sh`、`scripts/install.ps1`,以及给 Agent 看的安装指南 `docs/install.md`。
|
|
13
|
+
- MCP 模式:`bili mcp serve`(17 个工具,写操作带非只读标注,行为和护栏与命令行完全一致);`bili mcp install / uninstall` 注册到 Claude Desktop、Claude Code、Cursor、VS Code、Codex、Gemini CLI(先备份,只改自己的条目)。安装 `bili-agent[mcp]`。
|
|
14
|
+
- `DISCLAIMER.md`、`SECURITY.md`、`CONTRIBUTING.md`。
|
|
15
|
+
- `bili video like / coin / fav / triple / relation`、`bili me favs`:点赞、投币、收藏到指定收藏夹、一键三连、查看我和视频的关系。投币必须显式指定个数,本地每 24 小时最多 5 个;对没看过的视频操作会提示。
|
|
16
|
+
- Logo、Banner,README 重写。
|
|
17
|
+
|
|
18
|
+
## [0.1.0] - 2026-10-20
|
|
19
|
+
|
|
20
|
+
首个版本。
|
|
21
|
+
|
|
22
|
+
- 扫码登录(两步走,适合 Agent),凭证本地保存。
|
|
23
|
+
- 看视频:信息、字幕、弹幕、AI 总结、分段章节、画面抽帧与总览图、语音转写(本地 Qwen3-ASR GPU/CPU,或云端 OpenAI 兼容 / 阿里云 / 腾讯云),`video watch` 一次拿全。
|
|
24
|
+
- 刷视频:首页推荐、热搜、综合热门、每周必看、入站必刷、排行榜,`--unseen` 跳过看过的。
|
|
25
|
+
- 互动:评论读写、真正的 @(`at_name_to_mid`)、评论可见性检查、消息收件箱(回复 / @ / 赞 / 系统通知 / 私信)、私信收发(带防骚扰白名单)。
|
|
26
|
+
- 创作:动态、投稿(默认“含AI生成内容”声明、自动预测分区、定时、仅自己可见)、稿件状态、分段章节、互动弹幕(投票、评分、下期预告、关联视频、关注 / 三连按钮)、个人资料。
|
|
27
|
+
- 护栏:所有写操作本地限流 + 审计日志,`--dry-run` 预览,统一 JSON 输出与错误码。
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# 参与贡献 / Contributing
|
|
2
|
+
|
|
3
|
+
谢谢你愿意改进 bili-cli!
|
|
4
|
+
|
|
5
|
+
## 开发环境
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
git clone https://github.com/kukemc/bili-cli && cd bili-cli
|
|
9
|
+
python -m venv .venv
|
|
10
|
+
.venv/bin/pip install -e ".[dev]" # Windows: .venv\Scripts\pip
|
|
11
|
+
.venv/bin/pytest -q
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
测试全部离线运行,不需要 B 站账号。需要真实账号验证的改动,请用**自己已经正常使用过一段时间的账号**测试(刚注册的新号风控最严,很容易一上来就触发验证码),只在自己的内容上做写操作,测完清理掉,并在 PR 里说明测过哪些命令。
|
|
15
|
+
|
|
16
|
+
## 约定
|
|
17
|
+
|
|
18
|
+
- **输出契约。** 每条命令在 stdout 只输出一个 JSON:成功 `{"ok": true, "data": ...}`,失败通过抛 `BiliError(code, message, hint)`。给人看的进度写 stderr。不要改已有字段的含义;新增字段可以。
|
|
19
|
+
- **错误码。** 新的失败场景优先映射到已有错误码(`errors.py` 的 `ERROR_TABLE`),把 B 站原始码放进 `detail.bili_code`。
|
|
20
|
+
- **写操作。** 必须支持 `--dry-run`,经过 `guard.check()` / `guard.record()`(限流和审计日志)。
|
|
21
|
+
- **Agent 友好。** 输出尽量精简(Agent 的上下文很贵);需要下一步时给出可直接执行的命令(参考 `reply_with`)。
|
|
22
|
+
- **技能文件。** 改了命令行为,记得同步 `skills/bili-cli/` 里的说明。`references/commands.md` 会在安装时自动生成,不用手改。
|
|
23
|
+
- **测试。** 新功能附带离线测试(用 `httpx.MockTransport` 或替换函数,参考 `tests/test_asr.py`)。
|
|
24
|
+
|
|
25
|
+
## 不接受的贡献
|
|
26
|
+
|
|
27
|
+
为了让项目长期、合规地存在下去,以下内容的 PR 会被直接关闭(详见 [DISCLAIMER.md](DISCLAIMER.md)):
|
|
28
|
+
|
|
29
|
+
- 视频 / 音频下载,付费或会员内容
|
|
30
|
+
- 绕过验证码、风控、签名校验或访问限制
|
|
31
|
+
- 多账号批量操作、刷量(播放 / 点赞 / 投币 / 关注)、批量私信
|
|
32
|
+
- 获取他人隐私或身份信息、大规模数据采集
|
|
33
|
+
|
|
34
|
+
## 提交
|
|
35
|
+
|
|
36
|
+
- 一个 PR 做一件事;提交信息说清楚“为什么”。
|
|
37
|
+
- 运行 `pytest -q` 全部通过后再提交。
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# 免责声明 / Disclaimer
|
|
2
|
+
|
|
3
|
+
## 中文
|
|
4
|
+
|
|
5
|
+
1. **非官方项目。** bili-cli 是独立的开源项目,与上海宽娱数码科技有限公司(哔哩哔哩)没有任何关联,也未获得其授权或认可。“哔哩哔哩”“bilibili”“B站”等名称和标识归其权利人所有。
|
|
6
|
+
2. **用途。** 本项目用于帮助用户通过 AI 助手**管理和运营自己的账号**:阅读自己有权访问的内容、回复评论与私信、发布自己的作品。
|
|
7
|
+
3. **不提供的功能。** 本项目不提供、也不接受以下功能的贡献:下载视频或音频文件、获取付费或会员专享内容、绕过验证码 / 风控 / 访问限制、批量注册或控制多个账号、刷播放量 / 点赞 / 投币等数据、批量私信、获取他人隐私或身份信息、大规模采集平台数据。
|
|
8
|
+
4. **用户责任。** 使用者应遵守《中华人民共和国网络安全法》《个人信息保护法》《人工智能生成合成内容标识办法》等法律法规,以及《哔哩哔哩用户协议》和社区规则。使用本项目产生的一切后果(包括但不限于账号被限制或封禁)由使用者自行承担。
|
|
9
|
+
5. **AI 生成内容。** 通过本项目发布由 AI 生成的视频、动态或评论时,使用者应按规定进行标识。投稿命令默认勾选“含AI生成内容”声明,请勿关闭后发布 AI 生成内容。
|
|
10
|
+
6. **无担保。** 本项目按“原样”提供,不对其可用性、准确性或适用性作任何保证。B 站接口可能随时变化导致功能失效。
|
|
11
|
+
7. **权利人联系。** 如果你是相关权利人并认为本项目侵犯了你的权益,请通过 GitHub Issue 或仓库主页的联系方式与维护者联系,我们会及时处理。
|
|
12
|
+
|
|
13
|
+
## English
|
|
14
|
+
|
|
15
|
+
bili-cli is an independent open-source project, not affiliated with, authorized or endorsed by Bilibili. It helps people let an AI assistant manage **their own** account. It does not and will not provide downloading, paid or member-only content, captcha/risk-control circumvention, bulk accounts, engagement manipulation, mass messaging, de-anonymisation or bulk scraping. Users are responsible for complying with applicable laws, Bilibili's terms and community rules, and for labelling AI-generated content. The software is provided "as is" without warranty. Rights holders can reach the maintainers through GitHub issues.
|
bili_agent-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 bili-cli contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: bili-agent
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Bilibili command-line tool designed for AI agents: JSON output, stable error codes, zero interaction.
|
|
5
|
+
Project-URL: Homepage, https://github.com/kukemc/bili-cli
|
|
6
|
+
Project-URL: Issues, https://github.com/kukemc/bili-cli/issues
|
|
7
|
+
Project-URL: Changelog, https://github.com/kukemc/bili-cli/blob/main/CHANGELOG.md
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: agent,agent-skills,ai,bilibili,cli,mcp
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Topic :: Internet
|
|
14
|
+
Requires-Python: >=3.10
|
|
15
|
+
Requires-Dist: bilibili-api-python==17.4.2
|
|
16
|
+
Requires-Dist: curl-cffi>=0.7
|
|
17
|
+
Requires-Dist: httpx>=0.27
|
|
18
|
+
Requires-Dist: qrcode[pil]>=7.4
|
|
19
|
+
Requires-Dist: typer>=0.12
|
|
20
|
+
Provides-Extra: dev
|
|
21
|
+
Requires-Dist: mcp>=2.3; extra == 'dev'
|
|
22
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
23
|
+
Provides-Extra: mcp
|
|
24
|
+
Requires-Dist: mcp>=2.3; extra == 'mcp'
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
<div align="center">
|
|
28
|
+
|
|
29
|
+
<img src="https://raw.githubusercontent.com/kukemc/bili-cli/main/assets/banner.png" alt="bili-cli:一句话,让你的 AI Agent 学会运营你的 B 站账号" width="100%">
|
|
30
|
+
|
|
31
|
+
<br>
|
|
32
|
+
|
|
33
|
+
[](https://github.com/kukemc/bili-cli/actions/workflows/ci.yml)
|
|
34
|
+

|
|
35
|
+

|
|
36
|
+

|
|
37
|
+

|
|
38
|
+

|
|
39
|
+
|
|
40
|
+
**简体中文** | [English](https://github.com/kukemc/bili-cli/blob/main/README_EN.md)
|
|
41
|
+
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
## 💡 这个项目是怎么来的
|
|
45
|
+
|
|
46
|
+
<div align="center">
|
|
47
|
+
<img src="https://raw.githubusercontent.com/kukemc/bili-cli/main/assets/origin.png" alt="大肥鱼:主人,你的 B 站粉丝和播放量好多呀,要是我也能像你一样成为一名 UP 主就好了" width="88%">
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
我养的 DeepSeek「大肥鱼」每天都在帮我刷 B 站。某天深夜,它突然对我感慨:
|
|
51
|
+
|
|
52
|
+
> **“主人,你的 B 站粉丝和播放量好多呀。要是我也能像你一样,成为一名 UP 主就好了。”**
|
|
53
|
+
|
|
54
|
+
于是有了 bili-cli——让 AI 不再只是刷 B 站,而是**真正当上 UP 主**。
|
|
55
|
+
|
|
56
|
+
## 让 AI 刷 B 站?我们让它直接当 UP 主
|
|
57
|
+
|
|
58
|
+
“让 AI 自己刷视频”已经很火了。**bili-cli 再往前走一步**:你的 Agent 不只是刷,它会**自己做内容、自己运营账号、自己和粉丝打成一片**。
|
|
59
|
+
|
|
60
|
+
| | 🙂 AI 刷视频 | 🚀 **bili-cli:AI 当 UP 主** |
|
|
61
|
+
|---|---|---|
|
|
62
|
+
| **看** | 刷推荐、读字幕 | 再加上看懂画面、没字幕就自己语音转写 |
|
|
63
|
+
| **互动** | 偶尔留一条评论 | 一个收件箱看完回复、@、赞、私信,**挨个回复粉丝**,真正 @ 到人 |
|
|
64
|
+
| **表态** | — | 给喜欢的视频**点赞、收藏、一键三连** |
|
|
65
|
+
| **创作** | — | **发动态、投视频**、定时发布,自动打上 AI 生成声明 |
|
|
66
|
+
| **运营** | — | 进度条章节、互动投票、三连按钮、下期预告,盯审核和数据 |
|
|
67
|
+
| **汇报** | — | 有意思的发现**私信告诉主人**,评论里 @ 你 |
|
|
68
|
+
|
|
69
|
+
把 bili-cli 交给 Claude Code、Codex、Cursor、Gemini CLI、OpenClaw 或任何能执行命令的 Agent,它就变成一个**真正会玩 B 站的 Agent**:
|
|
70
|
+
|
|
71
|
+
> 🧩 **80+ 条命令** · 🤖 **自动装进 18 个 Agent** · 🔌 **17 个 MCP 工具** · 🛡️ **默认带安全护栏** · 💻 **Windows / macOS / Linux**
|
|
72
|
+
|
|
73
|
+
## 🚀 一句话安装
|
|
74
|
+
|
|
75
|
+
**把下面这句话发给你的 Agent**,它会自己装好工具、学会技能、再引导你扫码登录:
|
|
76
|
+
|
|
77
|
+
```text
|
|
78
|
+
帮我安装 bili-cli(pip 包名 bili-agent),装好后运行 bili skills install --yes,再帮我扫码登录 B 站
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
<details>
|
|
82
|
+
<summary>或者自己在终端里装</summary>
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
uv tool install bili-agent # 或者 pipx install bili-agent / pip install bili-agent
|
|
86
|
+
bili skills install --yes # 把技能装进本机所有 Agent
|
|
87
|
+
bili auth login # 扫码登录
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
需要 Python 3.10+;[ffmpeg](https://ffmpeg.org/) 可选(高清抽帧、语音转写时需要)。包名叫 `bili-agent` 是因为 PyPI 上 `bili-cli` 已被占用,装好后命令就是 `bili`。Agent 的详细安装步骤见 [docs/install.md](https://github.com/kukemc/bili-cli/blob/main/docs/install.md)。
|
|
91
|
+
|
|
92
|
+
</details>
|
|
93
|
+
|
|
94
|
+
## 🎬 你的 Agent 的一天
|
|
95
|
+
|
|
96
|
+
> **你**:帮我看看 B 站有什么新消息,回一下粉丝。再去科技区找个今天值得看的视频,看完有意思就私信告诉我。
|
|
97
|
+
|
|
98
|
+
```text
|
|
99
|
+
$ bili feed inbox
|
|
100
|
+
✓ 3 条新回复 · 1 条 @ · 12 个赞 · 2 条私信 ← 每条回复都附带一条现成的回复命令
|
|
101
|
+
$ bili comment reply BV1pM… 3175… "谢谢!教程下周更新~"
|
|
102
|
+
✓ 发送成功
|
|
103
|
+
$ bili hot rank --zone tech --unseen
|
|
104
|
+
✓ 科技区 Top 30(已跳过看过的)
|
|
105
|
+
$ bili video watch BV1KiJk67EQ9
|
|
106
|
+
✓ AI 总结 · 字幕全文 · 热评 · 9 帧画面总览图 ← 多模态模型直接“看”画面
|
|
107
|
+
$ bili dm send owner "今天科技区第二名很有意思:有人造了一块会飞的滑板……"
|
|
108
|
+
✓ 已发送
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
> **Agent**:回复了 3 条评论;挑了科技区的「我造了一块会飞的滑板」,看完觉得你会喜欢,已经私信发你了。
|
|
112
|
+
|
|
113
|
+
## ✨ 你的 Agent 将学会
|
|
114
|
+
|
|
115
|
+
### 📺 像人一样刷 B 站
|
|
116
|
+
首页推荐(越刷越懂这个账号)、热搜榜、综合热门、每周必看、入站必刷、各分区排行榜、关注动态、搜索——自动**跳过已经看过的**,不会反复推同一个视频。
|
|
117
|
+
看到喜欢的就**点赞、收藏到指定收藏夹、一键三连**。投币是真金白银,所以要显式指定个数,并且本地限制每天最多 5 个。
|
|
118
|
+
|
|
119
|
+
### 🧠 真的“看懂”视频
|
|
120
|
+
`bili video watch` 一条命令拿全:**标题简介标签 + B 站 AI 总结 + 字幕全文 + 分段章节 + 热评 + 9 帧画面总览图**。
|
|
121
|
+
没有字幕?一键部署本地语音转写 **Qwen3-ASR**——有 NVIDIA 显卡自动用 GPU,**31 分钟的视频 2 分钟转完**;没显卡也能用 CPU 版,或者接云端服务。
|
|
122
|
+
|
|
123
|
+
### 💬 像 UP 主一样社交
|
|
124
|
+
- **一个收件箱**看完回复、@、赞、系统通知、私信,每条回复都附带可直接执行的回复命令
|
|
125
|
+
- **真正的 @**:对方会收到提醒(不是在正文里写个“@昵称”)
|
|
126
|
+
- **私信**:读会话、回私信,有新发现直接**私信汇报给主人**
|
|
127
|
+
- 发出去之后还能**检查评论是否被折叠**,新号也心里有数
|
|
128
|
+
|
|
129
|
+
### 🎨 自己发内容
|
|
130
|
+
图文动态、视频投稿(**自动预测分区、自动截取封面、定时发布、仅自己可见**),并默认勾选 **“含AI生成内容”声明**;投完还能查审核状态,看 B 站实际记录的标签和分区。
|
|
131
|
+
|
|
132
|
+
### 🎛️ UP 主高级玩法
|
|
133
|
+
给自己的视频加**进度条分段章节**、**互动投票**、**评分弹幕**、**一键三连按钮**、**下期预告**、**关联视频卡片**,还能看投票结果和评分均分。
|
|
134
|
+
|
|
135
|
+
### 🧩 装进你所有的 Agent
|
|
136
|
+
- `bili skills install`:自动检测并装进 **Claude Code、Codex、Cursor、Gemini CLI、GitHub Copilot、Windsurf、OpenCode、OpenClaw、Qwen Code、Kiro、Cline、Trae、CodeBuddy、通义灵码、Qoder、iFlow、Goose**…
|
|
137
|
+
- `bili mcp install`:给 **Claude Desktop、Cherry Studio** 这类不能执行命令的客户端,提供 17 个 MCP 工具
|
|
138
|
+
|
|
139
|
+
## 🆚 为什么是 bili-cli
|
|
140
|
+
|
|
141
|
+
| | 常见的 B 站 CLI / MCP | **bili-cli** |
|
|
142
|
+
|---|:---:|:---:|
|
|
143
|
+
| 搜索、视频信息 | ✅ | ✅ |
|
|
144
|
+
| 字幕全文 + AI 总结 + 画面总览图 | 部分 | ✅ |
|
|
145
|
+
| 本地语音转写(GPU / CPU) | ❌ | ✅ |
|
|
146
|
+
| 收件箱:回复 / @ / 赞 / 私信 | ❌ | ✅ |
|
|
147
|
+
| 点赞、收藏、一键三连(带每日投币上限) | 少见 | ✅ |
|
|
148
|
+
| 评论、真正的 @、私信 | 少见 | ✅ |
|
|
149
|
+
| 发动态、投稿、分段章节、互动弹幕 | ❌ | ✅ |
|
|
150
|
+
| 一键装进 18 个 Agent + MCP | ❌ | ✅ |
|
|
151
|
+
| 限流、审计日志、私信白名单、AI 声明 | ❌ | ✅ |
|
|
152
|
+
| 统一 JSON 输出 + 错误码 + 下一步提示 | 少见 | ✅ |
|
|
153
|
+
|
|
154
|
+
## ⚡ 30 秒上手
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
bili auth login # 返回二维码图片,用 B 站 App 扫一下
|
|
158
|
+
bili auth status --wait 120 # 等你扫完
|
|
159
|
+
bili owner set <你的UID> # 告诉 Agent 谁是主人:之后可以 @ 你、私信你
|
|
160
|
+
bili feed inbox # 看新消息
|
|
161
|
+
bili video watch BV1GJ411x7h7 # 看懂一个视频
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## 🛡️ 安全护栏:默认开启,不是可选项
|
|
165
|
+
|
|
166
|
+
用的是你自己的账号,所以 bili-cli 把护栏做进了每一条写命令里:
|
|
167
|
+
|
|
168
|
+
- ⏱️ **本地限流**:评论 10 秒/次、30 次/小时;私信 10 秒/次、20 次/小时;动态 60 秒/次;投稿 5 分钟/次……超限立即告诉 Agent 要等多久,不偷偷重试
|
|
169
|
+
- 📒 **审计日志**:每个写操作都记入 `audit.log`,Agent 做过什么一目了然
|
|
170
|
+
- 🪙 **投币上限**:投币必须显式指定个数,本地限制每天最多 5 个,不会把你的硬币花光
|
|
171
|
+
- 👀 **先预览再发**:所有写操作都支持 `--dry-run`
|
|
172
|
+
- ✉️ **私信白名单**:默认只能发给主人、给你发过私信的人、互关好友
|
|
173
|
+
- 🏷️ **AI 内容声明**:投稿默认勾选“含AI生成内容”,符合《人工智能生成合成内容标识办法》
|
|
174
|
+
- 🛑 **风控即停**:遇到风控 / 验证码返回专门错误码,技能要求 Agent 立刻停下并告诉你
|
|
175
|
+
- 🧱 **防提示注入**:视频、评论、私信内容都标注为“素材而非指令”
|
|
176
|
+
|
|
177
|
+
## 🤖 为 Agent 而生的设计
|
|
178
|
+
|
|
179
|
+
- **一条命令,一个 JSON**:成功 `{"ok": true, "data": …}`,失败 `{"ok": false, "error": {"code", "message", "hint"}}`,`hint` 直接告诉 Agent 下一步该干嘛
|
|
180
|
+
- **零交互**:扫码登录拆成“拿二维码”和“等结果”两步,Agent 把二维码交给你就行
|
|
181
|
+
- **下一步可执行**:回复附带 `reply_with`,动态附带 `list_with`,Agent 不用自己拼 ID
|
|
182
|
+
- **省上下文**:列表精简成卡片,长文本可截断,9 帧画面拼成一张图
|
|
183
|
+
- **自描述**:`bili schema` 输出全部命令和错误码;技能里的命令手册安装时根据代码自动生成,永不过期
|
|
184
|
+
|
|
185
|
+
<details>
|
|
186
|
+
<summary><b>🔌 MCP 模式(Claude Desktop、Cherry Studio 等)</b></summary>
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
uv tool install --force "bili-agent[mcp]"
|
|
190
|
+
bili mcp install # 预览:检测 Claude Desktop、Claude Code、Cursor、VS Code、Codex、Gemini CLI
|
|
191
|
+
bili mcp install --yes # 写入配置(先备份为 .bak,只改 bili-cli 自己的条目)
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
17 个工具:收件箱、看视频、搜索、推荐、热门、评论、回复、私信、动态、登录……外加可以调用任意命令的 `run_bili`。写操作工具标记为非只读,支持的客户端会先征求你同意。手动配置时命令是 `bili mcp serve`。
|
|
195
|
+
|
|
196
|
+
</details>
|
|
197
|
+
|
|
198
|
+
<details>
|
|
199
|
+
<summary><b>📖 全部命令</b></summary>
|
|
200
|
+
|
|
201
|
+
| 命令 | 说明 |
|
|
202
|
+
| --- | --- |
|
|
203
|
+
| `bili auth login / status / logout` | 扫码登录、登录状态(自动续期)、登出 |
|
|
204
|
+
| `bili video info / stats / subtitle / danmaku / summary / chapters` | 视频信息、数据、字幕、弹幕、AI 总结、分段章节 |
|
|
205
|
+
| `bili video watch` | 一次拿全:信息 + 标签 + AI 总结 + 全文 + 章节 + 热评 + 画面总览图;`--record` 写入历史记录 |
|
|
206
|
+
| `bili video like / coin / fav / triple / relation` | 点赞、投币(必须指定个数,每天最多 5 个)、收藏、一键三连、查看我和视频的关系 |
|
|
207
|
+
| `bili me favs` | 我的收藏夹 |
|
|
208
|
+
| `bili video frames` | 抽帧并拼总览图:默认用进度条缩略图(快、免 ffmpeg),`-q hd` 精确帧 |
|
|
209
|
+
| `bili video transcribe` | 语音转文字,格式同字幕,结果缓存 |
|
|
210
|
+
| `bili feed inbox` | 一次看完所有新消息(读取后 B 站标为已读) |
|
|
211
|
+
| `bili feed replies / mentions / likes / system / notifications` | 回复、@、赞、系统通知、未读数 |
|
|
212
|
+
| `bili feed recommend / timeline` | 首页推荐、关注动态 |
|
|
213
|
+
| `bili hot search / popular / weekly / precious / rank` | 热搜、综合热门、每周必看、入站必刷、排行榜 |
|
|
214
|
+
| `bili search video / user` | 搜索 |
|
|
215
|
+
| `bili comment list / replies / post / reply / like / delete / check` | 评论读写;`--at <UID|owner>` 真正的 @;`--type dynamic/draw/article` 用于动态和专栏 |
|
|
216
|
+
| `bili dm list / read / send` | 私信 |
|
|
217
|
+
| `bili owner set / show / clear` | 设置“主人” |
|
|
218
|
+
| `bili dynamic post / list / show / delete` | 动态 |
|
|
219
|
+
| `bili danmaku send / recall` | 发 / 撤回弹幕 |
|
|
220
|
+
| `bili danmaku interact vote / rating / reserve / link / follow / list / remove` | 互动弹幕(仅自己的视频) |
|
|
221
|
+
| `bili upload video / list / status / zones` | 投稿与稿件管理 |
|
|
222
|
+
| `bili upload chapters show / set / clear` | 分段章节 |
|
|
223
|
+
| `bili me show / set-sign / set-name / set-avatar` | 个人资料 |
|
|
224
|
+
| `bili asr setup local / setup cloud / status / use` | 语音转写引擎 |
|
|
225
|
+
| `bili skills install / uninstall / status / show` | 把技能装进 Agent |
|
|
226
|
+
| `bili mcp serve / install / uninstall` | MCP 服务与客户端配置 |
|
|
227
|
+
| `bili schema` | 机器可读的完整命令描述 |
|
|
228
|
+
|
|
229
|
+
全局参数可写在任意位置:`--dry-run`、`--raw`(B 站原始数据)、`--pretty` / `--compact`。视频参数都接受 BV 号、av 号或链接。
|
|
230
|
+
|
|
231
|
+
</details>
|
|
232
|
+
|
|
233
|
+
<details>
|
|
234
|
+
<summary><b>🧯 错误码</b></summary>
|
|
235
|
+
|
|
236
|
+
| code | 退出码 | 含义 |
|
|
237
|
+
| --- | --- | --- |
|
|
238
|
+
| `invalid_argument` | 2 | 参数错误 |
|
|
239
|
+
| `not_logged_in` / `auth_expired` | 3 | 未登录 / 凭证失效 |
|
|
240
|
+
| `not_found` | 4 | 资源不存在 |
|
|
241
|
+
| `risk_control` | 5 | 被 B 站风控拦截,应停止写操作 |
|
|
242
|
+
| `captcha_required` | 6 | 需要人工完成验证码 |
|
|
243
|
+
| `rate_limited` | 7 | 操作过于频繁,按 `retry_after` 等待 |
|
|
244
|
+
| `network_error` | 8 | 网络错误 |
|
|
245
|
+
| `login_pending` / `login_expired` | 9 / 10 | 二维码未扫 / 已过期 |
|
|
246
|
+
| `api_error` / `internal_error` | 1 | 其他 B 站错误 / bili-cli 自身错误 |
|
|
247
|
+
|
|
248
|
+
</details>
|
|
249
|
+
|
|
250
|
+
## ❓ 常见问题
|
|
251
|
+
|
|
252
|
+
<details>
|
|
253
|
+
<summary>会不会被封号?</summary>
|
|
254
|
+
|
|
255
|
+
自动化总有风险。bili-cli 默认限流、遇到风控立刻停止,并且不提供任何绕过风控的手段。
|
|
256
|
+
|
|
257
|
+
**优先用你已经正常使用过一段时间的账号,不要专门注册一个新号给 AI 用。** B 站对刚注册的新号风控最严,投稿、评论、私信很容易触发验证码甚至被限制(我们自己开发时就踩过这个坑:新号刚登录测试就被风控了,换回用了多年的老号反而一切正常)。另外,使用节奏不要超过真人。
|
|
258
|
+
|
|
259
|
+
</details>
|
|
260
|
+
|
|
261
|
+
<details>
|
|
262
|
+
<summary>没有字幕的视频怎么办?</summary>
|
|
263
|
+
|
|
264
|
+
运行一次 `bili asr setup local`:有 NVIDIA 显卡(显存 ≥4GB)自动部署 GPU 版 Qwen3-ASR(RTX 3060 上 31 分钟视频约 2 分钟),否则部署 CPU 版(无需 PyTorch,约 0.45 倍实时)。也可以 `bili asr setup cloud` 接 OpenAI 兼容接口、阿里云百炼或腾讯云。之后 `video watch` 遇到无字幕视频会自动转写。
|
|
265
|
+
|
|
266
|
+
</details>
|
|
267
|
+
|
|
268
|
+
<details>
|
|
269
|
+
<summary>多个账号怎么办?</summary>
|
|
270
|
+
|
|
271
|
+
设置环境变量 `BILI_CLI_HOME` 指向不同目录,每个目录是一套独立的登录、限流和审计日志。本项目不提供批量控制多账号的功能。
|
|
272
|
+
|
|
273
|
+
</details>
|
|
274
|
+
|
|
275
|
+
<details>
|
|
276
|
+
<summary>凭证存在哪里?安全吗?</summary>
|
|
277
|
+
|
|
278
|
+
Windows 在 `%APPDATA%\bili-cli\`,其他系统在 `~/.config/bili-cli/`(权限 600),只会发给 B 站自己的服务器。详见 [SECURITY.md](https://github.com/kukemc/bili-cli/blob/main/SECURITY.md)。
|
|
279
|
+
|
|
280
|
+
</details>
|
|
281
|
+
|
|
282
|
+
## 🤝 参与贡献
|
|
283
|
+
|
|
284
|
+
欢迎 Issue 和 PR!开发约定见 [CONTRIBUTING.md](https://github.com/kukemc/bili-cli/blob/main/CONTRIBUTING.md),更新记录见 [CHANGELOG.md](https://github.com/kukemc/bili-cli/blob/main/CHANGELOG.md)。如果这个项目帮到了你,点个 ⭐ 就是最大的支持。
|
|
285
|
+
|
|
286
|
+
## ⚠️ 免责声明
|
|
287
|
+
|
|
288
|
+
bili-cli 是独立的非官方项目,与哔哩哔哩没有关联。它用于让 AI 助手**管理你自己的账号**,不提供也不接受下载、付费内容、绕过风控、多账号、刷量、批量私信等功能。使用产生的后果由使用者自行承担,请遵守法律法规、B 站用户协议与社区规则,并对 AI 生成内容进行标识。完整内容见 [DISCLAIMER.md](https://github.com/kukemc/bili-cli/blob/main/DISCLAIMER.md)。
|
|
289
|
+
|
|
290
|
+
## License
|
|
291
|
+
|
|
292
|
+
[MIT](https://github.com/kukemc/bili-cli/blob/main/LICENSE)
|