koishi-plugin-video-parser-all 1.4.2 → 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 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('梨视频'),
@@ -295,45 +297,47 @@ function debugLog(level, ...args) {
295
297
  logger.info(`[${new Date().toISOString()}] [${level}] ${args.map(a => typeof a === 'object' ? JSON.stringify(a) : String(a)).join(' ')}`);
296
298
  }
297
299
  const BUILTIN_LINK_RULES = [
298
- { pattern: /https?:\/\/(?:www\.)?bilibili\.com\/video\/([ab]v[0-9a-zA-Z_-]+)/gi, type: 'bilibili' },
299
- { pattern: /https?:\/\/b23\.tv\/[0-9a-zA-Z_-]{5,}/gi, type: 'bilibili' },
300
- { pattern: /https?:\/\/bili\d+\.cn\/[0-9a-zA-Z_-]{5,}/gi, type: 'bilibili' },
301
- { pattern: /https?:\/\/(?:www\.)?douyin\.com\/video\/\d{10,}/gi, type: 'douyin' },
302
- { pattern: /https?:\/\/v\.douyin\.com\/[0-9a-zA-Z_-]{8,}/gi, type: 'douyin' },
303
- { pattern: /https?:\/\/(?:www\.)?kuaishou\.com\/short-video\/[0-9a-zA-Z_-]{10,}/gi, type: 'kuaishou' },
304
- { pattern: /https?:\/\/v\.kuaishou\.com\/[0-9a-zA-Z_-]{8,}/gi, type: 'kuaishou' },
305
- { pattern: /https?:\/\/(?:www\.)?xiaohongshu\.com\/discovery\/item\/[0-9a-zA-Z_-]{10,}/gi, type: 'xiaohongshu' },
306
- { pattern: /https?:\/\/xhslink\.com\/[0-9a-zA-Z_-]{8,}/gi, type: 'xiaohongshu' },
307
- { pattern: /https?:\/\/weibo\.com\/\d+\/[0-9a-zA-Z_-]{10,}/gi, type: 'weibo' },
308
- { pattern: /https?:\/\/video\.weibo\.com\/show\?fid=[0-9a-zA-Z_-]{10,}/gi, type: 'weibo' },
309
- { pattern: /https?:\/\/(?:www\.)?ixigua\.com\/\d{10,}/gi, type: 'xigua' },
310
- { pattern: /https?:\/\/(?:www\.)?youtube\.com\/watch\?v=[a-zA-Z0-9_-]{11}/gi, type: 'youtube' },
311
- { pattern: /https?:\/\/youtu\.be\/[a-zA-Z0-9_-]{11}/gi, type: 'youtube' },
312
- { pattern: /https?:\/\/(?:www\.)?tiktok\.com\/@[\w.]+\/video\/\d{10,}/gi, type: 'tiktok' },
313
- { pattern: /https?:\/\/vm\.tiktok\.com\/[0-9a-zA-Z_-]{8,}/gi, type: 'tiktok' },
314
- { pattern: /https?:\/\/(?:www\.)?acfun\.cn\/v\/ac\d{10,}/gi, type: 'acfun' },
315
- { pattern: /https?:\/\/(?:www\.)?zhihu\.com\/video\/\d{10,}/gi, type: 'zhihu' },
316
- { pattern: /https?:\/\/weishi\.qq\.com\/weishi\/feed\/[0-9a-zA-Z_-]{10,}/gi, type: 'weishi' },
317
- { pattern: /https?:\/\/(?:www\.)?huya\.com\/video\/[0-9a-zA-Z_-]{10,}/gi, type: 'huya' },
318
- { pattern: /https?:\/\/haokan\.baidu\.com\/v\?vid=[0-9a-zA-Z_-]{10,}/gi, type: 'haokan' },
319
- { pattern: /https?:\/\/(?:www\.)?meipai\.com\/media\/\d{10,}/gi, type: 'meipai' },
320
- { pattern: /https?:\/\/twitter\.com\/\w+\/status\/\d{10,}/gi, type: 'twitter' },
321
- { pattern: /https?:\/\/x\.com\/\w+\/status\/\d{10,}/gi, type: 'twitter' },
322
- { pattern: /https?:\/\/(?:www\.)?instagram\.com\/p\/[0-9a-zA-Z_-]{10,}/gi, type: 'instagram' },
323
- { pattern: /https?:\/\/(?:www\.)?doubao\.com\/video\/\d{10,}/gi, type: 'doubao' },
324
- { pattern: /https?:\/\/(?:www\.)?oasis\.weibo\.com\/v\/[0-9a-zA-Z_-]+/gi, type: 'oasis' },
325
- { pattern: /https?:\/\/channels\.weixin\.qq\.com\/[0-9a-zA-Z_-]+/gi, type: 'wechat_channel' },
326
- { pattern: /https?:\/\/weixin\.qq\.com\/sph\/[0-9a-zA-Z_-]+/gi, type: 'wechat_channel' },
327
- { pattern: /https?:\/\/(?:www\.)?pearvideo\.com\/video_\d+/gi, type: 'lishi' },
328
- { pattern: /https?:\/\/video\.li\/[0-9a-zA-Z_-]{3,}/gi, type: 'lishi' },
329
- { pattern: /https?:\/\/(?:www\.)?quanmin\.tv\/\w+/gi, type: 'quanmin' },
330
- { pattern: /https?:\/\/(?:www\.)?quanmintv\.cn\/\w+/gi, type: 'quanmin' },
331
- { pattern: /https?:\/\/h5\.pipigx\.com\/pp\/post\/\d+/gi, type: 'pipigx' },
332
- { pattern: /https?:\/\/(?:www\.)?ippzone\.com\/\w+/gi, type: 'pipigx' },
333
- { pattern: /https?:\/\/(?:h5|www)\.pipix\.com\/\w+/gi, type: 'pipixia' },
334
- { pattern: /https?:\/\/(?:www\.)?pipixia\.com\/\w+/gi, type: 'pipixia' },
335
- { pattern: /https?:\/\/share\.xiaochuankeji\.cn\/hybrid\/share\/post\?pid=\d+/gi, type: 'zuiyou' },
336
- { pattern: /https?:\/\/(?:h5|www)\.izuiyou\.com\/\w+/gi, type: 'zuiyou' },
300
+ { pattern: /https?:\/\/(?:www\.)?bilibili\.com\/video\/([ab]v[0-9a-zA-Z_-]+)[^\s]*/gi, type: 'bilibili' },
301
+ { pattern: /https?:\/\/b23\.tv\/[0-9a-zA-Z_-]{5,}[^\s]*/gi, type: 'bilibili' },
302
+ { pattern: /https?:\/\/bili\d+\.cn\/[0-9a-zA-Z_-]{5,}[^\s]*/gi, type: 'bilibili' },
303
+ { pattern: /https?:\/\/(?:www\.)?douyin\.com\/video\/\d{10,}[^\s]*/gi, type: 'douyin' },
304
+ { pattern: /https?:\/\/v\.douyin\.com\/[0-9a-zA-Z_-]{8,}[^\s]*/gi, type: 'douyin' },
305
+ { pattern: /https?:\/\/(?:www\.)?kuaishou\.com\/short-video\/[0-9a-zA-Z_-]{10,}[^\s]*/gi, type: 'kuaishou' },
306
+ { pattern: /https?:\/\/v\.kuaishou\.com\/[0-9a-zA-Z_-]{8,}[^\s]*/gi, type: 'kuaishou' },
307
+ { pattern: /https?:\/\/(?:www\.)?xiaohongshu\.com\/discovery\/item\/[0-9a-zA-Z_-]{10,}[^\s]*/gi, type: 'xiaohongshu' },
308
+ { pattern: /https?:\/\/xhslink\.com\/[0-9a-zA-Z_-]{8,}[^\s]*/gi, type: 'xiaohongshu' },
309
+ { pattern: /https?:\/\/weibo\.com\/\d+\/[0-9a-zA-Z_-]{10,}[^\s]*/gi, type: 'weibo' },
310
+ { pattern: /https?:\/\/video\.weibo\.com\/show\?fid=[0-9a-zA-Z_-]{10,}[^\s]*/gi, type: 'weibo' },
311
+ { pattern: /https?:\/\/(?:www\.)?ixigua\.com\/\d{10,}[^\s]*/gi, type: 'xigua' },
312
+ { pattern: /https?:\/\/(?:www\.)?youtube\.com\/watch\?v=[a-zA-Z0-9_-]{11}[^\s]*/gi, type: 'youtube' },
313
+ { pattern: /https?:\/\/youtu\.be\/[a-zA-Z0-9_-]{11}[^\s]*/gi, type: 'youtube' },
314
+ { pattern: /https?:\/\/(?:www\.)?tiktok\.com\/@[\w.]+\/video\/\d{10,}[^\s]*/gi, type: 'tiktok' },
315
+ { pattern: /https?:\/\/vm\.tiktok\.com\/[0-9a-zA-Z_-]{8,}[^\s]*/gi, type: 'tiktok' },
316
+ { pattern: /https?:\/\/(?:www\.)?acfun\.cn\/v\/ac\d{10,}[^\s]*/gi, type: 'acfun' },
317
+ { pattern: /https?:\/\/(?:www\.)?zhihu\.com\/video\/\d{10,}[^\s]*/gi, type: 'zhihu' },
318
+ { pattern: /https?:\/\/weishi\.qq\.com\/weishi\/feed\/[0-9a-zA-Z_-]{10,}[^\s]*/gi, type: 'weishi' },
319
+ { pattern: /https?:\/\/(?:www\.)?huya\.com\/video\/[0-9a-zA-Z_-]{10,}[^\s]*/gi, type: 'huya' },
320
+ { pattern: /https?:\/\/haokan\.baidu\.com\/v\?vid=[0-9a-zA-Z_-]{10,}[^\s]*/gi, type: 'haokan' },
321
+ { pattern: /https?:\/\/(?:www\.)?meipai\.com\/media\/\d{10,}[^\s]*/gi, type: 'meipai' },
322
+ { pattern: /https?:\/\/twitter\.com\/\w+\/status\/\d{10,}[^\s]*/gi, type: 'twitter' },
323
+ { pattern: /https?:\/\/x\.com\/\w+\/status\/\d{10,}[^\s]*/gi, type: 'twitter' },
324
+ { pattern: /https?:\/\/(?:www\.)?instagram\.com\/p\/[0-9a-zA-Z_-]{10,}[^\s]*/gi, type: 'instagram' },
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' },
328
+ { pattern: /https?:\/\/(?:www\.)?oasis\.weibo\.com\/v\/[0-9a-zA-Z_-]+[^\s]*/gi, type: 'oasis' },
329
+ { pattern: /https?:\/\/channels\.weixin\.qq\.com\/[0-9a-zA-Z_-]+[^\s]*/gi, type: 'wechat_channel' },
330
+ { pattern: /https?:\/\/weixin\.qq\.com\/sph\/[0-9a-zA-Z_-]+[^\s]*/gi, type: 'wechat_channel' },
331
+ { pattern: /https?:\/\/(?:www\.)?pearvideo\.com\/video_\d+[^\s]*/gi, type: 'lishi' },
332
+ { pattern: /https?:\/\/video\.li\/[0-9a-zA-Z_-]{3,}[^\s]*/gi, type: 'lishi' },
333
+ { pattern: /https?:\/\/(?:www\.)?quanmin\.tv\/\w+[^\s]*/gi, type: 'quanmin' },
334
+ { pattern: /https?:\/\/(?:www\.)?quanmintv\.cn\/\w+[^\s]*/gi, type: 'quanmin' },
335
+ { pattern: /https?:\/\/h5\.pipigx\.com\/pp\/post\/\d+[^\s]*/gi, type: 'pipigx' },
336
+ { pattern: /https?:\/\/(?:www\.)?ippzone\.com\/\w+[^\s]*/gi, type: 'pipigx' },
337
+ { pattern: /https?:\/\/(?:h5|www)\.pipix\.com\/\w+[^\s]*/gi, type: 'pipixia' },
338
+ { pattern: /https?:\/\/(?:www\.)?pipixia\.com\/\w+[^\s]*/gi, type: 'pipixia' },
339
+ { pattern: /https?:\/\/share\.xiaochuankeji\.cn\/hybrid\/share\/post\?pid=\d+[^\s]*/gi, type: 'zuiyou' },
340
+ { pattern: /https?:\/\/(?:h5|www)\.izuiyou\.com\/\w+[^\s]*/gi, type: 'zuiyou' },
337
341
  ];
338
342
  function buildCustomLinkRules(customPlatforms) {
339
343
  if (!Array.isArray(customPlatforms) || customPlatforms.length === 0)
@@ -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
- items.push(result.data);
993
- if (config.deduplicationInterval > 0)
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
@@ -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.4.2",
4
+ "version": "1.4.4",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [