fix: suppress ytmsearch unsupported scheme error, clean up search log

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
HoneyandClaude Sonnet 4.6 committed 2026-04-28 18:22:56 +02:00
1 parent 595fb2b7f3
commit 626a755688
1 file changed
+5 -2
+5 -2
View File
@@ -228,17 +228,20 @@ async function downloadTrack({ jobId, artist, albumArtist, title, album, year, t
fs.readdirSync(dir).filter(f => AUDIO_EXTS.some(e => f.endsWith(`.${e}`))).length;
// Step 1: YouTube Music — music-specific index, far fewer false positives
log(jobId, `🎵 YouTube Music: "${query}"`);
// Falls silently if this yt-dlp version doesn't support ytmsearch (older Alpine package)
const countBefore = audioFileCount();
try {
log(jobId, `🎵 YouTube Music: "${query}"`);
await runYtdlp(`ytmsearch:${query}`);
} catch (e) {
if (!e.message.includes('Unsupported url scheme')) {
log(jobId, `⚠️ YouTube Music Fehler: ${e.message}`);
}
}
// Step 2: Fallback to regular YouTube if no file was produced
if (audioFileCount() === countBefore) {
log(jobId, `🔄 Fallback: YouTube (5 Ergebnisse) — "${query}"`);
log(jobId, `🔍 YouTube: "${query}"`);
await runYtdlp(`ytsearch5:${query}`);
}