koishi-plugin-video-parser-all 0.8.3 → 0.8.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.js +3 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -428,6 +428,7 @@ function apply(ctx, config) {
|
|
|
428
428
|
initDebug(config.debug, config.debugFile);
|
|
429
429
|
debugLog('INFO', '插件初始化开始');
|
|
430
430
|
debugLog('INFO', '当前配置:', config);
|
|
431
|
+
// 合并默认文案
|
|
431
432
|
const texts = {
|
|
432
433
|
waitingTipText: config.waitingTipText || '正在解析视频,请稍候...',
|
|
433
434
|
duplicateLinkText: config.duplicateLinkText || '请勿重复解析相同链接',
|
|
@@ -471,6 +472,7 @@ function apply(ctx, config) {
|
|
|
471
472
|
}
|
|
472
473
|
async function parseUrl(url) {
|
|
473
474
|
debugLog('INFO', `开始解析链接: ${url}`);
|
|
475
|
+
// 尝试短链接解析
|
|
474
476
|
const realUrl = await resolveShortUrl(url);
|
|
475
477
|
debugLog('DEBUG', `重定向后的URL: ${realUrl}`);
|
|
476
478
|
const platform = getPlatformType(realUrl);
|
|
@@ -478,6 +480,7 @@ function apply(ctx, config) {
|
|
|
478
480
|
debugLog('WARN', `不支持的平台: ${realUrl}`);
|
|
479
481
|
return { success: false, msg: texts.unsupportedPlatformText };
|
|
480
482
|
}
|
|
483
|
+
// 优先使用原始短链接尝试,若失败再用重定向后的URL
|
|
481
484
|
const candidates = [url, realUrl];
|
|
482
485
|
let lastError = null;
|
|
483
486
|
for (const candidate of candidates) {
|
package/package.json
CHANGED