From e858b02df7154064430bcaf58ae0da49d231bdb8 Mon Sep 17 00:00:00 2001 From: Honey Date: Sun, 3 May 2026 11:50:19 +0200 Subject: [PATCH] fix: use original artist name in YTM search and add strict channel filter Use mainArtist (with special chars) for ytsearch queries so e.g. "N!GHT - Yume" searches correctly instead of "NGHT - Yume" which YouTube misreads as "night" and returns ambience videos. Co-Authored-By: Claude Sonnet 4.6 --- backend/lib/ytdlp.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/lib/ytdlp.js b/backend/lib/ytdlp.js index 50b817a..ed3894d 100644 --- a/backend/lib/ytdlp.js +++ b/backend/lib/ytdlp.js @@ -64,8 +64,10 @@ async function downloadTrack({ jobId, artist, albumArtist, title, album, year, t } const outputTemplate = path.join(dir, `${trackPrefix}${safeTitle}.%(ext)s`); - const searchArtist = mainArtist.replace(/[^\p{L}\p{N}\s,&\-]/gu, '').trim(); - const query = `${searchArtist} - ${title}`; + // Use original artist name (with special chars) for all searches — stripping e.g. "N!GHT" → "NGHT" + // causes ytsearch to match "night" ambience videos instead of the artist. + // spawn() passes args directly without shell interpretation so special chars are safe. + const query = `${mainArtist} - ${title}`; const baseArgs = [ '--extract-audio',