koishi-plugin-video-parser-all 0.8.4 → 0.8.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 +2 -7
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -10,7 +10,6 @@ const axios_1 = __importDefault(require("axios"));
|
|
|
10
10
|
const crypto_1 = __importDefault(require("crypto"));
|
|
11
11
|
const fs_1 = __importDefault(require("fs"));
|
|
12
12
|
const path_1 = __importDefault(require("path"));
|
|
13
|
-
const url_1 = require("url");
|
|
14
13
|
const promises_1 = require("stream/promises");
|
|
15
14
|
const worker_threads_1 = require("worker_threads");
|
|
16
15
|
exports.name = 'video-parser-all';
|
|
@@ -428,7 +427,6 @@ function apply(ctx, config) {
|
|
|
428
427
|
initDebug(config.debug, config.debugFile);
|
|
429
428
|
debugLog('INFO', '插件初始化开始');
|
|
430
429
|
debugLog('INFO', '当前配置:', config);
|
|
431
|
-
// 合并默认文案
|
|
432
430
|
const texts = {
|
|
433
431
|
waitingTipText: config.waitingTipText || '正在解析视频,请稍候...',
|
|
434
432
|
duplicateLinkText: config.duplicateLinkText || '请勿重复解析相同链接',
|
|
@@ -472,7 +470,6 @@ function apply(ctx, config) {
|
|
|
472
470
|
}
|
|
473
471
|
async function parseUrl(url) {
|
|
474
472
|
debugLog('INFO', `开始解析链接: ${url}`);
|
|
475
|
-
// 尝试短链接解析
|
|
476
473
|
const realUrl = await resolveShortUrl(url);
|
|
477
474
|
debugLog('DEBUG', `重定向后的URL: ${realUrl}`);
|
|
478
475
|
const platform = getPlatformType(realUrl);
|
|
@@ -480,7 +477,6 @@ function apply(ctx, config) {
|
|
|
480
477
|
debugLog('WARN', `不支持的平台: ${realUrl}`);
|
|
481
478
|
return { success: false, msg: texts.unsupportedPlatformText };
|
|
482
479
|
}
|
|
483
|
-
// 优先使用原始短链接尝试,若失败再用重定向后的URL
|
|
484
480
|
const candidates = [url, realUrl];
|
|
485
481
|
let lastError = null;
|
|
486
482
|
for (const candidate of candidates) {
|
|
@@ -597,9 +593,8 @@ function apply(ctx, config) {
|
|
|
597
593
|
const fname = crypto_1.default.createHash('md5').update(p.video).digest('hex');
|
|
598
594
|
const dl = await downloadVideo(p.video, fname, config.userAgent, config.maxVideoSize, config.downloadThreads);
|
|
599
595
|
if (dl.success) {
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
return koishi_1.h.file(fileUrl);
|
|
596
|
+
debugLog('INFO', `视频下载成功,发送文件: ${dl.filePath}`);
|
|
597
|
+
return koishi_1.h.file(dl.filePath);
|
|
603
598
|
}
|
|
604
599
|
}
|
|
605
600
|
debugLog('INFO', `发送视频链接: ${p.video}`);
|
package/package.json
CHANGED