diff --git a/backend/lib/ytdlp.js b/backend/lib/ytdlp.js index 6ac9787..e4ed5be 100644 --- a/backend/lib/ytdlp.js +++ b/backend/lib/ytdlp.js @@ -128,8 +128,12 @@ async function downloadTrack({ jobId, artist, rawArtist, albumArtist, title, alb // This helps YTM rank the official OST/album track above fan covers and romaji-subtitle uploads. // Only use album words that are ASCII (romaji/English) — Japanese album words don't help YTM ranking. const hasJpTitle = JP_RE.test(title); + const GENERIC_ALBUM_WORDS = new Set(['single', 'ep', 'album', 'soundtrack', 'ost', 'edition', 'remaster', 'remastered', 'deluxe', 'bonus', 'version', 'live']); + const titleWordSet = new Set(title.toLowerCase().split(/\s+/)); const albumWords = (album && album !== 'Singles' && album !== 'Unknown') - ? album.split(/\s+/).filter(w => /^[A-Za-z0-9]/.test(w)).slice(0, 2).join(' ') + ? album.split(/\s+/) + .filter(w => /^[A-Za-z0-9]/.test(w) && !titleWordSet.has(w.toLowerCase()) && !GENERIC_ALBUM_WORDS.has(w.toLowerCase())) + .slice(0, 2).join(' ') : ''; const albumQuerySuffix = (hasJpTitle || (albumWords && titleKws.length <= 1)) && albumWords ? ' ' + albumWords : '';