diff --git a/backend/lib/ytdlp.js b/backend/lib/ytdlp.js index 35a8200..41676b9 100644 --- a/backend/lib/ytdlp.js +++ b/backend/lib/ytdlp.js @@ -220,6 +220,10 @@ async function downloadTrack({ jobId, artist, rawArtist, albumArtist, title, alb '--playlist-items', `1-${maxItems}`, '--print', 'webpage_url', '--no-warnings', + // Without the web_music client, yt-dlp parses the YTM search page as a + // generic YouTube search and returns unrelated videos instead of the + // native Songs shelf (where the actual artist track lives). + '--extractor-args', 'youtube:player_client=web_music,default', ], { env: { ...process.env, PYTHONUNBUFFERED: '1' } }); proc.stdout.on('data', d => { const text = d.toString();