Skip to content

Clean multiple artists #323

@chaos-baum

Description

@chaos-baum

I have often encountered the problem that on youtube (and other platform) the artists are seperated by tags like: [",", "&", "x"] which causes the following.
grafik
grafik

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();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions