debug: log yt-dlp stderr to diagnose extraction failures

This commit is contained in:
Julien Calixte
2026-03-23 22:42:42 +01:00
parent 0c9a833c14
commit 149a6a3cdd

View File

@@ -43,8 +43,6 @@ async def extract_audio(url: str) -> Path:
cmd = [ cmd = [
"yt-dlp", "yt-dlp",
"--no-warnings",
"--quiet",
"--extract-audio", "--extract-audio",
"--audio-format", "mp3", "--audio-format", "mp3",
"--audio-quality", "128K", "--audio-quality", "128K",
@@ -64,9 +62,14 @@ async def extract_audio(url: str) -> Path:
stderr=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE,
) )
_, stderr = await proc.communicate() _, stderr = await proc.communicate()
stderr_text = stderr.decode().strip()
if stderr_text:
import logging
logging.getLogger(__name__).warning("yt-dlp stderr: %s", stderr_text)
if proc.returncode != 0: if proc.returncode != 0:
raise RuntimeError(stderr.decode().strip() or "yt-dlp failed with no output") raise RuntimeError(stderr_text or "yt-dlp failed with no output")
if expected.exists(): if expected.exists():
return expected return expected