fix: that's just absurd. stop.

This commit is contained in:
Cory Dransfeldt 2023-10-19 14:10:31 -07:00
parent ce9611c828
commit 1a68888350

View file

@ -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 aliasArtist = (artist) => {
const aliased = artistAliases.aliases.find((alias) => alias.aliases.includes(artist)) const aliased = artistAliases.aliases.find((alias) => alias.aliases.includes(artist))
if (aliased) artist = aliased.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` : `https://musicbrainz.org/search?query=${track['artistName'].replace(/\s+/g, '+')}&type=artist`
return Response.json({ return Response.json({
text: `🎧 ${track['name']} by ${artist}`, text: `🎧 ${sanitizeTrack(track['name'])} by ${artist}`,
html: `🎧 <a href="${trackUrl}">${track['name']}</a> by <a href="${artistUrl}">${artist}</a>`, html: `🎧 <a href="${trackUrl}">${sanitizeTrack(
track['name']
)}</a> by <a href="${artistUrl}">${artist}</a>`,
}) })
} }