Clean multiple artists
Ceddicedced opened this issue · 1 comments
Ceddicedced commented
I have often encountered the problem that on youtube (and other platform) the artists are seperated by tags like: [",", "&", "x"] which causes the following.
I used something like the following in my script. The point is to extract just the first artist via Regex because last.fm only handles it correctly that way.
function cleanupArtist(artist: string) {
// Define patterns to find additional artists or features.
const patterns = [/ & .*/, / x .*/, / feat\..*/];
let cleanedArtist = artist;
patterns.forEach((pattern) => {
cleanedArtist = cleanedArtist.replace(pattern, '');
});
return cleanedArtist.trim();
}