feat: V1.6.5 油管解析适配短链接(youtu.be)

This commit is contained in:
zhiyu1998 2024-04-02 09:51:35 +08:00
parent 71a77fb757
commit a5a9b5c222
2 changed files with 5 additions and 3 deletions

View File

@ -134,7 +134,7 @@ export class tools extends plugin {
fnc: "general", fnc: "general",
}, },
{ {
reg: "(youtube.com)", reg: "(youtube.com|youtu.be)",
fnc: "y2b" fnc: "y2b"
}, },
{ {
@ -1086,7 +1086,9 @@ export class tools extends plugin {
*/ */
async y2b(e) { async y2b(e) {
const urlRex = /(?:https?:\/\/)?(www\.)?youtube\.com\/[A-Za-z\d._?%&+\-=\/#]*/g; const urlRex = /(?:https?:\/\/)?(www\.)?youtube\.com\/[A-Za-z\d._?%&+\-=\/#]*/g;
let url = urlRex.exec(e.msg)[0]; // https://youtu.be/9IoNgzpURDw?si=XlvOAxqqjF9FJYcF
const url2Rex = /(?:https?:\/\/)?youtu\.be\/[A-Za-z\d._?%&+\-=\/#]*/g;
let url = urlRex.exec(e.msg)?.[0] || url2Rex.exec(e.msg)?.[0];
// 判断海外 // 判断海外
const isOversea = await this.isOverseasServer(); const isOversea = await this.isOverseasServer();
// 如果不是海外用户且没有梯子直接返回 // 如果不是海外用户且没有梯子直接返回

View File

@ -1,5 +1,5 @@
- { - {
version: 1.6.4, version: 1.6.5,
data: data:
[ [
新增<span class="cmd">B站扫码</span>功能, 新增<span class="cmd">B站扫码</span>功能,