koishi-plugin-video-parser-all 1.2.9 → 1.3.0
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/lib/index.d.ts +2 -0
- package/lib/index.js +28 -5
- package/package.json +1 -1
- package/readme.md +5 -3
package/lib/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export declare const Config: Schema<{
|
|
|
22
22
|
videoSendTimeout?: number | null | undefined;
|
|
23
23
|
userAgent?: string | null | undefined;
|
|
24
24
|
proxy?: ({
|
|
25
|
+
enabled?: boolean | null | undefined;
|
|
25
26
|
protocol?: string | null | undefined;
|
|
26
27
|
host?: string | null | undefined;
|
|
27
28
|
port?: number | null | undefined;
|
|
@@ -104,6 +105,7 @@ export declare const Config: Schema<{
|
|
|
104
105
|
videoSendTimeout: number;
|
|
105
106
|
userAgent: string;
|
|
106
107
|
proxy: Schemastery.ObjectT<{
|
|
108
|
+
enabled: Schema<boolean, boolean>;
|
|
107
109
|
protocol: Schema<string, string>;
|
|
108
110
|
host: Schema<string, string>;
|
|
109
111
|
port: Schema<number, number>;
|
package/lib/index.js
CHANGED
|
@@ -76,7 +76,7 @@ exports.Config = koishi_1.Schema.intersect([
|
|
|
76
76
|
debug: koishi_1.Schema.boolean().default(false).description('开启调试模式,在控制台输出详细日志'),
|
|
77
77
|
}).description('基础设置'),
|
|
78
78
|
koishi_1.Schema.object({
|
|
79
|
-
unifiedMessageFormat: koishi_1.Schema.string().role('textarea').default('标题:${标题}\n作者:${作者}\n简介:${简介}\n点赞:${点赞数}\n收藏:${收藏数}\n转发:${转发数}\n播放:${播放数}\n评论:${评论数}\n图片数量:${图片数量}').description('统一消息格式,可用变量:${标题} ${作者} ${简介} ${点赞数} ${收藏数} ${转发数} ${播放数} ${评论数} ${视频时长} ${发布时间} ${图片数量} ${作者ID}
|
|
79
|
+
unifiedMessageFormat: koishi_1.Schema.string().role('textarea').default('标题:${标题}\n作者:${作者}\n简介:${简介}\n点赞:${点赞数}\n收藏:${收藏数}\n转发:${转发数}\n播放:${播放数}\n评论:${评论数}\n图片数量:${图片数量}').description('统一消息格式,可用变量:${标题} ${作者} ${简介} ${点赞数} ${收藏数} ${转发数} ${播放数} ${评论数} ${视频时长} ${发布时间} ${图片数量} ${作者ID}'),
|
|
80
80
|
}).description('消息格式设置'),
|
|
81
81
|
koishi_1.Schema.object({
|
|
82
82
|
showImageText: koishi_1.Schema.boolean().default(true).description('是否发送解析后的文字内容'),
|
|
@@ -94,14 +94,15 @@ exports.Config = koishi_1.Schema.intersect([
|
|
|
94
94
|
videoSendTimeout: koishi_1.Schema.number().min(0).step(1).default(60000).description('视频消息发送超时(毫秒,0 为不限制)'),
|
|
95
95
|
userAgent: koishi_1.Schema.string().default('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36').description('API 请求 UA'),
|
|
96
96
|
proxy: koishi_1.Schema.object({
|
|
97
|
-
|
|
97
|
+
enabled: koishi_1.Schema.boolean().default(false).description('是否启用 HTTP/HTTPS 代理'),
|
|
98
|
+
protocol: koishi_1.Schema.string().default('http').description('代理协议 (http 或 https)'),
|
|
98
99
|
host: koishi_1.Schema.string().default('127.0.0.1').description('代理地址'),
|
|
99
100
|
port: koishi_1.Schema.number().default(7890).description('代理端口'),
|
|
100
101
|
auth: koishi_1.Schema.object({
|
|
101
102
|
username: koishi_1.Schema.string().default('').description('代理用户名'),
|
|
102
103
|
password: koishi_1.Schema.string().default('').description('代理密码'),
|
|
103
104
|
}).description('代理认证'),
|
|
104
|
-
}).description('HTTP
|
|
105
|
+
}).description('HTTP/HTTPS 代理设置(需开启 enabled)'),
|
|
105
106
|
customHeaders: koishi_1.Schema.array(koishi_1.Schema.object({
|
|
106
107
|
name: koishi_1.Schema.string().required().description('请求头名称'),
|
|
107
108
|
value: koishi_1.Schema.string().required().description('请求头值'),
|
|
@@ -175,7 +176,29 @@ exports.Config = koishi_1.Schema.intersect([
|
|
|
175
176
|
customHeaderName: koishi_1.Schema.string().description('自定义 Header 名称(仅当选择 Custom 时有效)').default('X-API-Key'),
|
|
176
177
|
fieldMapping: koishi_1.Schema.string().role('textarea').default('{}').description('字段映射 JSON,例如 {"title":"data.info.name"},支持点号路径'),
|
|
177
178
|
})).default([]).description('自定义平台专属 API 地址,留空则使用内置默认专属 API'),
|
|
178
|
-
globalFieldMapping: koishi_1.Schema.string().role('textarea').default('{
|
|
179
|
+
globalFieldMapping: koishi_1.Schema.string().role('textarea').default('{\n' +
|
|
180
|
+
' "title": "data.title",\n' +
|
|
181
|
+
' "desc": "data.description",\n' +
|
|
182
|
+
' "author": "data.author.name",\n' +
|
|
183
|
+
' "uid": "data.author.id",\n' +
|
|
184
|
+
' "avatar": "data.author.avatar",\n' +
|
|
185
|
+
' "cover": "data.cover_url",\n' +
|
|
186
|
+
' "video": "data.video_url",\n' +
|
|
187
|
+
' "video_backup": "data.video_qualities",\n' +
|
|
188
|
+
' "videos": "data.videos",\n' +
|
|
189
|
+
' "type": "data.type",\n' +
|
|
190
|
+
' "like": "data.statistics.likes",\n' +
|
|
191
|
+
' "comment": "data.statistics.comments",\n' +
|
|
192
|
+
' "collect": "data.statistics.favorites",\n' +
|
|
193
|
+
' "share": "data.statistics.shares",\n' +
|
|
194
|
+
' "play": "data.statistics.plays",\n' +
|
|
195
|
+
' "duration": "data.duration",\n' +
|
|
196
|
+
' "publishTime": "data.create_time",\n' +
|
|
197
|
+
' "music_title": "data.music.title",\n' +
|
|
198
|
+
' "music_author": "data.music.author",\n' +
|
|
199
|
+
' "music_cover": "data.music.cover",\n' +
|
|
200
|
+
' "music_url": "data.music.url"\n' +
|
|
201
|
+
'}').description('全局字段映射 JSON,优先级低于专属 API 映射'),
|
|
179
202
|
}).description('API 选择设置'),
|
|
180
203
|
koishi_1.Schema.object({
|
|
181
204
|
waitingTipText: koishi_1.Schema.string().default('正在解析视频,请稍候...').description('解析等待提示文字'),
|
|
@@ -531,7 +554,7 @@ function apply(ctx, config) {
|
|
|
531
554
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
532
555
|
}
|
|
533
556
|
};
|
|
534
|
-
if (proxyConfig.host) {
|
|
557
|
+
if (proxyConfig.enabled && proxyConfig.host) {
|
|
535
558
|
axiosConfig.proxy = {
|
|
536
559
|
protocol: proxyConfig.protocol || 'http',
|
|
537
560
|
host: proxyConfig.host,
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -60,7 +60,7 @@ This is a **multi-platform video/image parsing plugin** developed for the Koishi
|
|
|
60
60
|
| `timeout` | number | 180000 | API 请求超时时间(毫秒) |
|
|
61
61
|
| `videoSendTimeout` | number | 60000 | 视频消息发送超时时间(毫秒,0 为不限制) |
|
|
62
62
|
| `userAgent` | string | `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36` | API 请求使用的 User-Agent |
|
|
63
|
-
| `proxy` | object | `{ protocol: "http", host: "127.0.0.1", port: 7890, auth: { username: "", password: "" } }` | HTTP
|
|
63
|
+
| `proxy` | object | `{ enabled: false, protocol: "http", host: "127.0.0.1", port: 7890, auth: { username: "", password: "" } }` | HTTP/HTTPS 代理设置。`enabled` 开关(默认关闭),`protocol` 支持 `http` 或 `https`。需开启 `enabled` 并填写 `host` 后生效 |
|
|
64
64
|
| `customHeaders` | array | [] | 自定义请求头,会附加到所有 API 请求中。每项包含 `name`(头名称)和 `value`(头值) |
|
|
65
65
|
|
|
66
66
|
### API 选择与回退设置 (API Selection & Fallback)
|
|
@@ -70,7 +70,7 @@ This is a **multi-platform video/image parsing plugin** developed for the Koishi
|
|
|
70
70
|
| `backupApiUrl` | string | `https://api.bugpk.com/api/svparse` | 备用主 API 地址,仅支持抖音、小红书、Instagram、即梦平台解析 |
|
|
71
71
|
| `platformDedicatedFirst` | object | 各平台均为 `false` | 各平台独立开关:是否优先使用平台专属 API。对象键为平台标识(英文),值为布尔值。支持的键:`bilibili`、`douyin`、`kuaishou`、`xiaohongshu`、`weibo`、`xigua`、`youtube`、`tiktok`、`acfun`、`zhihu`、`weishi`、`huya`、`haokan`、`meipai`、`twitter`、`instagram`、`doubao`、`oasis`、`wechat_channel` |
|
|
72
72
|
| `customApis` | array | [] | 自定义平台专属 API 列表。每项包含:`platform`(平台类型)、`apiUrl`(API 地址)、`apiKey`(API Key,可选)、`authHeaderType`(认证头类型,可选:`Bearer` / `X-API-Key` / `Custom`)、`customHeaderName`(自定义 Header 名称,仅当 `authHeaderType` 为 `Custom` 时有效)、`fieldMapping`(字段映射 JSON 字符串,用于适配非标准 API 响应,支持点号路径) |
|
|
73
|
-
| `globalFieldMapping` | string |
|
|
73
|
+
| `globalFieldMapping` | string | 预设完整字段映射JSON(见下方示例) | 全局字段映射 JSON,优先级低于专属 API 映射。用于统一适配所有平台的 API 响应格式,默认已包含常用路径示例 |
|
|
74
74
|
|
|
75
75
|
### 错误与重试设置 (Error & Retry Settings)
|
|
76
76
|
| 配置项 | 类型 | 默认值 | 说明 |
|
|
@@ -116,7 +116,6 @@ This is a **multi-platform video/image parsing plugin** developed for the Koishi
|
|
|
116
116
|
| `${发布时间}` | 发布时间(格式化) | 所有平台 |
|
|
117
117
|
| `${图片数量}` | 图集/实况图片数量 | 图集/实况 |
|
|
118
118
|
| `${作者ID}` | 作者唯一标识ID | 部分平台 |
|
|
119
|
-
| `${封面}` | 封面图片地址 | 所有平台 |
|
|
120
119
|
| `${视频链接}` | 视频原始链接 | 视频 |
|
|
121
120
|
|
|
122
121
|
> 注:部分变量可能因平台API返回数据不同而显示为空,某行所有变量为空(或为"0")时该行会自动隐藏。
|
|
@@ -158,6 +157,9 @@ This is a **multi-platform video/image parsing plugin** developed for the Koishi
|
|
|
158
157
|
|----------------------|-------------------------|
|
|
159
158
|
| Minecraft-1314 | 插件完整开发 (Complete plugin development) |
|
|
160
159
|
| ShiraiKuroko003 | 修复消息格式设置问题并且PR-1.2.5版本已修复 |
|
|
160
|
+
| cyavb | 提交功能建议-给自定义API添加KEY认证-已修复 |
|
|
161
|
+
| Keep785 | 提交Bug-无法正常关闭发送封面-已修复 |
|
|
162
|
+
| dzt2008 + Apricityx | 提交Bug-会对非支持视频平台URL进行误解析-已修复 |
|
|
161
163
|
| JH-Ahua | BugPk-Api 支持 |
|
|
162
164
|
| shangxue | 灵感来源 |
|
|
163
165
|
|