fix(backend): drop YTM Songs filter param — it dropped the exact track

The &params= Songs-tab filter re-ranked YTM results toward a same-named
artist's discography and excluded the official track (qNffDItRUeo) entirely,
even logged-out. The default blended search (what the browser shows) ranks
the exact track first. Removing the param so yt-dlp gets the same result set.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
HoneyandClaude Opus 4.8 committed 2026-06-19 11:15:12 +02:00
1 parent c4e4c8c090
commit e93c0c7ab1
1 file changed
+6 -3
+6 -3
View File
@@ -189,10 +189,13 @@ 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.
// Use original (raw) artist for YTM URL — better ranking since channel is in original language // NOTE: do NOT append the "Songs" filter param (&params=…). The explicit Songs-tab filter
// re-ranks results toward a same-named artist's full discography and drops the exact track.
// The default blended search (what the browser shows, even logged-out) ranks the official
// track first — which is what we want.
const ytmQuery = `${rawArtist || mainArtist} ${searchTitle}${albumQuerySuffix}`; const ytmQuery = `${rawArtist || mainArtist} ${searchTitle}${albumQuerySuffix}`;
const ytmUrl = `https://music.youtube.com/search?q=${encodeURIComponent(ytmQuery)}&params=${YTM_SONGS_PARAM}`; const ytmUrl = `https://music.youtube.com/search?q=${encodeURIComponent(ytmQuery)}`;
const expectedAudio = path.join(dir, `${fileBase}.${CONFIG.audioFmt}`); const expectedAudio = path.join(dir, `${fileBase}.${CONFIG.audioFmt}`);
const hasAudio = () => fs.existsSync(expectedAudio); const hasAudio = () => fs.existsSync(expectedAudio);