diff --git a/src/_data/music.js b/src/_data/music.js index b5c6d26c..e234c234 100644 --- a/src/_data/music.js +++ b/src/_data/music.js @@ -51,7 +51,7 @@ module.exports = async function () { while (CURRENT_PAGE < PAGES && hasNextPage) { const URL = `https://api.music.apple.com/v1/me/recent/played/tracks?limit=${PAGE_SIZE}&offset=${ PAGE_SIZE * CURRENT_PAGE - }&extend=album` + }&include[songs]=albums&extend=artistUrl` const tracks = await fetch(URL, { headers: { 'Content-Type': 'application/json', @@ -65,7 +65,6 @@ module.exports = async function () { if (tracks.data.length) res = [...res, ...tracks.data] CURRENT_PAGE++ } - res.forEach((track) => { if (!response.artists[track.attributes['artistName']]) { response.artists[track.attributes['artistName']] = { @@ -81,7 +80,7 @@ module.exports = async function () { name: track.attributes['albumName'], artist: track.attributes['artistName'], art: track.attributes.artwork.url.replace('{w}', '300').replace('{h}', '300'), - url: track.attributes.url, + url: `https://song.link/${track['relationships'].albums.data.pop().attributes.url}`, plays: 1, } } else { diff --git a/src/_includes/partials/now/albums.liquid b/src/_includes/partials/now/albums.liquid index 785a0a36..98a7ac1f 100644 --- a/src/_includes/partials/now/albums.liquid +++ b/src/_includes/partials/now/albums.liquid @@ -5,7 +5,7 @@
{% for album in music.albums %} - +