fix: add YTM 'Songs only' filter param to search URL

Without &params=EgWKAQII..., yt-dlp gets a mixed feed of videos,
channels and playlists alongside tracks — same query that shows the
correct song first in the browser "Titel" tab returned nursery rhyme
videos and unrelated channels. This param is YTM's internal 'Songs'
filter (equivalent to clicking the Titel tab).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
HoneyandClaude Sonnet 4.6 committed 2026-05-02 15:38:35 +02:00
1 parent fed3df7e36
commit 2d1c9029c5
1 file changed
+4 -1
+4 -1
View File
@@ -274,7 +274,10 @@ async function downloadTrack({ jobId, artist, albumArtist, title, album, year, t
);
});
const ytmUrl = `https://music.youtube.com/search?q=${encodeURIComponent(query)}`;
// &params= is YTM's "Songs only" filter (same as clicking "Titel" tab in the browser).
// Without it yt-dlp gets a mixed feed of videos, channels, and playlists as well.
const YTM_SONGS_PARAM = 'EgWKAQIIAWoKEAkQBRAKEAMQBA%3D%3D';
const ytmUrl = `https://music.youtube.com/search?q=${encodeURIComponent(query)}&params=${YTM_SONGS_PARAM}`;
// Snapshot files already in dir before we start — so hasAudio() only detects NEW files
// from the current download attempt, not pre-existing files from parallel jobs.
let snapBefore = new Set(fs.readdirSync(dir));