mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 18:41:47 +00:00
use regex on cleanupName()
This commit is contained in:
@ -112,13 +112,12 @@ const suffixesToRemove = [
|
|||||||
" - topic",
|
" - topic",
|
||||||
"vevo",
|
"vevo",
|
||||||
" (performance video)",
|
" (performance video)",
|
||||||
" (official music video)",
|
|
||||||
" (official video)",
|
|
||||||
" (clip officiel)",
|
" (clip officiel)",
|
||||||
];
|
];
|
||||||
|
|
||||||
function cleanupName(name) {
|
function cleanupName(name) {
|
||||||
if (!name) return name;
|
if (!name) return name;
|
||||||
|
name = name.replace(/\((?:official)?[ ]?(?:music)?[ ]?(?:lyric[s]?)?[ ]?(?:video)?\)$/i, '')
|
||||||
const lowCaseName = name.toLowerCase();
|
const lowCaseName = name.toLowerCase();
|
||||||
for (const suffix of suffixesToRemove) {
|
for (const suffix of suffixesToRemove) {
|
||||||
if (lowCaseName.endsWith(suffix)) {
|
if (lowCaseName.endsWith(suffix)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user