koishi-plugin-video-parser-all 1.4.3 → 1.4.4
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 +4 -0
- package/lib/index.js +20 -2
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export declare const Config: Schema<{
|
|
|
30
30
|
twitter?: boolean | null | undefined;
|
|
31
31
|
instagram?: boolean | null | undefined;
|
|
32
32
|
doubao?: boolean | null | undefined;
|
|
33
|
+
doubao_image?: boolean | null | undefined;
|
|
33
34
|
oasis?: boolean | null | undefined;
|
|
34
35
|
wechat_channel?: boolean | null | undefined;
|
|
35
36
|
lishi?: boolean | null | undefined;
|
|
@@ -111,6 +112,7 @@ export declare const Config: Schema<{
|
|
|
111
112
|
twitter?: boolean | null | undefined;
|
|
112
113
|
instagram?: boolean | null | undefined;
|
|
113
114
|
doubao?: boolean | null | undefined;
|
|
115
|
+
doubao_image?: boolean | null | undefined;
|
|
114
116
|
oasis?: boolean | null | undefined;
|
|
115
117
|
wechat_channel?: boolean | null | undefined;
|
|
116
118
|
lishi?: boolean | null | undefined;
|
|
@@ -177,6 +179,7 @@ export declare const Config: Schema<{
|
|
|
177
179
|
twitter: Schema<boolean, boolean>;
|
|
178
180
|
instagram: Schema<boolean, boolean>;
|
|
179
181
|
doubao: Schema<boolean, boolean>;
|
|
182
|
+
doubao_image: Schema<boolean, boolean>;
|
|
180
183
|
oasis: Schema<boolean, boolean>;
|
|
181
184
|
wechat_channel: Schema<boolean, boolean>;
|
|
182
185
|
lishi: Schema<boolean, boolean>;
|
|
@@ -261,6 +264,7 @@ export declare const Config: Schema<{
|
|
|
261
264
|
twitter: Schema<boolean, boolean>;
|
|
262
265
|
instagram: Schema<boolean, boolean>;
|
|
263
266
|
doubao: Schema<boolean, boolean>;
|
|
267
|
+
doubao_image: Schema<boolean, boolean>;
|
|
264
268
|
oasis: Schema<boolean, boolean>;
|
|
265
269
|
wechat_channel: Schema<boolean, boolean>;
|
|
266
270
|
lishi: Schema<boolean, boolean>;
|
package/lib/index.js
CHANGED
|
@@ -92,6 +92,7 @@ exports.Config = koishi_1.Schema.intersect([
|
|
|
92
92
|
twitter: koishi_1.Schema.boolean().default(true).description('Twitter/X'),
|
|
93
93
|
instagram: koishi_1.Schema.boolean().default(true).description('Instagram'),
|
|
94
94
|
doubao: koishi_1.Schema.boolean().default(true).description('豆包'),
|
|
95
|
+
doubao_image: koishi_1.Schema.boolean().default(true).description('豆包图片'),
|
|
95
96
|
oasis: koishi_1.Schema.boolean().default(true).description('绿洲'),
|
|
96
97
|
wechat_channel: koishi_1.Schema.boolean().default(true).description('视频号'),
|
|
97
98
|
lishi: koishi_1.Schema.boolean().default(true).description('梨视频'),
|
|
@@ -188,6 +189,7 @@ exports.Config = koishi_1.Schema.intersect([
|
|
|
188
189
|
twitter: koishi_1.Schema.boolean().default(false).description('Twitter/X'),
|
|
189
190
|
instagram: koishi_1.Schema.boolean().default(false).description('Instagram'),
|
|
190
191
|
doubao: koishi_1.Schema.boolean().default(false).description('豆包'),
|
|
192
|
+
doubao_image: koishi_1.Schema.boolean().default(false).description('豆包图片'),
|
|
191
193
|
oasis: koishi_1.Schema.boolean().default(false).description('绿洲'),
|
|
192
194
|
wechat_channel: koishi_1.Schema.boolean().default(false).description('视频号'),
|
|
193
195
|
lishi: koishi_1.Schema.boolean().default(false).description('梨视频'),
|
|
@@ -321,6 +323,8 @@ const BUILTIN_LINK_RULES = [
|
|
|
321
323
|
{ pattern: /https?:\/\/x\.com\/\w+\/status\/\d{10,}[^\s]*/gi, type: 'twitter' },
|
|
322
324
|
{ pattern: /https?:\/\/(?:www\.)?instagram\.com\/p\/[0-9a-zA-Z_-]{10,}[^\s]*/gi, type: 'instagram' },
|
|
323
325
|
{ pattern: /https?:\/\/(?:www\.)?doubao\.com\/video\/\d{10,}[^\s]*/gi, type: 'doubao' },
|
|
326
|
+
{ pattern: /https?:\/\/(?:www\.)?doubao\.com\/video-sharing\?[^\s]*/gi, type: 'doubao' },
|
|
327
|
+
{ pattern: /https?:\/\/(?:www\.)?doubao\.com\/thread\/[^\s]+/gi, type: 'doubao_image' },
|
|
324
328
|
{ pattern: /https?:\/\/(?:www\.)?oasis\.weibo\.com\/v\/[0-9a-zA-Z_-]+[^\s]*/gi, type: 'oasis' },
|
|
325
329
|
{ pattern: /https?:\/\/channels\.weixin\.qq\.com\/[0-9a-zA-Z_-]+[^\s]*/gi, type: 'wechat_channel' },
|
|
326
330
|
{ pattern: /https?:\/\/weixin\.qq\.com\/sph\/[0-9a-zA-Z_-]+[^\s]*/gi, type: 'wechat_channel' },
|
|
@@ -691,6 +695,11 @@ function apply(ctx, config) {
|
|
|
691
695
|
const dedupCache = new SimpleLRUCache(1000, config.deduplicationInterval * 1000);
|
|
692
696
|
const cacheTTL = (config.cacheTTL || 600) * 1000;
|
|
693
697
|
const urlCacheLocal = new SimpleLRUCache(500, cacheTTL);
|
|
698
|
+
const contentDedupCache = new SimpleLRUCache(1000, config.deduplicationInterval * 1000);
|
|
699
|
+
function contentFingerprint(p) {
|
|
700
|
+
const imgSig = p.images?.length ? p.images.slice(0, 3).join('|') : (p.live_photo?.slice(0, 3).map(lp => lp.image).join('|') || '');
|
|
701
|
+
return [p.type, p.title, p.author, p.uid, p.video, imgSig].map(v => String(v ?? '')).join('::');
|
|
702
|
+
}
|
|
694
703
|
const texts = {
|
|
695
704
|
waitingTipText: config.waitingTipText || '正在解析视频,请稍候...',
|
|
696
705
|
unsupportedPlatformText: config.unsupportedPlatformText || '不支持该平台链接',
|
|
@@ -753,6 +762,7 @@ function apply(ctx, config) {
|
|
|
753
762
|
bilibili: 'https://api.bugpk.com/api/bilibili',
|
|
754
763
|
douyin: 'https://api.bugpk.com/api/douyin',
|
|
755
764
|
doubao: 'https://api.bugpk.com/api/dbvideos',
|
|
765
|
+
doubao_image: 'https://api.bugpk.com/api/dbduihua',
|
|
756
766
|
kuaishou: 'https://api.bugpk.com/api/kuaishou',
|
|
757
767
|
xiaohongshu: 'https://api.bugpk.com/api/xhs',
|
|
758
768
|
jimeng: 'https://api.bugpk.com/api/jimengai',
|
|
@@ -989,9 +999,17 @@ function apply(ctx, config) {
|
|
|
989
999
|
const fieldMapping = platformConf.fieldMapping;
|
|
990
1000
|
const result = await processSingleUrl(match.url, match.type, fieldMapping, platformConf);
|
|
991
1001
|
if (result.success) {
|
|
992
|
-
|
|
993
|
-
|
|
1002
|
+
if (config.deduplicationInterval > 0) {
|
|
1003
|
+
const fp = contentFingerprint(result.data.parsed);
|
|
1004
|
+
const lastDedup = contentDedupCache.get(fp);
|
|
1005
|
+
if (lastDedup && (Date.now() - lastDedup < config.deduplicationInterval * 1000)) {
|
|
1006
|
+
debugLog('INFO', `跳过重复内容: ${match.url}`);
|
|
1007
|
+
return;
|
|
1008
|
+
}
|
|
1009
|
+
contentDedupCache.set(fp, Date.now());
|
|
994
1010
|
dedupCache.set(match.url, Date.now());
|
|
1011
|
+
}
|
|
1012
|
+
items.push(result.data);
|
|
995
1013
|
}
|
|
996
1014
|
else {
|
|
997
1015
|
const item = texts.parseErrorItemFormat.replace(/\$\{url\}/g, match.url.length > 50 ? match.url.slice(0, 50) + '...' : match.url).replace(/\$\{msg\}/g, result.msg);
|
package/package.json
CHANGED