dsh-bili-watch 0.2.4 → 0.2.6

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.
Files changed (3) hide show
  1. package/README.md +10 -8
  2. package/index.js +12 -1
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -19,11 +19,13 @@ dsh plugin --profile web add dsh-bili-watch
19
19
 
20
20
  **第二步易漏**:打开 profile 的 `package.json`,在 `dsh.profile.bundles` 数组里加一行 `"dsh-bili-watch"`。`dsh plugin add` 只写 `dependencies`,不写 bundles。漏了这步插件装了但不生效,也不报错。改完重启 DSH。
21
21
 
22
+ 装完可以验证:`dsh --profile web --dump-config` 里能搜到 `dsh-bili-watch` 才算进了装配。
23
+
22
24
  也可以把本仓库直接放进 `profiles/<名字>/node_modules/dsh-bili-watch`。
23
25
 
24
26
  插件依赖 DSH 自带的 `@deepseek-ai/dsh-tools`(peer,optional)。profile 里缺这个包时 `index.js` 会报 `ERR_MODULE_NOT_FOUND`,先补装再重启。
25
27
 
26
- 插件尚未收录到插件市场,目前只能按上面的命令装。
28
+ 插件市场已收录(2026-10-21):在市场里搜 `dsh-bili-watch` 直接安装,这是最省事的方式;市场里暂时搜不到时,按上面的命令装。
27
29
 
28
30
  ### 只当命令行工具
29
31
 
@@ -45,7 +47,7 @@ dsh plugin --profile web remove dsh-bili-watch
45
47
 
46
48
  ## 插件面板
47
49
 
48
- 装进 DSH 后,设置 → 插件 → `dsh-bili-watch` 的详情页有一块面板,常规操作无需去对话里敲命令:
50
+ 装进 DSH 后,打开插件列表,点 `dsh-bili-watch` 卡片进详情页,里面有一块面板(不用先进设置),常规操作无需去对话里敲命令:
49
51
 
50
52
  - **依赖状态**:ffmpeg、yt-dlp、ASR 环境、OCR 环境、转写模型、登录凭证逐项列出是否就绪、实际路径、占用体积。缺的点击行末「下载」,后台跑 `scripts/fetch-deps`(体积是估算值,实际以跑完为准)。
51
53
  - **扫码登录**:凭证未登录时点「重新扫码」,面板里弹出二维码,手机 B 站扫完自动刷新。凭证保存在本机 `deps/credential.json`。
@@ -122,13 +124,13 @@ macOS/Linux 的 ffmpeg 用系统包管理器装,脚本只给提示。其余目
122
124
  |---|---|
123
125
  | `view <BV或链接或URL>` | 元数据 + 简介 + 热评 |
124
126
  | `peek <BV或链接>` | 元数据 + 热评 + 5 张均匀帧(最便宜;仅 B 站) |
125
- | `sub <BV>` | AI 字幕 + 三判据(字/秒、关键词命中、时长) |
127
+ | `sub <BV或链接>` | AI 字幕 + 三判据(字/秒、关键词命中、时长) |
126
128
  | `comments <BV> [N]` | 评论区,默认按热度排序 |
127
129
  | `asr <BV或URL>` | 本地转写音频 |
128
130
  | `frames <BV或URL> [--step 秒] [--ocr]` | 抽帧;`--ocr` 顺带识别画面文字 |
129
131
  | `ocr <BV>` | 抽帧并 OCR |
130
132
  | `text <BV或URL>` | 四级链:字幕 → 转写 → 抽帧 OCR |
131
- | `sheet <BV> [--grid 3x3]` | 均匀挑 9/16 帧拼成一张图 |
133
+ | `sheet <BV> [--grid 3x3]` | 均匀挑帧拼成一张图(只支持 `3x3` / `4x4`,默认 9 帧) |
132
134
  | `substrip <BV> [--step 秒]` | 底部字幕竖拼成一张图 |
133
135
  | `danmaku <BV>` | 弹幕热区(按时间桶统计峰值) |
134
136
  | `search <关键词> [--days 3]` | 搜视频 |
@@ -169,20 +171,20 @@ AI 字幕(需登录)
169
171
  | `BILI_WATCH_PROJ` | ASR/OCR 环境目录(默认插件 `deps/`) |
170
172
  | `BILI_WATCH_FFMPEG` | ffmpeg 可执行文件路径 |
171
173
  | `BILI_WATCH_YTDLP` | yt-dlp 可执行文件路径 |
172
- | `BILI_WATCH_SEEN` | `seen.md` 去重文件路径(默认 `deps/seen.md`) |
174
+ | `BILI_WATCH_SEEN` | `seen.md` 去重文件路径(默认 `deps/seen.md`)。文件不存在时 `--mark-seen` 记不了,先建一个空文件即可 |
173
175
 
174
176
  ## 成本
175
177
 
176
- - 字幕一次请求,最省。
178
+ - 字幕接口带一次重试;`text` 最多次试两次(先匿名、有凭证再试一次)。
177
179
  - 抽帧会下载视频(360p)并跑 ffmpeg。`--step` 调低抽帧频率,脚本另外限了 `-threads 2`。
178
- - 九宫格和字幕带把多帧压成一张图,省 token。
180
+ - 拼图和字幕带把多帧压成一张图,省 token。
179
181
 
180
182
  ## 限制与风险
181
183
 
182
184
  - **不支持**:点赞、评论、发弹幕、留观看历史;B 站侧只读。本机会写登录凭证、抽帧缓存与 `seen.md` 去重文件。
183
185
  - **只支持 B 站与 yt-dlp 能下的站点**;`peek` / `sub` / `comments` / `danmaku` / `sheet` / `substrip` / `ocr` 仅限 B 站。
184
186
  - **凭证**:等同账号登录态,泄露即被盗。只存本机,不进日志。
185
- - **频率**:正常看几条没问题;批量扫几百条会触发风控。
187
+ - **频率**:脚本没有硬限速(只在字幕重试时随机等几百毫秒);批量跑请自己加 sleep,别连着扫。
186
188
  - **任意 http(s) 地址都会被请求**:通用 URL 走 yt-dlp 时不做内网地址过滤,别拿它请求内网服务。
187
189
 
188
190
  ## 许可
package/index.js CHANGED
@@ -14,7 +14,14 @@ import { appendFileSync, existsSync, readFileSync, readdirSync, rmSync, statSync
14
14
  import { tmpdir } from 'node:os'
15
15
  import { dirname, join } from 'node:path'
16
16
  import { fileURLToPath } from 'node:url'
17
- import { defineTool } from '@deepseek-ai/dsh-tools'
17
+ // @deepseek-ai/dsh-tools 是可选 peer:桌面版 autoInstallPeers:false,市场安装时不会自动装上。
18
+ // 缺了只少一个 bili_watch 工具,/bili 命令、插件面板与路由照常工作,不能因此整块加载失败。
19
+ let defineTool = null
20
+ try {
21
+ ({ defineTool } = await import('@deepseek-ai/dsh-tools'))
22
+ } catch {
23
+ defineTool = null
24
+ }
18
25
  import QRCode from 'qrcode'
19
26
 
20
27
  const HERE = dirname(fileURLToPath(import.meta.url))
@@ -565,6 +572,7 @@ function apply(ctx) {
565
572
  // ② 同名工具:模型可调,需要看视频时自己来,不依赖用户敲命令
566
573
  // 必须用 defineTool 包一层:ctx.tools.register 收的是编译好的 tool 对象,
567
574
  // 直接传 options 会让发往模型的 parameters 变成 null(报 INVALID_REQUEST: schema must be type "object")。
575
+ if (defineTool) {
568
576
  ctx.tools.register(defineTool({
569
577
  name: 'bili_watch',
570
578
  description:
@@ -643,6 +651,9 @@ function apply(ctx) {
643
651
  return { ok: r.ok, text: r.text }
644
652
  },
645
653
  }))
654
+ } else {
655
+ console.warn('[dsh-bili-watch] 未找到 @deepseek-ai/dsh-tools,bili_watch 工具未注册(/bili 命令与插件面板不受影响)')
656
+ }
646
657
 
647
658
  // ③ 设置页:读盘状态 + 清缓存(只读优先;唯一写操作是删本机抽帧缓存目录)
648
659
  try {
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "dsh-bili-watch",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "private": false,
5
- "description": "Bilibili video reader for DSH: subtitles, ASR, frame OCR, comments, danmaku.",
5
+ "description": "Reads Bilibili (and generic URLs via yt-dlp) into text for DSH agents: search, hot, metadata, comments, danmaku, AI subtitles, local ASR, frame OCR.",
6
6
  "type": "module",
7
7
  "main": "index.js",
8
8
  "bin": {