🐞 fix: 修复网易云解析部分匹配问题

This commit is contained in:
zhiyu1998 2023-03-12 02:47:17 +08:00
parent b76a452404
commit 189812915a

View File

@ -644,8 +644,7 @@ export class tools extends plugin {
async netease(e) {
const message = e.msg === undefined ? e.message.shift().data.replaceAll("\\", "") : e.msg.trim();
const musicUrlReg = /(http:|https:)\/\/music.163.com\/song\/media\/outer\/url\?id=(\d+)/;
const realMusicUrl = musicUrlReg.exec(message)[0];
const id = musicUrlReg.exec(message)[2];
const id = /id=(\d+)/.exec(message)[1] || musicUrlReg.exec(message)[2];
console.log(id);
fetch(`https://api.vvhan.com/api/music?id=${id}&type=song&media=netease`, {
headers: {