fix(backend): use space (not dash) between artist and title in search query
"MINA - recognize" skewed YTM ranking toward a same-named artist's full discography, so the actual track (qNffDItRUeo) never appeared in results. "MINA recognize" — matching how users type in the YTM search box — ranks the exact official track first. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
c34123af38
commit
c4e4c8c090
1 file changed
+5
-2
@@ -145,7 +145,10 @@ async function downloadTrack({ jobId, artist, rawArtist, albumArtist, title, alb
|
||||
// For Western tracks, artist + title + duration matching is sufficient (matches spotdl behaviour).
|
||||
const albumQuerySuffix = hasJpTitle && albumWords ? ' ' + albumWords : '';
|
||||
|
||||
const query = `${ytmArtist} - ${searchTitle}${albumQuerySuffix}`;
|
||||
// Use a space (not " - ") between artist and title: this matches how users type
|
||||
// in the YTM search box and ranks the exact official track first. A dash skews
|
||||
// YTM ranking toward a same-named artist's full discography.
|
||||
const query = `${ytmArtist} ${searchTitle}${albumQuerySuffix}`;
|
||||
|
||||
const baseArgs = [
|
||||
'--extract-audio',
|
||||
@@ -188,7 +191,7 @@ async function downloadTrack({ jobId, artist, rawArtist, albumArtist, title, alb
|
||||
|
||||
const YTM_SONGS_PARAM = 'EgWKAQIIAWoKEAkQBRAKEAMQBA%3D%3D';
|
||||
// Use original (raw) artist for YTM URL — better ranking since channel is in original language
|
||||
const ytmQuery = `${rawArtist || mainArtist} - ${searchTitle}${albumQuerySuffix}`;
|
||||
const ytmQuery = `${rawArtist || mainArtist} ${searchTitle}${albumQuerySuffix}`;
|
||||
const ytmUrl = `https://music.youtube.com/search?q=${encodeURIComponent(ytmQuery)}¶ms=${YTM_SONGS_PARAM}`;
|
||||
const expectedAudio = path.join(dir, `${fileBase}.${CONFIG.audioFmt}`);
|
||||
const hasAudio = () => fs.existsSync(expectedAudio);
|
||||
|
||||
Reference in new issue
Block a user