diff --git a/backend/lib/ytdlp.js b/backend/lib/ytdlp.js index ed3894d..2c5326e 100644 --- a/backend/lib/ytdlp.js +++ b/backend/lib/ytdlp.js @@ -64,10 +64,11 @@ async function downloadTrack({ jobId, artist, albumArtist, title, album, year, t } const outputTemplate = path.join(dir, `${trackPrefix}${safeTitle}.%(ext)s`); - // 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}`; + // Strip only Unicode symbol chars (☆ ★ ♥ etc.) for ytsearch — YouTube search chokes on them + // and returns 0 results. Keep ASCII punctuation (!&-) so e.g. "N!GHT" stays "N!GHT" rather + // than collapsing to "NGHT" which YouTube misreads as the word "night". + const searchArtist = mainArtist.replace(/\p{S}/gu, '').trim(); + const query = `${searchArtist} - ${title}`; const baseArgs = [ '--extract-audio',