fix: strip only Unicode symbols from artist name for ytsearch queries
Using the full artist name with Unicode symbols (e.g. ☆NoAki☆) in ytsearch
caused YouTube to return 0-1 completely irrelevant results, letting wrong songs
fall through to the no-filter fallback. Strip only \p{S} (Unicode symbol chars
like ☆ ★ ♥) but keep ASCII punctuation — so N!GHT stays "N!GHT" (important for
disambiguation) while ☆NoAki☆ becomes "NoAki" (searchable).
YTM URL still uses the original artist name with all chars intact.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
e858b02df7
commit
941a486913
1 file changed
+5
-4
@@ -64,10 +64,11 @@ async function downloadTrack({ jobId, artist, albumArtist, title, album, year, t
|
|||||||
}
|
}
|
||||||
|
|
||||||
const outputTemplate = path.join(dir, `${trackPrefix}${safeTitle}.%(ext)s`);
|
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"
|
// Strip only Unicode symbol chars (☆ ★ ♥ etc.) for ytsearch — YouTube search chokes on them
|
||||||
// causes ytsearch to match "night" ambience videos instead of the artist.
|
// and returns 0 results. Keep ASCII punctuation (!&-) so e.g. "N!GHT" stays "N!GHT" rather
|
||||||
// spawn() passes args directly without shell interpretation so special chars are safe.
|
// than collapsing to "NGHT" which YouTube misreads as the word "night".
|
||||||
const query = `${mainArtist} - ${title}`;
|
const searchArtist = mainArtist.replace(/\p{S}/gu, '').trim();
|
||||||
|
const query = `${searchArtist} - ${title}`;
|
||||||
|
|
||||||
const baseArgs = [
|
const baseArgs = [
|
||||||
'--extract-audio',
|
'--extract-audio',
|
||||||
|
|||||||
Reference in new issue
Block a user