koishi-plugin-video-parser-all 1.3.4 → 1.3.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 (4) hide show
  1. package/lib/index.d.ts +166 -20
  2. package/lib/index.js +457 -272
  3. package/package.json +19 -5
  4. package/readme.md +80 -59
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-video-parser-all",
3
3
  "description": "Koishi 全平台视频/图集解析插件,支持抖音/快手/B站/微博/小红书/剪映/YouTube/TikTok等20+平台",
4
- "version": "1.3.4",
4
+ "version": "1.3.6",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
@@ -45,7 +45,6 @@
45
45
  "twitter",
46
46
  "instagram",
47
47
  "doubao",
48
- "doubao_chat",
49
48
  "jimeng",
50
49
  "oasis",
51
50
  "wechat_channel",
@@ -58,6 +57,8 @@
58
57
  "多平台",
59
58
  "图集解析",
60
59
  "去水印",
60
+ "代理",
61
+ "字段映射",
61
62
  "哔哩哔哩",
62
63
  "抖音",
63
64
  "快手",
@@ -92,12 +93,25 @@
92
93
  "typescript": "^5.3.3"
93
94
  },
94
95
  "dependencies": {
95
- "axios": "^1.16.1",
96
- "fast-xml-parser": "^4.5.6"
96
+ "axios": "^1.16.1"
97
97
  },
98
98
  "peerDependencies": {
99
99
  "@koishijs/plugin-console": "^5.30.4",
100
- "koishi": "^4.18.7"
100
+ "koishi": "^4.18.7",
101
+ "koishi-plugin-silk": "^1.0.0",
102
+ "koishi-plugin-ffmpeg": "^1.0.0",
103
+ "aria2": "^4.1.2"
104
+ },
105
+ "peerDependenciesMeta": {
106
+ "koishi-plugin-silk": {
107
+ "optional": true
108
+ },
109
+ "koishi-plugin-ffmpeg": {
110
+ "optional": true
111
+ },
112
+ "aria2": {
113
+ "optional": true
114
+ }
101
115
  },
102
116
  "repository": {
103
117
  "type": "git",
package/readme.md CHANGED
@@ -20,82 +20,94 @@ This is a **multi-platform video/image parsing plugin** developed for the Koishi
20
20
 
21
21
  ## 配置项说明 (Configuration)
22
22
 
23
- ### 基础设置 (Basic Settings)
23
+ ### 基本设置
24
24
  | 配置项 | 类型 | 默认值 | 说明 |
25
25
  |--------|------|--------|------|
26
- | `enable` | boolean | true | 是否启用视频解析插件 |
27
- | `botName` | string | 视频解析机器人 | 合并转发消息中显示的机器人名称 |
28
- | `showWaitingTip` | boolean | true | 解析时是否显示等待提示 |
29
- | `debug` | boolean | false | 是否开启 Debug 模式,在控制台输出详细日志 |
26
+ | `enable` | boolean | true | 启用插件 |
27
+ | `botName` | string | 视频解析机器人 | 合并转发中的昵称 |
28
+ | `showWaitingTip` | boolean | true | 显示等待提示 |
29
+ | `debug` | boolean | false | Debug 日志 |
30
+ | `platformEnabled` | object | 全开 | 各平台开关 |
30
31
 
31
- ### 统一消息格式 (Unified Message Format)
32
+ ### 消息格式
32
33
  | 配置项 | 类型 | 默认值 | 说明 |
33
34
  |--------|------|--------|------|
34
- | `unifiedMessageFormat` | string | `标题:${标题}\n作者:${作者}\n简介:${简介}\n音乐标题:${音乐标题}\n音乐作者:${音乐作者}\n音乐链接:${音乐链接}\n点赞:${点赞数}\n收藏:${收藏数}\n转发:${转发数}\n播放:${播放数}\n评论:${评论数}\n图片数量:${图片数量}` | 文字消息格式,支持变量替换。空行自动隐藏。封面及媒体由独立开关控制,默认不包含在文字中 |
35
+ | `unifiedMessageFormat` | string | 见预设 | 文字格式,支持变量,空行自动隐藏 |
35
36
 
36
- ### 内容显示设置 (Content Display Settings)
37
+ ### 媒体发送
37
38
  | 配置项 | 类型 | 默认值 | 说明 |
38
39
  |--------|------|--------|------|
39
- | `showImageText` | boolean | true | 是否发送文字内容 |
40
- | `showCoverImage` | boolean | true | 是否发送封面图片(视频/图集封面) |
41
- | `showMusicCover` | boolean | true | 是否发送音乐封面图片 |
42
- | `showImageFile` | boolean | true | 封面/图片是否以文件形式发送(关闭则只发链接) |
43
- | `forceDownloadImage` | boolean | false | 强制下载封面/图片后发送 |
44
- | `imageDownloadTimeout` | number | 60000 | 图片下载超时(毫秒) |
45
- | `imageTempDir` | string | `./temp_images` | 临时封面/图片存储目录 |
46
- | `maxImageSize` | number | 0 | 最大下载图片大小(MB),0 不限制 |
47
- | `showVideoFile` | boolean | true | 视频是否以文件形式发送(关闭则只发链接) |
48
- | `forceDownloadVideo` | boolean | false | 强制下载视频后发送 |
49
- | `videoDownloadTimeout` | number | 120000 | 视频下载超时(毫秒) |
50
- | `tempDir` | string | `./temp_videos` | 临时视频存储目录 |
51
- | `maxVideoSize` | number | 0 | 最大下载视频大小(MB),0 不限制 |
52
- | `maxDescLength` | number | 200 | 简介最大长度(字符) |
53
- | `maxConcurrent` | number | 3 | 批量解析最大并发数 |
54
-
55
- ### 网络与 API 设置 (Network & API Settings)
40
+ | `showImageText` | boolean | true | 发送文字内容 |
41
+ | `showCoverImage` | boolean | true | 发送封面图片 |
42
+ | `showMusicCover` | boolean | true | 发送音乐封面 |
43
+ | `showImageFile` | boolean | true | 封面/图片是否以图片形式发送(关闭则只发送链接) |
44
+ | `showVideoFile` | boolean | true | 视频是否以视频形式发送(关闭则只发送链接) |
45
+ | `forceDownloadImage` | boolean | false | 强制下载封面/图片 |
46
+ | `forceDownloadVideo` | boolean | false | 强制下载视频 |
47
+
48
+ ### 音乐语音(需 silk ffmpeg)
56
49
  | 配置项 | 类型 | 默认值 | 说明 |
57
50
  |--------|------|--------|------|
58
- | `timeout` | number | 180000 | API 请求超时时间(毫秒) |
59
- | `videoSendTimeout` | number | 60000 | 消息发送超时时间(毫秒,0 为不限制) |
60
- | `userAgent` | string | `Mozilla/5.0 ...` | User-Agent |
61
- | `proxy` | object | `{ enabled: false, protocol: "http", host: "127.0.0.1", port: 7890, auth: { username: "", password: "" } }` | HTTP/HTTPS 代理。`enabled` 开关(默认关闭),`protocol` 下拉选择 `http` 或 `https` |
62
- | `customHeaders` | array | [] | 自定义请求头,每项含 `name` 和 `value` |
51
+ | `showMusicVoice` | boolean | false | 音乐链接以语音发送 |
52
+ | `showMusicVoiceFile` | boolean | true | 音乐语音是否以文件形式发送(关闭则只发送链接) |
53
+ | `forceDownloadMusicVoice` | boolean | false | 强制下载音乐语音 |
63
54
 
64
- ### API 选择与回退设置 (API Selection & Fallback)
55
+ ### 性能与限制
65
56
  | 配置项 | 类型 | 默认值 | 说明 |
66
57
  |--------|------|--------|------|
67
- | `primaryApiUrl` | string | `https://api.bugpk.com/api/short_videos` | API 地址 |
68
- | `backupApiUrl` | string | `https://api.bugpk.com/api/svparse` | 备用主 API,仅支持部分平台 |
69
- | `platformDedicatedFirst` | object | 各平台均为 `false` | 平台专属 API 优先开关,键:`bilibili` 等 |
70
- | `customApis` | array | [] | 自定义平台专属 API,含 `platform`, `apiUrl`, `apiKey`, `authHeaderType`, `customHeaderName`, `fieldMapping` |
71
- | `globalFieldMapping` | string | 预设字段映射 JSON | 全局字段映射,支持点号路径 |
58
+ | `maxDescLength` | number | 200 | 简介长度上限 |
59
+ | `maxConcurrent` | number | 3 | 解析最大并发数 |
60
+ | `downloadConcurrency` | number | 3 | 下载线程数 |
61
+ | `mediaDownloadTimeout` | number | 120000 | 统一下载超时 (ms) |
62
+ | `maxMediaSize` | number | 0 | 最大下载文件大小 (MB),0 为不限制 |
63
+ | `downloadEngine` | string | internal | 下载引擎(internal / aria2) |
64
+ | `aria2Host` | string | 127.0.0.1 | aria2 RPC 地址 |
65
+ | `aria2Port` | number | 6800 | aria2 RPC 端口 |
66
+ | `aria2Secret` | string | | aria2 RPC 密钥 |
67
+ | `resumeDownload` | boolean | true | 启用断点续传(仅 aria2) |
68
+
69
+ ### 网络与请求
70
+ | 配置项 | 类型 | 默认值 | 说明 |
71
+ |--------|------|--------|------|
72
+ | `timeout` | number | 180000 | API 超时 (ms) |
73
+ | `videoSendTimeout` | number | 180000 | 发送超时 (ms) |
74
+ | `userAgent` | string | 见预设 | User-Agent |
75
+ | `proxy` | object | ... | HTTP/HTTPS 代理 |
76
+ | `customHeaders` | array | [] | 自定义请求头 |
72
77
 
73
- ### 错误与重试设置 (Error & Retry Settings)
78
+ ### 发送与重试
74
79
  | 配置项 | 类型 | 默认值 | 说明 |
75
80
  |--------|------|--------|------|
76
81
  | `ignoreSendError` | boolean | true | 忽略发送失败 |
77
82
  | `retryTimes` | number | 3 | 重试次数 |
78
- | `retryInterval` | number | 1000 | 重试间隔(毫秒) |
83
+ | `retryInterval` | number | 1000 | 重试间隔 (ms) |
84
+ | `enableForward` | boolean | false | 合并转发(OneBot/Satori) |
79
85
 
80
- ### 发送方式设置 (Send Mode Settings)
86
+ ### 缓存与临时文件
81
87
  | 配置项 | 类型 | 默认值 | 说明 |
82
88
  |--------|------|--------|------|
83
- | `enableForward` | boolean | false | 启用合并转发(仅 OneBot 平台) |
89
+ | `deduplicationInterval` | number | 180 | 去重间隔 (s) |
90
+ | `cacheTTL` | number | 600 | 缓存时间 (s) |
91
+ | `cacheDir` | string | ./temp_cache | 统一临时目录 |
84
92
 
85
- ### 缓存与去重设置 (Cache & Deduplication Settings)
93
+ ### API 与平台
86
94
  | 配置项 | 类型 | 默认值 | 说明 |
87
95
  |--------|------|--------|------|
88
- | `deduplicationInterval` | number | 180 | 去重间隔(秒) |
89
- | `cacheTTL` | number | 600 | 缓存时间(秒) |
90
-
91
- ### 界面文字设置 (UI Text Settings)
96
+ | `apiKeys` | array | [] | API 密钥列表 |
97
+ | `rotationMode` | string | sequential | 密钥轮换模式(sequential / load_balance) |
98
+ | `platformDedicatedFirst` | object | 全关 | 优先专属 API |
99
+ | `customApis` | array | [] | 覆盖内置平台 API |
100
+ | `customPlatforms` | array | [] | 自定义新平台 |
101
+ | `globalFieldMapping` | string | 预设 | 全局字段映射 JSON |
102
+
103
+ ### 界面文本
92
104
  | 配置项 | 类型 | 默认值 | 说明 |
93
105
  |--------|------|--------|------|
94
- | `waitingTipText` | string | 正在解析视频,请稍候... | 等待提示 |
95
- | `unsupportedPlatformText` | string | 不支持该平台链接 | 不支持平台提示 |
96
- | `invalidLinkText` | string | 无效的视频链接 | 无效链接提示 |
106
+ | `waitingTipText` | string | 正在解析... | 等待提示 |
107
+ | `unsupportedPlatformText` | string | 不支持该平台 | 不支持提示 |
108
+ | `invalidLinkText` | string | 无效链接 | 无效链接提示 |
97
109
  | `parseErrorPrefix` | string | ❌ 解析失败: | 错误前缀 |
98
- | `parseErrorItemFormat` | string | `【${url}】: ${msg}` | 错误项格式 |
110
+ | `parseErrorItemFormat` | string | ... | 错误格式 |
99
111
 
100
112
  ## 支持的变量 (Supported Variables)
101
113
  在 `unifiedMessageFormat` 中可使用以下变量,空行自动隐藏:
@@ -117,9 +129,20 @@ This is a **multi-platform video/image parsing plugin** developed for the Koishi
117
129
  | `${视频链接}` | 视频原始链接 |
118
130
  | `${音乐标题}` | 音乐标题 |
119
131
  | `${音乐作者}` | 音乐作者 |
120
- | `${音乐链接}` | 音乐原始链接 |
121
132
 
122
- > 注:音乐封面已转为独立图片发送,不再作为文字变量。其余封面图片均通过对应开关控制。
133
+ ## 依赖说明 (Dependencies)
134
+ ### 音乐语音(可选)
135
+ 若启用 `showMusicVoice`,请安装:
136
+ - `koishi-plugin-silk`:silk 编解码
137
+ - `koishi-plugin-ffmpeg`:音频重采样
138
+ ### aria2 下载引擎(可选)
139
+ 若启用 `downloadEngine: 'aria2'`,请安装并启动 aria2 服务,并安装 npm 包 `aria2`:
140
+ - 安装 aria2 服务端:https://github.com/aria2/aria2
141
+ - 安装 npm 客户端:`npm install aria2`
142
+ - 启动 RPC:`aria2c --enable-rpc --rpc-listen-all=true --rpc-allow-origin-all`
143
+ 未满足条件时自动降级为内置下载,不影响正常使用。
144
+ ### downloads 服务(可选)
145
+ 插件会自动检测 Koishi 内置 `downloads` 服务,优先使用其下载文件,失败时回退到内置/aria2 下载。
123
146
 
124
147
  ## 支持的平台 (Supported Platforms)
125
148
  | 平台名称 | 关键词识别 | 解析能力 |
@@ -131,27 +154,25 @@ This is a **multi-platform video/image parsing plugin** developed for the Koishi
131
154
  | 微博 | weibo, video.weibo.com | 视频、图集 |
132
155
  | 剪映 / 即梦 | jianying, jimeng.jianying.com | 视频模板 |
133
156
  | 今日头条 / 西瓜视频 | toutiao, ixigua.com | 短视频 |
134
- | AcFun (A站) | acfun, acfun.cn | 视频 |
157
+ | AcFunA站) | acfun, acfun.cn | 视频 |
135
158
  | 知乎 | zhihu, zhihu.com | 视频、回答 |
136
159
  | 微视 | weishi, weishi.qq.com | 短视频 |
137
160
  | 虎牙 | huya, huya.com | 直播、视频 |
138
- | YouTube (油管) | youtube, youtu.be | 视频 |
139
- | TikTok (国际版抖音) | tiktok, tiktok.com | 短视频 |
161
+ | YouTube(油管) | youtube, youtu.be | 视频 |
162
+ | TikTok(国际版抖音) | tiktok, tiktok.com | 短视频 |
140
163
  | 好看视频 | haokan, haokan.baidu.com | 短视频 |
141
- | 梨视频 | video.li | 短视频 |
142
164
  | 美拍 | meipai, meipai.com | 短视频 |
143
- | 全民直播 | quanmin (quanmin.tv) | 直播 |
144
165
  | Twitter / X | twitter, x.com | 视频、图文 |
145
166
  | Instagram | instagram, instagram.com | 图文、Reels |
146
167
  | 豆包 | doubao (doubao.com/video) | 视频 |
147
- | 豆包对话 | doubao (doubao.com/thread) | 对话分享 |
148
168
  | 皮皮搞笑 | pipigx, h5.pipigx.com | 短视频 |
149
169
  | 皮皮虾 | pipixia, h5.pipix.com | 短视频 |
150
170
  | 最右 | zuiyou, xiaochuankeji.cn | 短视频 |
171
+ | 梨视频 | video.li, pearvideo.com | 短视频 |
172
+ | 全民直播 | quanmin (quanmin.tv) | 直播 |
151
173
  | 绿洲 (Oasis) | oasis.weibo.com | 视频、图文 |
152
174
  | 视频号 (WeChat Channels) | channels.weixin.qq.com, weixin.qq.com/sph/ | 短视频 |
153
-
154
- > 注:部分平台解析能力可能因API限制有所差异。
175
+ | 🔧 自定义平台 | 通过 `customPlatforms` 添加 | 取决于 API |
155
176
 
156
177
  ## 项目贡献者 (Contributors)
157
178