Spaces:
Running
Running
code
Browse files
app.py
CHANGED
@@ -622,7 +622,22 @@ class YouTubeDownloader:
|
|
622 |
return info, "β
Video information extracted successfully"
|
623 |
|
624 |
except Exception as e:
|
625 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
626 |
|
627 |
def download_video(self, url, quality="best", audio_only=False, progress=gr.Progress(), cookiefile=None):
|
628 |
"""Download video with progress tracking"""
|
|
|
622 |
return info, "β
Video information extracted successfully"
|
623 |
|
624 |
except Exception as e:
|
625 |
+
error_msg = str(e)
|
626 |
+
print(f"β yt_dlp extraction error: {error_msg}")
|
627 |
+
|
628 |
+
if "Video unavailable" in error_msg or "This content isnβt available" in error_msg:
|
629 |
+
return None, (
|
630 |
+
"β This video is unavailable or restricted. "
|
631 |
+
"Please check if it's private, deleted, age-restricted, or try again with a valid cookies.txt file."
|
632 |
+
)
|
633 |
+
elif "cookies" in error_msg.lower():
|
634 |
+
return None, f"β Error: {str(e)}"
|
635 |
+
elif "resolve" in error_msg.lower():
|
636 |
+
return None, "β Network error: Could not reach YouTube (DNS/connection issue). Try again later."
|
637 |
+
|
638 |
+
# π catch-all fallback (prevents None unpacking crash)
|
639 |
+
return None, f"β Unexpected extraction error: {error_msg}"
|
640 |
+
|
641 |
|
642 |
def download_video(self, url, quality="best", audio_only=False, progress=gr.Progress(), cookiefile=None):
|
643 |
"""Download video with progress tracking"""
|