From 8ad6ad0912fb0dda4d74347a3fa4cf5a58a94277 Mon Sep 17 00:00:00 2001 From: "juancarlos.cavero" Date: Fri, 19 Dec 2025 21:50:48 +0100 Subject: [PATCH] fix yt-dlp error in prod --- main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 3e96de5..10c2849 100644 --- a/main.py +++ b/main.py @@ -273,6 +273,8 @@ def download_youtube_video(url, output_dir="."): has_cookies = cookies_path and os.path.exists(cookies_path) if not has_cookies: print("⚠️ No cookies found. This increases the risk of bot detection.") + else: + print(f"🍪 Using cookies from: {cookies_path}") for client in clients_to_try: print(f"🔄 Attempting extraction with client: {client}...") @@ -283,7 +285,8 @@ def download_youtube_video(url, output_dir="."): 'extractor_args': { 'youtube': { 'player_client': [client, 'web'], - 'player_skip': ['webpage', 'configs'] if client in ['android', 'ios'] else [] + # Only skip webpage if we have cookies, as webpage is sometimes needed for auth check + # 'player_skip': ['webpage', 'configs'] if client in ['android', 'ios'] else [] } }, # Force IPv4 as IPv6 datacenter ranges are often blocked