1
0
Code Issues Pull Requests Projects Releases Wiki Activity GitHub Gitee

处理 album 极少数情况下 image 正则匹配失败问题

This commit is contained in:
程序员小墨 2022-11-16 16:29:02 +08:00
parent 67af823cde
commit 99a53fc759

View File

@ -137,8 +137,15 @@ async function fetch({ albumId, debug = false, update = false }) {
} }
} }
let image = /<meta property="og:image" content="http:\/\/p.\.music\.126\.net\/(.*?)" \/>/.exec(html)[1]; // 极个别album下面的image正则找不到例如73973625 74009959
let songListJSONString = /<textarea id="song-list-pre-data" style="display:none;">(.*?)<\/textarea>/.exec(html)[1]; let image = "";
try {
image = /<meta property="og:image" content="http:\/\/p.\.music\.126\.net\/(.*?)" \/>/.exec(html)[1];
} catch (e) { }
let songListJSONString = "";
try {
songListJSONString = /<textarea id="song-list-pre-data" style="display:none;">(.*?)<\/textarea>/.exec(html)[1];
} catch (e) { }
let songList = JSON.parse(songListJSONString); let songList = JSON.parse(songListJSONString);
let songIds = songList.map(song => Number(song.id)); let songIds = songList.map(song => Number(song.id));