From e93c0c7ab149d120ef6ed78af8e0525ebec28b50 Mon Sep 17 00:00:00 2001 From: Honey Date: Fri, 19 Jun 2026 11:15:12 +0200 Subject: [PATCH] =?UTF-8?q?fix(backend):=20drop=20YTM=20Songs=20filter=20p?= =?UTF-8?q?aram=20=E2=80=94=20it=20dropped=20the=20exact=20track?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ¶ms= 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 --- backend/lib/ytdlp.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/backend/lib/ytdlp.js b/backend/lib/ytdlp.js index 1a0a98d..1d2108d 100644 --- a/backend/lib/ytdlp.js +++ b/backend/lib/ytdlp.js @@ -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 (¶ms=…). 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 ytmUrl = `https://music.youtube.com/search?q=${encodeURIComponent(ytmQuery)}¶ms=${YTM_SONGS_PARAM}`; + const ytmUrl = `https://music.youtube.com/search?q=${encodeURIComponent(ytmQuery)}`; const expectedAudio = path.join(dir, `${fileBase}.${CONFIG.audioFmt}`); const hasAudio = () => fs.existsSync(expectedAudio);