Update yt-dlp

This commit is contained in:
2025-12-05 22:30:12 +03:00
parent ad588a72bb
commit 588d3f4c87

View File

@@ -23,6 +23,8 @@ class YtDlpErrorFilter:
def write(self, text):
"""Filter stderr output from yt-dlp"""
text_lower = text.lower()
# Suppress "Unable to extract title" errors - they're not critical
if "Unable to extract title" in text:
# Log as debug instead of error
@@ -30,10 +32,21 @@ class YtDlpErrorFilter:
return
# Suppress other non-critical extraction errors
if "Unable to extract" in text and ("title" in text.lower() or "metadata" in text.lower()):
if "Unable to extract" in text and ("title" in text_lower or "metadata" in text_lower):
logger.debug(f"yt-dlp: {text.strip()}")
return
# Suppress "Unable to download webpage" errors that are often non-critical
# These can occur due to network issues but yt-dlp may still succeed with retries
if "Unable to download webpage" in text:
# Check if it's a partial read (often recoverable)
if "bytes read" in text_lower or "incompleteread" in text_lower:
logger.debug(f"yt-dlp: {text.strip()} (may retry)")
return
# For other cases, still log as warning but don't show as ERROR
logger.warning(f"yt-dlp: {text.strip()}")
return
# Write everything else to original stderr
self.original_stderr.write(text)
self.original_stderr.flush()
@@ -342,9 +355,10 @@ async def download_media(
'ignoreerrors': True, # Continue on extraction errors (e.g., missing title)
# Network settings for better reliability
'socket_timeout': 60, # Increase socket timeout to 60 seconds
'retries': 3, # Retry failed downloads up to 3 times
'fragment_retries': 3, # Retry failed fragments
'retries': 5, # Retry failed downloads up to 5 times (increased for network issues)
'fragment_retries': 5, # Retry failed fragments
'file_access_retries': 3, # Retry file access errors
'http_chunk_size': 10485760, # 10MB chunks for better stability
}
# Check if Node.js is available for JS extraction (required for Instagram, TikTok, YouTube, etc.)
@@ -462,6 +476,14 @@ async def download_media(
f"Video file should still be available. Will check file existence."
)
# Don't raise - video is likely already downloaded
# Check for incomplete read errors (often recoverable with retries)
elif "incompleteread" in error_lower or ("unable to download webpage" in error_lower and "bytes read" in error_lower):
logger.warning(
f"Incomplete read error (may retry or file may still be available): {error_msg}. "
f"Will check if file was downloaded."
)
# Don't raise immediately - file might still be downloaded
# yt-dlp will retry automatically if configured
# Check if it's just a postprocessing error (video is already downloaded)
elif "Postprocessing" in error_msg or "aspect ratio" in error_lower:
logger.warning(