🐞 fix: 修复netease解析的部分问题

This commit is contained in:
zhiyu1998 2023-04-10 23:16:14 +08:00
parent 03ee875a79
commit 24bb343e59
2 changed files with 6 additions and 5 deletions

View File

@ -247,7 +247,7 @@ export class neteasepro extends plugin {
// 非小程序 // 非小程序
const title = await getSongDetail(id).then(res => { const title = await getSongDetail(id).then(res => {
const song = res.songs?.[0]; const song = res.songs?.[0];
return song.length > 0 return song?.length > 0
? `${song?.name}-${song?.ar?.[0].name}`.replace(/[\/\?<>\\:\*\|".… ]/g, "") ? `${song?.name}-${song?.ar?.[0].name}`.replace(/[\/\?<>\\:\*\|".… ]/g, "")
: "暂无信息"; : "暂无信息";
}); });

View File

@ -793,17 +793,18 @@ export class tools extends plugin {
// 小红书解析 // 小红书解析
async redbook(e) { async redbook(e) {
// 解析短号 // 正则说明匹配手机链接、匹配小程序、匹配PC链接
let msgUrl = let msgUrl =
/(http:|https:)\/\/(xhslink|xiaohongshu).com\/[A-Za-z\d._?%&+\-=\/#@]*/.exec( /(http:|https:)\/\/(xhslink|xiaohongshu).com\/[A-Za-z\d._?%&+\-=\/#@]*/.exec(
e.msg, e.msg,
)?.[0] )?.[0]
|| /(http:|https:)\/\/www\.xiaohongshu\.com\/discovery\/item\/(\w+)/.exec( || /(http:|https:)\/\/www\.xiaohongshu\.com\/discovery\/item\/(\w+)/.exec(
e.message[0].data, e.message[0].data,
)?.[0] )?.[0]
|| /(http:|https:)\/\/www\.xiaohongshu\.com\/explore\/(\w+)/.exec( || /(http:|https:)\/\/www\.xiaohongshu\.com\/explore\/(\w+)/.exec(
e.msg, e.msg,
)?.[0] )?.[0]
// 解析短号
let id; let id;
if (msgUrl.includes("xhslink")) { if (msgUrl.includes("xhslink")) {
await fetch(msgUrl, { await fetch(msgUrl, {