Debug: log fetch_video_metadata cookie args and errors

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
inputnoise
2026-05-25 21:42:02 +02:00
parent 8c291f5c2d
commit 4ab8245a93

View File

@@ -211,16 +211,19 @@ def _best_thumbnail(thumbnails: list | None) -> str | None:
def fetch_video_metadata(video_id: str) -> dict | None:
"""Fetch metadata for a single video by YouTube ID."""
url = f"https://www.youtube.com/watch?v={video_id}"
stdout, _, code = _run([
cookie_args = _cookie_args()
print(f"[fetch_meta] video={video_id} cookie_args={cookie_args!r}", flush=True)
stdout, stderr, code = _run([
"yt-dlp",
url,
"--dump-json",
"--no-download",
"--no-playlist",
"--quiet",
"--extractor-args", "youtube:player_client=ios,web",
*_cookie_args(),
*cookie_args,
], timeout=30)
if code != 0:
print(f"[fetch_meta] FAILED code={code} stderr={stderr[:500]!r}", flush=True)
for line in stdout.splitlines():
line = line.strip()