add artist images back

This commit is contained in:
vapormusic 2022-02-25 07:19:04 +07:00
parent 76f640a088
commit a2f82d65d7
4 changed files with 51 additions and 10 deletions

View file

@ -3911,6 +3911,21 @@ const app = new Vue({
checkForUpdate() {
ipcRenderer.send('check-for-update')
},
async loadArtistImage(id){
try {
let u = await fetch(`https://music.apple.com/${app.mk.storefrontId}/artist/${id}`);
let html = await u.text();
function getStringBetween(str, start, end) {
const result = str.match(new RegExp(start + "(.*)" + end));
return result[1];
}
let string = getStringBetween(html, '<meta property="og:image:secure_url" content="', "cw.png").replace(`1200x630`, `300x300.png`);
return await string;
} catch (err) {
return await ''
}
}
}
})