Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean multiple artists #323

Open
Ceddicedced opened this issue Dec 21, 2023 · 1 comment
Open

Clean multiple artists #323

Ceddicedced opened this issue Dec 21, 2023 · 1 comment
Labels
feature New feature or request

Comments

@Ceddicedced
Copy link

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();
}
@Ceddicedced Ceddicedced added the feature New feature or request label Dec 21, 2023
@jbwharris
Copy link

@Ceddicedced Thanks for sharing this. Not sure if it'll get merged in, but it was exactly what I needed for my project after identifying this same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Development

No branches or pull requests

2 participants