diff --git a/netlify/edge-functions/now-playing.js b/netlify/edge-functions/now-playing.js index 31626a41..009e2f50 100644 --- a/netlify/edge-functions/now-playing.js +++ b/netlify/edge-functions/now-playing.js @@ -23,6 +23,14 @@ const artistAliases = { ], } +const sanitizeTrack = (track) => { + track.replace( + '(2001 Version) [feat. Markus Johnsson, Thomas Einarsson, Tobias Gustavsson & Daniel Erlandsson] [2001]', + '' + ) + return track +} + const aliasArtist = (artist) => { const aliased = artistAliases.aliases.find((alias) => alias.aliases.includes(artist)) if (aliased) artist = aliased.artist @@ -91,8 +99,10 @@ export default async () => { : `https://musicbrainz.org/search?query=${track['artistName'].replace(/\s+/g, '+')}&type=artist` return Response.json({ - text: `🎧 ${track['name']} by ${artist}`, - html: `🎧 ${track['name']} by ${artist}`, + text: `🎧 ${sanitizeTrack(track['name'])} by ${artist}`, + html: `🎧 ${sanitizeTrack( + track['name'] + )} by ${artist}`, }) }