koishi-plugin-video-parser-all 1.0.7 → 1.0.8
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 +8 -2
- package/lib/index.js +26 -6
- package/package.json +2 -2
- package/readme.md +11 -23
package/lib/index.d.ts
CHANGED
|
@@ -29,7 +29,10 @@ export declare const Config: Schema<{
|
|
|
29
29
|
primaryApiUrl?: string | null | undefined;
|
|
30
30
|
backupApiUrl?: string | null | undefined;
|
|
31
31
|
useDedicatedApiFirst?: boolean | null | undefined;
|
|
32
|
-
|
|
32
|
+
customApis?: ({
|
|
33
|
+
platform?: "bilibili" | "douyin" | "kuaishou" | "xiaohongshu" | "weibo" | "xigua" | "youtube" | "tiktok" | "acfun" | "zhihu" | "weishi" | "huya" | "haokan" | "meipai" | "twitter" | "instagram" | "doubao" | null | undefined;
|
|
34
|
+
apiUrl?: string | null | undefined;
|
|
35
|
+
} & import("cosmokit").Dict)[] | null | undefined;
|
|
33
36
|
} & {
|
|
34
37
|
waitingTipText?: string | null | undefined;
|
|
35
38
|
unsupportedPlatformText?: string | null | undefined;
|
|
@@ -65,7 +68,10 @@ export declare const Config: Schema<{
|
|
|
65
68
|
primaryApiUrl: string;
|
|
66
69
|
backupApiUrl: string;
|
|
67
70
|
useDedicatedApiFirst: boolean;
|
|
68
|
-
|
|
71
|
+
customApis: Schemastery.ObjectT<{
|
|
72
|
+
platform: Schema<"bilibili" | "douyin" | "kuaishou" | "xiaohongshu" | "weibo" | "xigua" | "youtube" | "tiktok" | "acfun" | "zhihu" | "weishi" | "huya" | "haokan" | "meipai" | "twitter" | "instagram" | "doubao", "bilibili" | "douyin" | "kuaishou" | "xiaohongshu" | "weibo" | "xigua" | "youtube" | "tiktok" | "acfun" | "zhihu" | "weishi" | "huya" | "haokan" | "meipai" | "twitter" | "instagram" | "doubao">;
|
|
73
|
+
apiUrl: Schema<string, string>;
|
|
74
|
+
}>[];
|
|
69
75
|
} & {
|
|
70
76
|
waitingTipText: string;
|
|
71
77
|
unsupportedPlatformText: string;
|
package/lib/index.js
CHANGED
|
@@ -49,7 +49,28 @@ exports.Config = koishi_1.Schema.intersect([
|
|
|
49
49
|
primaryApiUrl: koishi_1.Schema.string().default('https://api.bugpk.com/api/short_videos').description('主 API 地址'),
|
|
50
50
|
backupApiUrl: koishi_1.Schema.string().default('https://api.bugpk.com/api/svparse').description('备用主 API 地址(仅支持抖音/小红书/ins/即梦)'),
|
|
51
51
|
useDedicatedApiFirst: koishi_1.Schema.boolean().default(false).description('优先使用平台专属 API,失败后回退到通用 API'),
|
|
52
|
-
|
|
52
|
+
customApis: koishi_1.Schema.array(koishi_1.Schema.object({
|
|
53
|
+
platform: koishi_1.Schema.union([
|
|
54
|
+
'bilibili',
|
|
55
|
+
'douyin',
|
|
56
|
+
'kuaishou',
|
|
57
|
+
'xiaohongshu',
|
|
58
|
+
'weibo',
|
|
59
|
+
'xigua',
|
|
60
|
+
'youtube',
|
|
61
|
+
'tiktok',
|
|
62
|
+
'acfun',
|
|
63
|
+
'zhihu',
|
|
64
|
+
'weishi',
|
|
65
|
+
'huya',
|
|
66
|
+
'haokan',
|
|
67
|
+
'meipai',
|
|
68
|
+
'twitter',
|
|
69
|
+
'instagram',
|
|
70
|
+
'doubao',
|
|
71
|
+
]).description('选择平台'),
|
|
72
|
+
apiUrl: koishi_1.Schema.string().description('API 地址'),
|
|
73
|
+
})).default([]).description('自定义平台专属 API,可覆盖默认专属 API'),
|
|
53
74
|
}).description('API 选择设置'),
|
|
54
75
|
koishi_1.Schema.object({
|
|
55
76
|
waitingTipText: koishi_1.Schema.string().default('正在解析视频,请稍候...').description('解析等待提示'),
|
|
@@ -463,8 +484,10 @@ function apply(ctx, config) {
|
|
|
463
484
|
};
|
|
464
485
|
const backupSupportedPlatforms = new Set(['douyin', 'xiaohongshu', 'instagram', 'jimeng']);
|
|
465
486
|
function getDedicatedApiUrl(type) {
|
|
466
|
-
if (config.
|
|
467
|
-
|
|
487
|
+
if (config.customApis && Array.isArray(config.customApis)) {
|
|
488
|
+
const found = config.customApis.find((item) => item.platform === type);
|
|
489
|
+
if (found && found.apiUrl)
|
|
490
|
+
return found.apiUrl;
|
|
468
491
|
}
|
|
469
492
|
return defaultDedicatedApis[type] || null;
|
|
470
493
|
}
|
|
@@ -486,9 +509,6 @@ function apply(ctx, config) {
|
|
|
486
509
|
apiList.push({ url: primaryApi, label: '默认主API' });
|
|
487
510
|
if (backupAllowed)
|
|
488
511
|
apiList.push({ url: backupApi, label: '备用主API' });
|
|
489
|
-
if (dedicatedApiUrl) {
|
|
490
|
-
// already tried dedicated first, don't repeat
|
|
491
|
-
}
|
|
492
512
|
}
|
|
493
513
|
else {
|
|
494
514
|
apiList.push({ url: primaryApi, label: '默认主API' });
|
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.0.
|
|
4
|
+
"version": "1.0.8",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -76,4 +76,4 @@
|
|
|
76
76
|
"engines": {
|
|
77
77
|
"node": ">=16.0.0"
|
|
78
78
|
}
|
|
79
|
-
}
|
|
79
|
+
}
|
package/readme.md
CHANGED
|
@@ -3,30 +3,10 @@
|
|
|
3
3
|
## 项目介绍 (Project Introduction)
|
|
4
4
|
|
|
5
5
|
### 中文
|
|
6
|
-
这是一个为 Koishi 机器人框架开发的**全平台视频/图集解析插件**,使用统一API接口,支持自动识别并解析抖音、快手、B站、小红书、微博、YouTube、TikTok、剪映、AcFun、知乎、虎牙等20
|
|
7
|
-
- 🌐 统一API解析,覆盖20+热门平台,无需繁琐配置
|
|
8
|
-
- 🤖 自动识别链接来源,即丢即用,并支持解析 XML/JSON 卡片消息中的链接(如 QQ/OneBot 平台的分享卡片)
|
|
9
|
-
- 🎨 完全自定义的解析结果格式,支持多项变量替换,变量无值自动隐藏行
|
|
10
|
-
- 🐛 内置Debug调试模式,可详细记录所有操作与API交互日志
|
|
11
|
-
- 📤 支持OneBot平台消息合并转发,优化多图文展示体验
|
|
12
|
-
- 💬 所有提示文案均可自定义,适配多语言场景
|
|
13
|
-
- 🔁 消息发送支持自动重试,与API重试配置联动,增强稳定性
|
|
14
|
-
- 🚀 内置LRU内存缓存,避免短时间内重复解析同一链接;串行解析防止API限流
|
|
15
|
-
- ⚡ 智能视频发送策略:优先直接发送URL,失败自动降级为本地文件发送
|
|
16
|
-
- 🛡️ 可选视频大小限制,防止超大文件占满服务器磁盘;自动清理所有临时文件
|
|
6
|
+
这是一个为 Koishi 机器人框架开发的**全平台视频/图集解析插件**,使用统一API接口,支持自动识别并解析抖音、快手、B站、小红书、微博、YouTube、TikTok、剪映、AcFun、知乎、虎牙等20+主流平台的短视频/图集/实况链接。
|
|
17
7
|
|
|
18
8
|
### English
|
|
19
|
-
This is a **multi-platform video/image parsing plugin** developed for the Koishi bot framework, using a unified API interface to automatically recognize and parse short video/image/live photo links from 20+ mainstream platforms such as Douyin, Kuaishou, Bilibili, Xiaohongshu, Weibo, YouTube, TikTok, Jianying, AcFun, Zhihu, Huya and more.
|
|
20
|
-
- 🌐 Unified API parsing, covering 20+ popular platforms without complex configuration
|
|
21
|
-
- 🤖 Auto-detection of link sources, drop & go, and support for extracting links from XML/JSON card messages (e.g., share cards on QQ/OneBot)
|
|
22
|
-
- 🎨 Fully customizable parsing result format with variable substitutions, empty variables hide the line automatically
|
|
23
|
-
- 🐛 Built-in Debug mode, recording detailed operations and API interaction logs
|
|
24
|
-
- 📤 Support OneBot message forwarding for better image/video display
|
|
25
|
-
- 💬 All prompt texts are customizable for multilingual scenarios
|
|
26
|
-
- 🔁 Message sending supports automatic retries, linked with API retry configuration for improved stability
|
|
27
|
-
- 🚀 Built-in LRU memory cache to avoid repeated parsing of the same URL; serial parsing to prevent API rate limiting
|
|
28
|
-
- ⚡ Smart video sending strategy: priority to send URL directly, auto downgrade to local file on failure
|
|
29
|
-
- 🛡️ Optional video size limit to prevent oversized files from filling up server disk; automatic cleanup of all temporary files
|
|
9
|
+
This is a **multi-platform video/image parsing plugin** developed for the Koishi bot framework, using a unified API interface to automatically recognize and parse short video/image/live photo links from 20+ mainstream platforms such as Douyin, Kuaishou, Bilibili, Xiaohongshu, Weibo, YouTube, TikTok, Jianying, AcFun, Zhihu, Huya and more.
|
|
30
10
|
|
|
31
11
|
## 项目仓库 (Repository)
|
|
32
12
|
- GitHub: `https://github.com/Minecraft-1314/koishi-plugin-video-parser-all`
|
|
@@ -71,6 +51,14 @@ This is a **multi-platform video/image parsing plugin** developed for the Koishi
|
|
|
71
51
|
| `videoSendTimeout` | number | 60000 | 视频消息发送超时时间(毫秒,0 为不限制) |
|
|
72
52
|
| `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 |
|
|
73
53
|
|
|
54
|
+
### API 选择与回退设置
|
|
55
|
+
| 配置项 | 类型 | 默认值 | 说明 |
|
|
56
|
+
|--------|------|--------|------|
|
|
57
|
+
| `primaryApiUrl` | string | `https://api.bugpk.com/api/short_videos` | 主 API 地址,解析时优先使用 |
|
|
58
|
+
| `backupApiUrl` | string | `https://api.bugpk.com/api/svparse` | 备用主 API 地址,仅支持抖音、小红书、Instagram、即梦平台解析 |
|
|
59
|
+
| `useDedicatedApiFirst` | boolean | false | 是否优先使用平台专属 API,失败后依次回退到主 API、备用主 API |
|
|
60
|
+
| `customApis` | array | [] | 自定义平台专属 API 列表,每项需选择平台并填写 API 地址,可覆盖内置的默认专属 API |
|
|
61
|
+
|
|
74
62
|
### 错误与重试设置
|
|
75
63
|
| 配置项 | 类型 | 默认值 | 说明 |
|
|
76
64
|
|--------|------|--------|------|
|
|
@@ -81,7 +69,7 @@ This is a **multi-platform video/image parsing plugin** developed for the Koishi
|
|
|
81
69
|
### 发送方式设置
|
|
82
70
|
| 配置项 | 类型 | 默认值 | 说明 |
|
|
83
71
|
|--------|------|--------|------|
|
|
84
|
-
| `enableForward` | boolean | false | 是否启用合并转发(仅 OneBot
|
|
72
|
+
| `enableForward` | boolean | false | 是否启用合并转发(仅 OneBot 平台),启用后视频与图文将整合进同一条合并消息 |
|
|
85
73
|
|
|
86
74
|
### 界面文字设置
|
|
87
75
|
| 配置项 | 类型 | 默认值 | 说明 |
|