Files changed (1) hide show
  1. app.py +16 -1
app.py CHANGED
@@ -622,7 +622,22 @@ class YouTubeDownloader:
622
  return info, "βœ… Video information extracted successfully"
623
 
624
  except Exception as e:
625
- return None, f"❌ Error: {str(e)}"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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"""