Nymbo commited on
Commit
50b25ec
·
verified ·
1 Parent(s): b9cd51f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -244,6 +244,14 @@ def _download_yt_audio(yt_url: str, filepath: str) -> None:
244
  try:
245
  info = info_loader.extract_info(yt_url, download=False)
246
  except youtube_dl.utils.DownloadError as err:
 
 
 
 
 
 
 
 
247
  raise gr.Error(str(err))
248
 
249
  # Parse duration
 
244
  try:
245
  info = info_loader.extract_info(yt_url, download=False)
246
  except youtube_dl.utils.DownloadError as err:
247
+ # Check if this is a network/DNS error (common on HF Spaces)
248
+ err_str = str(err)
249
+ if "Failed to resolve" in err_str or "No address associated" in err_str:
250
+ raise gr.Error(
251
+ "YouTube download failed due to network restrictions. "
252
+ "This feature requires running the app locally. "
253
+ "On Hugging Face Spaces, outbound connections to YouTube are blocked."
254
+ )
255
  raise gr.Error(str(err))
256
 
257
  # Parse duration