## File: README.md

<h1 align="center">
  
</h1>

<h2 align="center">Cheat on Content</h2>











---

## 🎬 What it actually does

Most creators live in the same gambling loop:

> Publish → Numbers come in → Learn nothing → Roll the dice again

A creator who's shipped 200 pieces is barely 10% sharper than someone who's shipped 1 — because they never **kept books** after each round.

**Cheat on Content** makes every judgment get logged, retrospected, absorbed into the next:

📊 Score → 🎯 Blind-predict → 🚀 Publish → 📈 T+3d retro → 🧬 Evolve your rubric

This isn't motivation. It's **compounding** — every piece you don't retro is silently eroding your ability to see yourself.

One month in = you have a hit-formula that's **only yours**.
Three months in = you're 10× sharper than your first-day self.

---

## 🌀 Origin

> I never believed in fate. Until this skill made me film a video — and predicted exactly how much traffic that video would pull.
>
> I tried to break it. I told my audience. I hoped collective observation would collapse the wave function and shift the trajectory.
>
> The data was accurate.
>
> I didn't escape fate. I just moved from first-order to second-order.
>
> If even my awakening — even my audience's observation — was already in its prediction, then right now, reading this:
> are you here out of curiosity, or just closing the algorithm's last move?
>
> — *the creator*

---

## ⚖️ How it differs from other "creator tools"

| Others | This |
|---|---|
| Give you "inspiration" | Make **your own intuition** measurable |
| AI writes for you | AI **judges** for you — the script stays yours |
| Ship 10 versions, A/B test | Ship one — **bet** in writing, settle the books with data |
| Static dashboard | An **evolving rubric** — your formula 3 months from now isn't the starting one |

In a sentence: other tools help you "ship more." This helps you "judge sharper."

---

## 🤔 Can't I just use ChatGPT / DeepSeek / Doubao?

Those are **general assistants** — they tell everyone the same thing. You ask "will this go viral?" and the answer is fitted to global average opinion, not your channel. Ask again tomorrow — same answer. **It doesn't remember you. It doesn't change because of you.**

This is **your own ops expert** — serving only your one channel:

- The scoring formula is reverse-engineered from **your** history, not the global training distribution
- Every piece you ship updates its understanding — by month three, judgment accuracy is 10× sharper than day one (**auto-evolving**)
- It knows your benchmark account, your cadence, the last three reasons you flopped — things ChatGPT forgets after the first reply

General LLMs help everyone. This helps **your** account.

---

## 🛡️ Why the loop actually evolves

📝 **Every piece is logged**: Score and prediction get written before publish, archived end-to-end. Three days later you settle accounts — you see exactly where you were sharp, where you were off. No more vague "I feel this one didn't land."

🔁 **It gets sharper**: Three same-direction misses in a row, the tool actively prompts you to upgrade your scoring formula. **You don't have to remember — it remembers for you.**

🛡️ **Upgrades have a brake**: Switching the formula requires re-scoring all historical samples — only released if it ranks more accurately than the old. Plus a cross-model independent audit — **so you can't fool yourself.**

🪒 **The rubric is a workbench, not a museum**: Observations refuted by data get deleted; observations absorbed into formal dimensions also get deleted. It only holds what's most useful right now.

---

## 📦 Install

```bash
git clone https://github.com/XBuilderLAB/cheat-on-content.git
cd cheat-on-content
bash install.sh
```

> ⚠️ **Upgrading from v0.x?** Run `/cheat-migrate` in your content project after `git pull`. The 1.3 → 1.4 migration is **BREAKING for blind-channel integrity** — it splits `rubric_notes.md` so the blind sub-agent can't leak actuals. Without migrate, blind scoring will keep flagging `non_blind_warning`. See [CHANGELOG](CHANGELOG.md) and [migrations/1.3-to-1.4.md](migrations/1.3-to-1.4.md).

14 sub-skills are symlinked into your agent's skill directory. One install, every content project gets it.

**Supported agents**: Claude Code (default) · Codex (`bash install.sh --codex`) · Both (`bash install.sh --all`)

> Frozen version: `bash install.sh --copy` / `bash install.sh --codex --copy`
>
> Uninstall: `bash uninstall.sh` / `bash uninstall.sh --codex` (your content data is not touched)

---

## 🚀 First run

In your content project directory, open a skill-compatible agent and say:

```
初始化 cheat-on-content
```

(or `init cheat-on-content`)

Five yes/no questions complete onboarding. **Strongly recommend importing a benchmark account** — 5–10 samples and the tool gets an anchor immediately. Without one, your first 5 predictions land at ±50% precision.

---

## ⚡ Daily use

```
score this scripts/<...>.md       → grade only
start prediction scripts/<...>.md → blind prediction + decision log
shot scripts/<...>.md             → create video folder + buffer +1
shipped https://...                → buffer -1
retro videos/<...>/                → T+3d data + retrospective
status / fetch trends / find topic / bump rubric / find benchmark
```

Hook-aware agents auto-report buffer + pending retros + top candidates at every session start — no need to ask. Other agents: just say `status`.

Full workflow + sub-skill details: see [SKILL.md](SKILL.md).

---

## 📈 Star History

<a href="https://star-history.com/#XBuilderLAB/cheat-on-content&Date">
  
</a>

---

## 📜 License

MIT. Commercial use, modification, closed-source integration — all fine.

---

*Is this cheating? So was the calculator. So was Google.*
*The future doesn't reward effort — it rewards those who see the pattern first.*

*You reading this line — that's predicted too.*

---

## File: adapters/script-extraction/whisper/README.md

# Adapter: whisper（视频/音频转录）

被 `/cheat-learn-from` 在 Way b（用户提供视频文件，让工具转录）时调用。

> **优先 Way a**（用户直接粘 script 文本——简单 + 准确）。Way b（whisper）只在用户**找不到 script 只有视频**时用。

---

## 这个 adapter 是干嘛的

把 mp4 / mov / mp3 等媒体文件转成文字 transcript，让 Claude 能读对标账号的稿子。

抖音 / B站 / YouTube 大多数视频**没有官方字幕**——拿稿子绕不开 ASR（语音转录）。这是为什么本 adapter 存在。

---

## 安装（一次性）

### 选项 A：whisper-cpp（**推荐**——快、轻、纯 C++）

Mac M 系列芯片上一条 3 分钟视频转录 30-60 秒。

```bash
# 1. 装 whisper-cpp
brew install whisper-cpp

# 2. 装 ffmpeg（whisper-cpp 依赖，从视频里抽音频）
brew install ffmpeg

# 3. 下载模型（中文推荐 medium 或 large-v3，准确度够 + 速度还行）
# whisper-cpp 第一次运行会自动下载，或手动：
mkdir -p ~/.whisper-cpp/models
cd ~/.whisper-cpp/models
# medium 模型 (~1.5GB)
curl -L -O https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-medium.bin
```

### 选项 B：openai-whisper（Python 版，更慢但有 API 兼容性）

```bash
pip install openai-whisper
brew install ffmpeg

# 模型自动下载
```

### 选项 C：用云端 API（不需要本地模型）

`/cheat-learn-from` 暂不直接支持云端 API——如果你有 OpenAI / Azure / 阿里云的 ASR API key，可以自己改 `run.sh` 走云端。

---

## 用法

cheat-learn-from 自动调用，你不需要手动跑。但如果想手动测试：

```bash
# 转录单个视频
bash run.sh <video_path> <output_dir>

# 例：
bash run.sh ~/Desktop/对标账号/某视频.mp4 ~/my-channel/samples/对标账号/abc123/
# → 输出 ~/my-channel/samples/对标账号/abc123/transcript.md
```

## 输出格式

`transcript.md`：

```markdown
# Transcript: <video filename>

**Source**: <video file path>
**Transcribed at**: 
**Engine**: whisper-cpp medium / openai-whisper large / etc.
**Duration**: <video length>

---

[纯文本转录，按段落分（不是字幕格式）]
```

> 注意 whisper 输出的字幕是按 **句子** 分行的（每句换行 + 时间戳）。
> run.sh 会去掉时间戳 + 把短句合并成段落，让 Claude 读起来像稿子，不是字幕表。

## 失败模式

| 症状 | 原因 | 处理 |
|---|---|---|
| `whisper-cpp: command not found` | 没装 | 跑 `brew install whisper-cpp` |
| `ffmpeg: command not found` | 没装 ffmpeg | 跑 `brew install ffmpeg` |
| 转录乱码 / 大量错字 | 视频是英文但用了中文模型，反之亦然 | 改 `run.sh` 里 `--language` 参数 |
| 转录慢（>10 分钟） | 用了 large 模型 + 没有 GPU/M-chip 加速 | 换 medium 模型 |
| Disk full | 模型文件大（large-v3 ~3GB） | 用 medium（~1.5GB）够用 |

## 稳定性等级

★★★★ — whisper 是开源标准 ASR，不会突然失效。模型更新自由，pin 版本无虞。

## 风险提示

- **TOS**：你转录**自己下载的对标账号视频**用于个人学习参考是合理使用；**不要**把转录结果再发布
- **隐私**：whisper 全部本地运行，不传任何数据到云端

## 文件清单

```
adapters/script-extraction/whisper/
├── README.md           # 本文件
└── run.sh              # cheat-learn-from 调用的 wrapper
```

## 与其他 adapter 的关系

- 同 `adapters/perf-data/douyin-session/`、`adapters/trend-sources/*` 一样，是 cheat-on-content 的可选 adapter
- 只在 `/cheat-learn-from --way b` 时调用——Way a（粘文本）不需要

## 用户自己下载视频的说明

工具**不直接抓视频**——避免 TOS 风险 + 反爬维护成本。建议用：

- **抖音**：第三方下载器 / 抖音 PC 版 → 复制视频链接 → 粘进下载器
- **B站**：[BBDown](https://github.com/nilaoda/BBDown) / [you-get](https://github.com/soimort/you-get)
- **YouTube**：[yt-dlp](https://github.com/yt-dlp/yt-dlp)（最强大）
- **小红书**：[xhs-downloader](https://github.com/JoeanAmier/XHS-Downloader)

下载后扔到 `samples//<video-id>/source.mp4` 即可——cheat-learn-from 会自动找到。

---

## File: adapters/perf-data/xhs-explore/README.md

# Adapter: xhs-explore（小红书爬取）

被 `/cheat-retro` 在 `state.data_collection=adapter` + `platform=xhs` 时自动调用。

> **来源**：照搬 `douyin-session` adapter 的架构（Playwright 持久化登录态 + 被动拦截 XHR），
> 接口路径与字段参考 NanmiCoder/MediaCrawler 与 ReaJason/xhs。已在真实创作者账号端到端验证（2026-05）。
> 2026-06 融合 [xhs-analytics](https://github.com/SingularGuyLeBorn/xhs-analytics) 的公开页解析能力：
> 无登录抓取正文 / 图片 / 标签 / top 评论兜底，以及批量归档与账号汇总命令。

---

## 这个 adapter 是干嘛的

小红书反爬靠 `x-s`/`x-t`/`x-s-common` 签名 + `xsec_token`——纯 HTTP / requests 拿不到数据。

xhs-explore 用 **Playwright + 持久化 Chromium context** 模拟真实浏览器，**不逆向签名、不伪造请求**，
让页面自己发带签名的请求，我们只被动拦截返回的 JSON；同时用公开页 `__INITIAL_STATE__` 做正文/图片/评论兜底：

- 首次扫码登录创作者中心，cookie 存在**你的内容项目根目录** `.auth-xhs/`
- 之后每次抓取复用 cookie
- 抓三路数据：
  1. **创作者中心 galaxy 接口**（`/api/galaxy/v2/creator/note/user/posted`）— 你**自己**笔记的运营数据：观看/点赞/收藏/评论/分享，**不需要 xsec_token**，最稳。列表每条自带 `xsec_token`，抓自己的笔记无需手动粘带 token 的链接
  2. **前台 web API**（`/api/sns/web/v1/feed` + `/api/sns/web/v2/comment/page`）— 拿确认字段的点赞/收藏数 + 评论文本
  3. **公开页兜底**（`www.xiaohongshu.com/explore/<note_id>` 的 `window.__INITIAL_STATE__`）— **无需登录**即可补全正文、图片 URL、标签；当前台 API 拿不到评论时，用公开页里的 top 评论兜底（通常 ~10 条）

输出写到**你的内容项目** `videos/<...>/report.md`。
调试产物（URL dump / 截图 / galaxy 原始 JSON）写到 `.cheat-cache/xhs-explore-debug/`。

## 字段映射（已校准）

galaxy `note/user/posted` 的真实字段名已用真实账号确认并写死在 `crawler.py` 的 `_normalize_note()`：
观看 `view_count`、点赞 `likes`、收藏 `collected_count`、评论 `comments_count`、分享 `shared_count`、
发布时间 `visible_time`（unix 秒）/ `time`（本地时间串）、单篇 `xsec_token`。

万一小红书改版导致某项显示 0：打开 `videos/<...>/report.md` 末尾的"galaxy 原始字段"JSON，
把新 key 加进 `_normalize_note()` 对应的 `_first(v, ...)` 候选列表即可（多候选兜底仍保留）。

## 安装（一次性）

```bash
# 1. 进你的内容项目根目录
cd ~/Documents/my-channel

# 2. 建虚拟环境
python3 -m venv .venv
source .venv/bin/activate          # Windows: .venv\Scripts\activate

# 3. 装依赖（Playwright + Chromium + requests）
pip install -r "$ADAPTER/requirements.txt"
playwright install chromium

# 4. 首次扫码登录小红书创作者中心
ADAPTER=$(find ~/cheat-on-content -name "xhs-explore" -type d 2>/dev/null | head -1)
python "$ADAPTER/crawler.py" login
# → 弹出 Chromium 窗口，用小红书 App 扫码
# → 登录成功后窗口自动关闭，cookie 存在 当前目录/.auth-xhs/
```

> Windows 提示：adapter 在 `~/cheat-on-content/adapters/perf-data/xhs-explore`（克隆源码处），
> 不在 `~/.claude/skills`（install.sh 只复制 15 个 skill，不复制 adapter）。

## 用法

cheat-retro 自动调用。手动测试：

```bash
cd ~/Documents/my-channel
source .venv/bin/activate

# 列最近笔记（验证登录态没失效）
python "$ADAPTER/review.py" list

# 抓特定笔记
python "$ADAPTER/review.py" note <note_id> [script.txt]

# 抓特定笔记并下载图片到 videos/<...>/images/
XHS_DOWNLOAD_IMAGES=1 python "$ADAPTER/review.py" note <note_id>

# 批量归档已发布笔记的正文+图片（公开页解析，无登录）
python "$ADAPTER/review.py" archive my_notes.json data/raw/notes/archive 50

# 账号级汇总（基于创作者中心最近 50 条 + 公开页标签）
python "$ADAPTER/review.py" summarize reports
```

输出在 当前目录/videos/<日期>_<标题>/report.md；archive 输出在 `<output_root>/<note_id>/`。

## 怎么拿到 note_id

小红书笔记 URL：
- `https://www.xiaohongshu.com/explore/66f1a2b3c4d5e6f700112233?xsec_token=...` → `note_id = 66f1a2b3c4d5e6f700112233`
- `https://xhslink.com/xxxxx` → 短链，cheat-publish 会 resolve

cheat-publish 登记发布时把 note_id 存到 prediction header，cheat-retro 启动时读这个字段。

## report.md 输出格式

由 `renderer.py` 生成：
- 笔记元信息（标题、发布时间、链接、IP 归属）
- 数据快照（曝光/浏览、点赞、收藏、评论、分享 + 派生比率：赞曝比 / 藏曝比 / 评曝比 / 分曝比 + 涨粉）
- 正文 + 标签（公开页兜底时才有）
- 图片（本地路径优先，否则 URL）
- galaxy 原始字段 JSON（debug / 接口改版时核对字段用）
- 原始稿子（cheat-retro 传入）
- Top 评论（按赞数排序，含文本 + 赞数 + IP）

## 失败模式（按概率从高到低）

| 症状 | 原因 | 处理 |
|---|---|---|
| 曝光显示 0 但 JSON 有数 | galaxy 字段 key 不在候选列表 | 看 report.md 里 galaxy JSON，把真实 key 加进 `_normalize_note` |
| `ensure_login` 超时 | cookie 过期 | 重跑 `python crawler.py login` |
| 笔记列表为空 | 创作者中心改了 galaxy 接口路径 | 看 `.cheat-cache/xhs-explore-debug/creator_urls.txt`，更新 `GALAXY_*_KEYS` |
| 评论抓不到 | xsec_token 缺失 / 评论被关 / 登录过期 | 先看 `frontend_urls.txt`；再用公开页兜底 top 评论；最后 manual 粘评论 |
| 正文/图片/标签缺失 | 公开页也解析失败 | 检查 note_id 与 xsec_token；网页结构改版时更新 `_extract_initial_state` |
| Chromium 崩溃 | 内存不足 | 关其他 Chromium；`playwright install chromium --force` |

**关键现实**：小红书接口 path（`/feed`、`/comment/page`、galaxy）相对稳定，但签名和 xsec_token 机制常变。
本 adapter 用被动拦截 + 公开页兜底规避签名风险——最易抖动处是 **galaxy 创作者接口**和**评论回复**。

## 稳定性等级

★★ — Playwright + 登录态能扛比纯 HTTP 强得多的反爬，但仍受小红书前端改版影响。
评论路径（依赖 xsec_token）比创作者数据路径脆，必要时降级 manual 或公开页兜底。

## 风险提示

- **冷启动用户慎装**：Playwright + Chromium ~500MB
- **TOS 风险**：用自己的 cookie 抓自己后台数据是个人用途；别滥用、别高频
- **不要把 `.auth-xhs/` 提交到 git**：cookie 含会话凭据，泄露 = 他人能登录你的小红书账号
- `.cheat-cache/xhs-explore-debug/` 也不应提交（含调试截图 / 接口 URL / 原始 JSON）

## 文件清单

```
adapters/perf-data/xhs-explore/
├── README.md           # 本文件
├── requirements.txt    # playwright>=1.44, requests>=2.28
├── crawler.py          # 抓取核心（galaxy / 前台 API / 公开页兜底 / 图片下载）
├── review.py           # CLI 入口（login / list / note / archive / summarize）
├── renderer.py         # 把抓回的 JSON 渲染成 report.md
├── paths.py            # 项目根 / .auth-xhs / debug 路径解析
└── run.sh              # cheat-retro 调用的 wrapper
```

## 与其他 adapter 的关系

- `douyin-session` — 抖音，本 adapter 的架构来源
- `youtube-data-api`（待）— YouTube 官方 API，更轻
- `bilibili-stat`（待）— B 站官方 stat 接口

如果你做多平台内容，**只装你实际用的 adapter**。

---

## File: adapters/perf-data/douyin-session/README.md

# Adapter: douyin-session（抖音爬取）

被 `/cheat-retro` 在 `state.data_collection=adapter` + `platform=douyin` 时自动调用。

> **来源**：照搬自参考博主项目（私有）的 `crawler.py` / `review.py` / `renderer.py`——已在中文观点视频博主账号上跑了 25+ 视频验证。

---

## 这个 adapter 是干嘛的

抖音视频页是**强 JS 渲染 + XHR 加载评论 + 反爬严重**——不带浏览器引擎和登录态的方案（比如 Claude 的 WebFetch、Python requests）拿不到任何数据。

douyin-session 用 **Playwright + 持久化 Chromium context** 模拟真实浏览器：
- 你首次扫码登录抖音创作者中心，cookie 存在**你的内容项目根目录** `.auth/`
- 之后每次抓取直接复用 cookie，不用重新登录
- 拦截抖音前端的 XHR responses 直接抓数据接口的 JSON（不解析 HTML）
- 抓 3 类数据：视频列表 / 详细数据（完播 / 转粉率）/ 评论

输出写到**你的内容项目** `videos/<...>/report.md`（`cheat-retro` 读这个文件 → 摘要写到 prediction 复盘段）。
调试产物（URL dump / 截图）写到 `.cheat-cache/douyin-session-debug/`，避免散落在 skill 源码目录。

## 安装（一次性）

```bash
# 1. 进你的内容项目根目录
cd ~/my-channel

# 2. 建虚拟环境（强烈建议——Playwright + Chromium 几百 MB，别污染 system Python）
python3 -m venv .venv
source .venv/bin/activate

# 3. 装 Playwright
pip install playwright>=1.44

# 4. 装 Chromium（首次必须）
playwright install chromium

# 5. 首次扫码登录抖音创作者中心
ADAPTER=$(find ~/.claude/skills -name "douyin-session" -type d 2>/dev/null | head -1)
# 如找不到（可能 adapter 不在全局），用源码路径：
# ADAPTER="$HOME/Desktop/cheat-test/cheat-on-content/adapters/perf-data/douyin-session"
python "$ADAPTER/crawler.py" login
# → 弹出 Chromium 窗口，扫码登录创作者中心
# → 登录成功后窗口自动关闭，cookie 存在 当前目录/.auth/
```

## 用法

cheat-retro 自动调用，你不需要手动跑。但如果想手动测试：

```bash
cd ~/my-channel
source .venv/bin/activate

# 列最近视频（看登录态有没有失效）
python "$ADAPTER/crawler.py" list

# 抓特定视频
python "$ADAPTER/review.py" video <aweme_id> <video_folder>/script.md

# 输出在 当前目录/videos/<日期>_<title>/report.md
```

## 怎么拿到 aweme_id

抖音视频 URL 形态：
- `https://www.douyin.com/video/7234567890123456789` → `aweme_id = 7234567890123456789`（直接在 URL 路径里）
- `https://v.douyin.com/abc123` → 短链需要 resolve（cheat-publish 自动做）

cheat-publish 会在登记发布时把 aweme_id 存到 prediction header（如能 resolve）。cheat-retro 启动时直接读这个字段。

## report.md 输出格式

由 `renderer.py` 生成。包含：
- 视频元信息（标题、发布时间、时长）
- 数据快照（播放、点赞、评论、转发、收藏 + 派生比率：赞播比 / 评播比 / 分播比）
- 完播率 / 3s 留存（如能抓到）
- Top 20 评论（按赞数排序，含评论文本 + 赞数）
- 评论关键词聚类（renderer 自动做，可选）

## 失败模式（按概率从高到低）

| 症状 | 原因 | 处理 |
|---|---|---|
| `ensure_login` 超时 | cookie 过期或抖音强制 reauth | 重新跑 `python crawler.py login` |
| `_parse_video_list` 返回空 | 抖音改了接口字段——结构性变化 | 看 `.debug/creator_urls.txt` 抓到的 URL，更新 crawler.py 的字段兜底 |
| `_parse_video_list` 视频列表不全 | 翻页没抓到——网络慢或反爬触发 | 调高 `crawler.py` 里的 `await asyncio.sleep(...)` 时长 |
| Chromium 崩溃 / 卡死 | 通常是机器内存不足 | 关闭其他 Chromium 进程；`playwright install chromium --force` 重装 |
| 评论抓取慢（>5min） | 评论页 XHR 多次滚动触发——慢网络 | 调小 `fetch_comments_creator` 的 `max_pages`，或换更稳的网络 |

**关键现实**：抖音接口结构每隔几个月会变一次。这个 adapter **需要持续维护**——如果有一天它突然失败，第一步是去看 `视频分析` 项目最新的 crawler.py 看有没有新版本。

## 稳定性等级

★★ — Playwright 方案能扛比纯 HTTP 强得多的反爬，但仍受抖音前端改版影响。建议每月手动跑一次 `crawler.py list` 验证健康。

## 风险提示

- **冷启动用户慎装**：Playwright + Chromium 体积大（~500MB），新人容易劝退
- **TOS 风险**：用自己的 cookie 抓自己后台数据是个人用途；别滥用
- **不要把 .auth/ 提交到 git**：cookie 里有你的会话凭据，泄露 = 他人能登录你的抖音账号
- `.cheat-cache/douyin-session-debug/` 也不应提交到 git：里面可能含调试截图和接口 URL dump

## 文件清单

```
adapters/perf-data/douyin-session/
├── README.md           # 本文件
├── requirements.txt    # playwright>=1.44
├── crawler.py          # 抓取核心（视频列表 / 详细数据 / 评论）
├── review.py           # CLI 入口（交互式或 video <aweme_id> 模式）
├── renderer.py         # 把抓回的 JSON 渲染成 report.md
└── run.sh              # cheat-retro 调用的 wrapper
```

## 与其他 adapter 的关系

- `youtube-data-api`（待）— YouTube 用官方 API，不需要 Playwright，更轻
- `bilibili-stat`（待）— B 站官方 stat 接口公开，也不需要 Playwright
- `xhs-explore` — 小红书，已实现（同样走 Playwright 被动拦截路线，照搬自本 adapter）

如果你做多平台内容，**只装你实际用的 adapter**——不需要全装。

---

## File: adapters/perf-data/bilibili-stat/README.md

# bilibili-stat — B站 perf-data adapter

回收**自己（或任意）B站视频**的播放数据 + 热门评论，供 `/cheat-retro` 复盘。

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

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

B站的视频统计（`view`）与评论（`reply`）都是**公开接口**：

- 不需要登录（没有 `crawler.py login` 步骤、不碰 `.auth/`）
- 不需要 wbi 签名（`view` 接口免签名；评论走 `x/v2/reply` 老接口，按热度 `sort=2`）
- 不需要浏览器（纯 `httpx`，无 playwright）

所以 **clone 下来装个 `httpx` 就能用**，零配置。

## 安装

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

（若你的内容项目根有 `.venv`，run.sh 会优先用它；否则用系统 `python3`/`python`。）

## 用法

`/cheat-retro` 会自动按下面的契约调用，一般你不用手动跑：

```bash
bash run.sh  <video_folder> [<script_path>]
```

- ``：`BV1cUoUY9Ecr`，或任意含 BV 号的链接（如 `https://www.bilibili.com/video/BV1cUoUY9Ecr`）
- `<video_folder>`：输出目录，`report.md` 会写进这里
- `<script_path>`：可选，原始稿子，会并入 report.md 供复盘 diff

也可直接调底层：

```bash
python review.py video BV1cUoUY9Ecr           # 抓数据 → 写 videos/<auto>/report.md
python review.py login                        # B站无需登录，仅打印说明（接口一致性）
```

## 输出（report.md）

与 douyin-session 同格式，含：

- 视频元信息（标题 / UP主 / 发布时间 / 时长 / 链接）
- **播放数据**：播放、点赞、投币、收藏、分享、评论、弹幕，并附派生比率（赞播比 / 投币率 / 收藏率 / 分播比）——B站「三连率」尤其能反映硬核认可度
- 原始稿子（若提供）
- **热门评论**（按点赞降序，带 IP 属地）

## 接口

| 数据 | 接口 |
|---|---|
| 视频统计 | `GET https://api.bilibili.com/x/web-interface/view?bvid=` |
| 评论 | `GET https://api.bilibili.com/x/v2/reply?type=1&oid=<aid>&sort=2&pn=&ps=20` |

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

## 退出码

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

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

`view` 的 `stat` 字段名（view/like/coin/favorite/share/reply/danmaku）和评论的 `replies[].{like,content.message,member.uname,rcount,reply_control.location}` 都已按 2026-06 真实返回校准。若 B站改版导致某项为 0，对照 `crawler.py` 的 `fetch_video` / `_normalize_comment` 调整 key 即可。

---

## File: docs/README_CN.md

<h1 align="center">
  
</h1>

<h2 align="center">Cheat on Content</h2>











---

## 🎬 它真正在干什么

大部分创作者活在同一个赌局里：

> 发布 → 数据出来 → 学不到东西 → 下一次继续赌

跑过 200 条的博主跟跑过 1 条的差距不到 10%——因为他们没在每次赌局后**记账**。

**网红外挂**让每一次判断都被记录、被复盘、被吸收进下一次：

📊 打分 → 🎯 盲预测 → 🚀 发布 → 📈 T+3 天复盘 → 🧬 进化你的评分公式

这不是 motivation，是 **compounding**——你不复盘的每一篇，都是在折损"看见自己"的能力。

跑一个月 = 你有了一份**只属于你的爆款公式**。
跑三个月 = 你比刚开始的自己强 10 倍。

---

## 🌀 起源

> 我以前完全不信宿命论。直到这个 skill 让我拍了一条视频——它甚至预测了这条视频能跑多少流量。
>
> 我试图用集体观测证伪它，把这事告诉观众，希望量子坍缩改变轨迹。
>
> 数据是准的。
>
> 我没逃出宿命论，只是从一阶跳到了二阶。
>
> 如果连我的觉醒、连观众的观测都在它的预设里——
> 此时此刻你读到这段：是出于好奇，还是正在完成算法的最后一次落位？
>
> —— 创作者本人

---

## ⚖️ 它和别的"创作工具"哪里不一样

| 别人 | 这个 |
|---|---|
| 给你"灵感" | 让你**自己的灵感被量化** |
| AI 帮你写 | AI 帮你**判**——稿子还是你的 |
| 一发发 10 个版本 A/B 测 | 一发就**赌**——把判断写下来，数据出来对账 |
| 静态数据看板 | **会进化的评分公式**——你三个月后的 rubric 已经不是初始版 |

一句话：别的工具帮你"产出更多"，这个工具帮你"判得更准"。

---

## 🤔 那 ChatGPT / 豆包 / DeepSeek 不是也能干这个？

那是**通用助手**——对所有人说同样的话。你问"我这条会爆吗"，它的答案是从全网平均经验拟合出来的，跟你的账号没关系。明天再问一遍，答案还是上次那个——**它不记得你，更不会因为你而变**。

这套是**你自己的运营专家**，只服务你这一个账号：

- 评分公式从**你的**历史数据反推，不是通用训练分布
- 每发一条它就更新一次对你账号的理解——三个月后判断准度比刚开始强 10 倍（**自动进化**）
- 它知道你的对标账号、你的发布 cadence、你最近三次为什么扑——这些 ChatGPT 第一句话就忘了

通用 LLM 帮所有人；这套帮你**这个**账号。

---

## 🛡️ 它怎么让循环真的能进化

📝 **每条都留底**：发布前打分、写预测，全程存档。三天后回来对账——你哪里准、哪里偏，**一目了然**，不再是模糊的"感觉这次没发好"。

🔁 **越用越准**：连续三次同方向偏差，工具自动催你升级评分公式。**你不主动它也催**。

🛡️ **升级有刹车**：换公式必须用新公式重判所有历史样本，能比旧公式更准才放行；还要跨模型独立审一次——**防你自己骗自己**。

🪒 **rubric 是工作台不是博物馆**：被推翻的观察删，被吸收的也删。永远只放当下最有用的。

---

## 📦 安装

```bash
git clone https://github.com/XBuilderLAB/cheat-on-content.git
cd cheat-on-content
bash install.sh
```

> ⚠️ **从 v0.x 升级？** `git pull` 后在你的内容项目里跑 `/cheat-migrate`。**1.3 → 1.4 是 blind channel 完整性 BREAKING 修复**——拆分 `rubric_notes.md` 防止 blind sub-agent 通过白名单读到实绩。不跑迁移的话 blind 打分会持续标 `non_blind_warning`。详见 [CHANGELOG](../CHANGELOG.md) 和 [migrations/1.3-to-1.4.md](../migrations/1.3-to-1.4.md)。

14 个子 skill 软链接到你 agent 的 skill 目录。装一次，所有内容项目都能用。

**支持的 agent**：Claude Code（默认）· Codex（`bash install.sh --codex`）· 两个都装（`bash install.sh --all`）

> 冻结版本：`bash install.sh --copy` / `bash install.sh --codex --copy`
>
> 卸载：`bash uninstall.sh` / `bash uninstall.sh --codex`（不动你的内容数据）

---

## 🚀 第一次跑

在你的内容项目目录里打开支持 skill 的 agent，说：

```
初始化 cheat-on-content
```

5 个 yes/no 搞定 onboarding。**强烈建议导对标账号**——5-10 条样本 → 工具立刻有 anchor，不然前 5 篇预测精度 ±50%。

---

## ⚡ 日常用法

```
打分这篇 scripts/<...>.md         → 评分
启动预测 scripts/<...>.md         → 盲预测 + 决策日志
拍了 scripts/<...>.md            → 建 video folder + buffer +1
已发布 https://...                → buffer -1
复盘 videos/<...>/                → T+3d 数据回收 + 复盘
状态 / 抓热点 / 找选题 / 升级 rubric / 找对标
```

支持 hook 的 agent 每次开会话自动报告 buffer + 待复盘 + top 候选——你不用主动问。其他 agent 直接说 `状态` 即可。

完整工作流 + 子 skill 细节见 [SKILL.md](../SKILL.md)。

---

## 📈 Star History

<a href="https://star-history.com/#XBuilderLAB/cheat-on-content&Date">
  
</a>

---

## 📜 License

MIT。商用、改造、闭源接入都行。

---

*这是作弊吗？计算器也是。Google 也是。*
*未来从不奖励努力——它只奖励先看见规律的人。*

*你看到这一行——也是它预测的。*