dsh-bili-watch 0.2.0 → 0.2.1
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.
- package/README.md +26 -26
- package/index.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# dsh-bili-watch
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
把一条 B 站视频变成模型能读的内容:元数据、评论、弹幕、AI 字幕、本地转写、抽帧 OCR。可以装在 DSH 里当插件,也能直接跑命令行。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
取内容的顺序是先用文字(字幕或转写),文字不够再抽帧看画面。缺哪一档依赖就跳过哪一档,命令本身不会失败。
|
|
6
6
|
|
|
7
7
|
## 安装
|
|
8
8
|
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
dsh plugin --profile web add dsh-bili-watch
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
**第二步容易漏**:打开 profile 的 `package.json`,在 `dsh.profile.bundles` 数组里加一行 `"dsh-bili-watch"`。`dsh plugin add` 只写 `dependencies`,不写 bundles。漏了这步插件装了但不生效,也不报错。改完重启 DSH。
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
也可以把本仓库直接放进 `profiles/<名字>/node_modules/dsh-bili-watch`。
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
插件依赖 DSH 自带的 `@deepseek-ai/dsh-tools`(peer,optional)。profile 里缺这个包时 `index.js` 会报 `ERR_MODULE_NOT_FOUND`,先补装再重启。
|
|
18
18
|
|
|
19
19
|
## 依赖
|
|
20
20
|
|
|
@@ -27,18 +27,18 @@ dsh plugin --profile web add dsh-bili-watch
|
|
|
27
27
|
| 画面 OCR | Python 3.10+ 与 rapidocr_onnxruntime(`deps/.venv-ocr`) | 跳过,只剩基础抽帧 |
|
|
28
28
|
| 通用视频 URL | yt-dlp | 只支持 B 站 |
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
环境:Node.js ≥ 22。装在 DSH 里时 DSH 自带 node,命令行跑也一样。
|
|
31
31
|
|
|
32
32
|
`ffmpeg` 查找顺序:`--ffmpeg` 参数 → `BILI_LOOK_FFMPEG` → 插件 `deps/` → PATH。
|
|
33
33
|
|
|
34
|
-
`deps/`
|
|
34
|
+
`deps/` 用来放运行期文件:Python venv、模型、yt-dlp、凭证,默认不进 git(见 `.gitignore`)。ASR 和 OCR 的 Python 环境是可选的,不装也能用,只是少这两档。
|
|
35
35
|
|
|
36
|
-
`deps/_bili-asr.py` 默认从 `hf-mirror.com`
|
|
36
|
+
`deps/_bili-asr.py` 默认从 `hf-mirror.com` 下模型,国内快。海外网络可以先设 `HF_ENDPOINT=https://huggingface.co` 再跑 `fetch-deps`。
|
|
37
37
|
|
|
38
38
|
### 可选依赖(一键安装)
|
|
39
39
|
|
|
40
40
|
```powershell
|
|
41
|
-
# Windows(powershell.exe 或 pwsh
|
|
41
|
+
# Windows(powershell.exe 或 pwsh 都行)
|
|
42
42
|
powershell -ExecutionPolicy Bypass -File scripts\fetch-deps.ps1 -Target all
|
|
43
43
|
powershell -ExecutionPolicy Bypass -File scripts\fetch-deps.ps1 -Target all -Mirror cn # 国内网络:gh-proxy + 清华 PyPI + hf-mirror
|
|
44
44
|
|
|
@@ -53,28 +53,28 @@ bash scripts/fetch-deps.sh all
|
|
|
53
53
|
BILI_LOOK_MIRROR=cn bash scripts/fetch-deps.sh all
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
脚本可以重复跑:目标已存在就跳过,`-Force` 重下(Windows),`-DryRun` 只打印命令。装 venv 时会验证包能不能 import,上次装到一半的会被重建。`-Target model` 需要 ASR 环境先装好,脚本会提示。
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
**从 GitHub 下载很慢或断**:ffmpeg 要从 GitHub 拉约 80 MB 的压缩包,国内直连经常断。三条替代路径:
|
|
59
59
|
|
|
60
60
|
1. 加 `-Mirror cn` 重试(走 gh-proxy);
|
|
61
|
-
2. 手动下载 `ffmpeg.exe` 放进 `deps\`
|
|
62
|
-
3.
|
|
61
|
+
2. 手动下载 `ffmpeg.exe` 放进 `deps\` 再重跑(会被跳过);
|
|
62
|
+
3. 已经有 ffmpeg 就设 `BILI_LOOK_FFMPEG` 指向它。
|
|
63
63
|
|
|
64
|
-
macOS/Linux 的 ffmpeg
|
|
64
|
+
macOS/Linux 的 ffmpeg 用系统包管理器装,脚本只给提示。其余目标和 Windows 一样;sh 版本单项失败会跑完再汇总。
|
|
65
65
|
|
|
66
66
|
## 凭证
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
匿名也有内容:元数据、评论、抽帧、弹幕都不需要登录。
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
只有拿 AI 字幕需要登录,二选一:
|
|
71
71
|
|
|
72
|
-
1. `login`:插件出二维码,手机 B
|
|
72
|
+
1. `login`:插件出二维码,手机 B 站扫码。凭证存在插件 `deps/credential.json`,不出本机。
|
|
73
73
|
2. `--cred <文件路径>`:读一份现成的 `{sessdata, bili_jct, buvid3, buvid4}` JSON。
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
凭证顺序:给了 `--cred` 就只用它,读不到就按匿名跑;没给 `--cred` 才用 `deps/credential.json`;两者都没有就匿名。
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
这份文件等同账号登录态。别分享、别提交、别上传。
|
|
78
78
|
|
|
79
79
|
## 命令
|
|
80
80
|
|
|
@@ -96,13 +96,13 @@ macOS/Linux 的 ffmpeg 由系统包管理器安装(脚本只给提示),其
|
|
|
96
96
|
| `login [--check] [--poll]` | 扫码登录 |
|
|
97
97
|
| `clean` | 清空临时目录 `%TEMP%\bili-watch` |
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
工具侧的等价入口:`bili_watch` 工具(参数 `command` + `bv`),或 `/bili` 命令。
|
|
100
100
|
|
|
101
101
|
## 通用视频 URL
|
|
102
102
|
|
|
103
103
|
`view` / `text` / `asr` / `frames` 接受非 B 站 URL(YouTube、X、直链 mp4 等),走 yt-dlp:
|
|
104
104
|
|
|
105
|
-
-
|
|
105
|
+
- `yt-dlp.exe` 放进 `deps/`,或设 `BILI_LOOK_YTDLP`,或让它出现在 PATH 里。
|
|
106
106
|
- 下载按 URL 哈希隔离在 `%TEMP%\bili-watch\`,不会串目录。
|
|
107
107
|
- `peek` / `sub` / `comments` / `danmaku` / `sheet` / `substrip` / `ocr` 只支持 B 站。
|
|
108
108
|
|
|
@@ -118,7 +118,7 @@ AI 字幕(需登录)
|
|
|
118
118
|
读图(模型自己看帧)
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
-
|
|
121
|
+
降级时会说明原因,不会静默跳过。
|
|
122
122
|
|
|
123
123
|
## 环境变量
|
|
124
124
|
|
|
@@ -131,13 +131,13 @@ AI 字幕(需登录)
|
|
|
131
131
|
|
|
132
132
|
## 成本
|
|
133
133
|
|
|
134
|
-
-
|
|
135
|
-
- 抽帧会下载视频(360p)并跑 ffmpeg
|
|
136
|
-
-
|
|
134
|
+
- 字幕一次请求,最省。
|
|
135
|
+
- 抽帧会下载视频(360p)并跑 ffmpeg。`--step` 调低抽帧频率,脚本另外限了 `-threads 2`。
|
|
136
|
+
- 九宫格和字幕带把多帧压成一张图,省 token。
|
|
137
137
|
|
|
138
138
|
## 风险
|
|
139
139
|
|
|
140
|
-
-
|
|
140
|
+
- **凭证**:等同账号登录态,泄露即被盗。只存本机,不进日志。
|
|
141
141
|
- **频率**:正常看几条没问题;批量扫几百条会触发风控。
|
|
142
142
|
- **只读**:插件只读,不点赞、不评论、不留观看历史。
|
|
143
143
|
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-bili-watch",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"private": false,
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "Bilibili video reader for DSH: subtitles, ASR, frame OCR, comments, danmaku.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"bin": {
|