koishi-plugin-video-parser-all 1.1.4 → 1.1.5
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.js +4 -4
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -10,7 +10,7 @@ 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
|
|
13
|
+
const LRUCache = require("lru-cache");
|
|
14
14
|
exports.name = 'video-parser-all';
|
|
15
15
|
exports.Config = koishi_1.Schema.intersect([
|
|
16
16
|
koishi_1.Schema.object({
|
|
@@ -119,7 +119,7 @@ function debugLog(level, ...args) {
|
|
|
119
119
|
}).join(' ')}`;
|
|
120
120
|
logger.info(message);
|
|
121
121
|
}
|
|
122
|
-
const urlCache = new
|
|
122
|
+
const urlCache = new LRUCache({
|
|
123
123
|
max: 500,
|
|
124
124
|
ttl: 10 * 60 * 1000,
|
|
125
125
|
updateAgeOnGet: false,
|
|
@@ -437,7 +437,7 @@ function getErrorMessage(error) {
|
|
|
437
437
|
function apply(ctx, config) {
|
|
438
438
|
debugEnabled = config.debug || false;
|
|
439
439
|
debugLog('INFO', '插件初始化开始');
|
|
440
|
-
const dedupCache = new
|
|
440
|
+
const dedupCache = new LRUCache({
|
|
441
441
|
max: 1000,
|
|
442
442
|
ttl: config.deduplicationInterval * 1000,
|
|
443
443
|
});
|
|
@@ -481,7 +481,7 @@ function apply(ctx, config) {
|
|
|
481
481
|
'Referer': 'https://www.baidu.com/',
|
|
482
482
|
},
|
|
483
483
|
validateStatus: (status) => status >= 200 && status < 400,
|
|
484
|
-
});
|
|
484
|
+
});
|
|
485
485
|
const finalUrl = res.request?.res?.responseUrl || url;
|
|
486
486
|
return cleanUrl(finalUrl);
|
|
487
487
|
}
|
package/package.json
CHANGED