Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ content.db
# adapter 跑过留下的
.auth/
.auth-xhs/
.auth-wechat-channels/
.auth-bilibili/
.debug/

# Editor / IDE
Expand Down
24 changes: 15 additions & 9 deletions adapters/perf-data/bilibili-stat/README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
# bilibili-stat — B站 perf-data adapter

回收**自己(或任意)B站视频**的播放数据 + 热门评论,供 `/cheat-retro` 复盘。
回收**自己(或任意)B站视频**的播放数据、热门评论和弹幕文本,供 `/cheat-retro` 复盘。

被 `/cheat-retro` 调用:当 `state.data_collection=adapter` 且 `Platform: bilibili` 时。

## 为什么它比抖音/小红书 adapter 简单

B站的视频统计(`view`)与评论(`reply`)都是**公开接口**
B站单条视频统计、评论和弹幕是公开数据

- 不需要登录(没有 `crawler.py login` 步骤、不碰 `.auth/`)
- 不需要 wbi 签名(`view` 接口免签名;评论走 `x/v2/reply` 老接口,按热度 `sort=2`)
- 不需要浏览器(纯 `httpx`,无 playwright)
- 单条复盘不需要登录
- 自动读取自己空间的作品列表需要扫码登录一次
- 不需要第三方 Python 包,使用标准库

所以 **clone 下来装个 `httpx` 就能用**,零配置。
所以 clone 下来即可使用,零配置。

## 安装

单条视频复盘只使用 Python 标准库。自动读取空间投稿列表需要 Playwright:

```bash
pip install -r requirements.txt
playwright install chromium
```

(若你的内容项目根有 `.venv`,run.sh 会优先用它;否则用系统 `python3`/`python`。)
`run.sh` 会优先使用项目 `.venv`,兼容 Windows 与 macOS/Linux。

## 用法

Expand All @@ -37,8 +40,9 @@ bash run.sh <bvid_or_url> <video_folder> [<script_path>]
也可直接调底层:

```bash
python review.py login <space_mid> # 首次登录,状态保存到 .auth-bilibili/
python review.py list <space_mid> # 自动列出最近 20 条及 BV 号
python review.py video BV1cUoUY9Ecr # 抓数据 → 写 videos/<auto>/report.md
python review.py login # B站无需登录,仅打印说明(接口一致性)
```

## 输出(report.md)
Expand All @@ -49,19 +53,21 @@ python review.py login # B站无需登录,仅打印说
- **播放数据**:播放、点赞、投币、收藏、分享、评论、弹幕,并附派生比率(赞播比 / 投币率 / 收藏率 / 分播比)——B站「三连率」尤其能反映硬核认可度
- 原始稿子(若提供)
- **热门评论**(按点赞降序,带 IP 属地)
- **弹幕文本**(带视频时间点,最多 100 条)

## 接口

| 数据 | 接口 |
|---|---|
| 视频统计 | `GET https://api.bilibili.com/x/web-interface/view?bvid=<BV号>` |
| 评论 | `GET https://api.bilibili.com/x/v2/reply?type=1&oid=<aid>&sort=2&pn=&ps=20` |
| 弹幕文本 | `GET https://api.bilibili.com/x/v1/dm/list.so?oid=<cid>` |

`oid` 取自 view 接口返回的 `aid`。评论按热度(`sort=2`)翻页,默认取 top 50。

## 退出码

`0` 成功 · `2` 缺依赖(httpx 未装)· `3` 其他失败(网络 / 解析 / BV 号错误)。任何失败时 `/cheat-retro` 会优雅降级到 manual 模式。
`0` 成功 · `2` 缺少 Python/Playwright · `3` 其他失败(网络 / 解析 / BV 号错误)。任何失败时 `/cheat-retro` 会优雅降级到 manual 模式。

## 字段随接口改版的维护

Expand Down
Loading