mirror of
https://github.com/Viren070/AIOStreams.git
synced 2025-12-01 23:14:04 +01:00
fix: replace certain characters with spaces
This commit is contained in:
@@ -83,13 +83,17 @@ export function normaliseTitle(title: string) {
|
||||
}
|
||||
|
||||
export function cleanTitle(title: string) {
|
||||
return title
|
||||
.normalize('NFD')
|
||||
.replace(/-/g, ' ')
|
||||
let cleaned = title.normalize('NFD');
|
||||
|
||||
for (const char of ['♪', '♫', '★', '☆', '♡', '♥', '-']) {
|
||||
cleaned = cleaned.replaceAll(char, ' ');
|
||||
}
|
||||
|
||||
return cleaned
|
||||
.replace(/&/g, 'and')
|
||||
.replace(/[\u0300-\u036f]/g, '')
|
||||
.replace(/[^\p{L}\p{N}\s]/gu, '')
|
||||
.replace(/\s+/g, ' ')
|
||||
.replace(/[\u0300-\u036f]/g, '') // Remove diacritics
|
||||
.replace(/[^\p{L}\p{N}\s]/gu, '') // Remove remaining special chars
|
||||
.replace(/\s+/g, ' ') // Normalise spaces
|
||||
.toLowerCase()
|
||||
.trim();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user