koishi-plugin-video-parser-all 1.1.4 → 1.1.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 (2) hide show
  1. package/lib/index.js +5 -4
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -10,7 +10,8 @@ const promises_1 = __importDefault(require("fs/promises"));
10
10
  const path_1 = __importDefault(require("path"));
11
11
  const fs_1 = require("fs");
12
12
  const promises_2 = require("stream/promises");
13
- const lru_cache_1 = __importDefault(require("lru-cache"));
13
+ const LruCacheModule = require('lru-cache');
14
+ const LRUCache = LruCacheModule.LRUCache || LruCacheModule;
14
15
  exports.name = 'video-parser-all';
15
16
  exports.Config = koishi_1.Schema.intersect([
16
17
  koishi_1.Schema.object({
@@ -119,7 +120,7 @@ function debugLog(level, ...args) {
119
120
  }).join(' ')}`;
120
121
  logger.info(message);
121
122
  }
122
- const urlCache = new lru_cache_1.default({
123
+ const urlCache = new LRUCache({
123
124
  max: 500,
124
125
  ttl: 10 * 60 * 1000,
125
126
  updateAgeOnGet: false,
@@ -437,7 +438,7 @@ function getErrorMessage(error) {
437
438
  function apply(ctx, config) {
438
439
  debugEnabled = config.debug || false;
439
440
  debugLog('INFO', '插件初始化开始');
440
- const dedupCache = new lru_cache_1.default({
441
+ const dedupCache = new LRUCache({
441
442
  max: 1000,
442
443
  ttl: config.deduplicationInterval * 1000,
443
444
  });
@@ -481,7 +482,7 @@ function apply(ctx, config) {
481
482
  'Referer': 'https://www.baidu.com/',
482
483
  },
483
484
  validateStatus: (status) => status >= 200 && status < 400,
484
- }); // use any to bypass type check for possible missing maxRedirects
485
+ });
485
486
  const finalUrl = res.request?.res?.responseUrl || url;
486
487
  return cleanUrl(finalUrl);
487
488
  }
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.1.4",
4
+ "version": "1.1.6",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [