fix yt-dlp error in prod

This commit is contained in:
juancarlos.cavero 2025-12-19 21:50:48 +01:00
parent f724e537cc
commit 8ad6ad0912

View file

@ -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