mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-16 12:42:06 +00:00
Improve video title filters (#1667)
This commit is contained in:
@ -209,10 +209,19 @@ const registerProvider = (win: BrowserWindow) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const suffixesToRemove = [
|
const suffixesToRemove = [
|
||||||
' - topic',
|
// Artist names
|
||||||
'vevo',
|
/\s*(- topic)$/i,
|
||||||
' (performance video)',
|
/\s*vevo$/i,
|
||||||
' (clip official)',
|
|
||||||
|
// Video titles
|
||||||
|
/\s*[(|\[]official(.*?)[)|\]]/i, // (Official Music Video), [Official Visualizer], etc...
|
||||||
|
/\s*[(|\[]((lyrics?|visualizer|audio)\s*(video)?)[)|\]]/i,
|
||||||
|
/\s*[(|\[](performance video)[)|\]]/i,
|
||||||
|
/\s*[(|\[](clip official)[)|\]]/i,
|
||||||
|
/\s*[(|\[](video version)[)|\]]/i,
|
||||||
|
/\s*[(|\[](HD|HQ)\s*?(?:audio)?[)|\]]$/i,
|
||||||
|
/\s*[(|\[](live)[)|\]]$/i,
|
||||||
|
/\s*[(|\[]4K\s*?(?:upgrade)?[)|\]]$/i,
|
||||||
];
|
];
|
||||||
|
|
||||||
export function cleanupName(name: string): string {
|
export function cleanupName(name: string): string {
|
||||||
@ -220,15 +229,8 @@ export function cleanupName(name: string): string {
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
name = name.replace(
|
|
||||||
/\((?:official)? ?(?:music)? ?(?:lyrics?)? ?(?:video)?\)$/i,
|
|
||||||
'',
|
|
||||||
);
|
|
||||||
const lowCaseName = name.toLowerCase();
|
|
||||||
for (const suffix of suffixesToRemove) {
|
for (const suffix of suffixesToRemove) {
|
||||||
if (lowCaseName.endsWith(suffix)) {
|
name = name.replace(suffix, '');
|
||||||
return name.slice(0, -suffix.length);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return name;
|
return name;
|
||||||
|
|||||||
Reference in New Issue
Block a user