yz-yuki-plugin 2.0.7-0 → 2.0.7-1
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/apps/bilibili.js +22 -18
- package/package.json +1 -1
package/lib/apps/bilibili.js
CHANGED
|
@@ -503,24 +503,26 @@ message.use(async (e) => {
|
|
|
503
503
|
logger?.info(`优纪B站视频链接解析配置文件已设置关闭,解析终止。`);
|
|
504
504
|
return;
|
|
505
505
|
}
|
|
506
|
-
const
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
506
|
+
const videoIDMatch = e.msg.match(/(b23\.tv\/([a-zA-Z0-9]+))|(www\.bilibili\.com\/video\/)?(av\d+|BV[a-zA-Z0-9]+)/);
|
|
507
|
+
let videoID;
|
|
508
|
+
if (videoIDMatch) {
|
|
509
|
+
if (videoIDMatch[2]) {
|
|
510
|
+
// 匹配 b23.tv/ 后面的部分
|
|
511
|
+
const bvidStr = await new BilibiliWebDataFetcher(e).getBVIDByShortUrl(videoIDMatch[2]);
|
|
512
|
+
videoID = { bvid: bvidStr };
|
|
513
|
+
}
|
|
514
|
+
else if (videoIDMatch[4].startsWith('av')) {
|
|
515
|
+
// 匹配 av 开头的部分
|
|
516
|
+
const aid = videoIDMatch[4].replace(/^av/, '');
|
|
517
|
+
videoID = { aid: Number(aid) };
|
|
518
|
+
}
|
|
519
|
+
else if (videoIDMatch[4].startsWith('BV')) {
|
|
520
|
+
// 匹配 BV 开头的部分
|
|
521
|
+
videoID = { bvid: videoIDMatch[4] };
|
|
522
|
+
}
|
|
521
523
|
}
|
|
522
524
|
e.reply('优纪酱解析中,请稍后~');
|
|
523
|
-
const res = await new BilibiliWebDataFetcher(e).getBiliVideoInfoByAid_BV(
|
|
525
|
+
const res = await new BilibiliWebDataFetcher(e).getBiliVideoInfoByAid_BV(videoID);
|
|
524
526
|
if (res?.statusText !== 'OK') {
|
|
525
527
|
e.reply('诶嘿,出了点网络问题,等会再试试吧~');
|
|
526
528
|
return;
|
|
@@ -585,11 +587,13 @@ message.use(async (e) => {
|
|
|
585
587
|
`\n--------------------`,
|
|
586
588
|
`\n${formatNumber(data?.stat?.view)}播放 • ${formatNumber(data?.stat?.danmaku)}弹幕 • ${formatNumber(data?.stat?.reply)}评论 `,
|
|
587
589
|
`\n${formatNumber(data?.stat?.like)}点赞 • ${formatNumber(data?.stat?.coin)}投币 • ${formatNumber(data?.stat?.favorite)}收藏`,
|
|
588
|
-
`\n${formatNumber(data?.stat?.share)}
|
|
590
|
+
`\n${formatNumber(data?.stat?.share)}分享`,
|
|
591
|
+
`\n--------------------`,
|
|
592
|
+
`\n链接:b23.tv/${data?.bvid}`
|
|
589
593
|
];
|
|
590
594
|
e.reply(message);
|
|
591
595
|
}
|
|
592
|
-
}, [/(b23\.tv\/[a-zA-Z0-9]+)|(www\.bilibili\.com\/video\/)?(av\d+|BV[a-zA-Z0-9]+)/]);
|
|
596
|
+
}, [/(b23\.tv\/([a-zA-Z0-9]+))|(www\.bilibili\.com\/video\/)?(av\d+|BV[a-zA-Z0-9]+)/]);
|
|
593
597
|
const YukiBli = message.ok;
|
|
594
598
|
|
|
595
599
|
export { YukiBli };
|