Chrunos commited on
Commit
2bc563a
·
verified ·
1 Parent(s): c60a310

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -16
app.py CHANGED
@@ -197,13 +197,12 @@ class ApiRotator:
197
 
198
  # In your function:
199
  api_rotator = ApiRotator([
200
- "https://cblt.fariz.dev",
201
  "https://cobalt-api.ayo.tf",
 
202
  "http://34.107.254.11",
203
  "https://dwnld.nichind.dev",
204
  "https://cobalt-api.kwiatekmiki.com",
205
- "https://yt.edd1e.xyz/"
206
-
207
  ])
208
 
209
 
@@ -318,20 +317,20 @@ async def download_high_quality_video(request: Request):
318
  }
319
 
320
  else:
321
- await run_in_threadpool(lambda: yt_dlp.YoutubeDL(ydl_opts).download([video_url]))
322
 
323
- downloaded_files = list(Path(global_download_dir).glob(f"*_{timestamp}.mp4"))
324
- if not downloaded_files:
325
- return {"error": "Download failed"}
326
-
327
- downloaded_file = downloaded_files[0]
328
- encoded_filename = urllib.parse.quote(downloaded_file.name)
329
- download_url = f"{BASE_URL}/file/{encoded_filename}"
330
-
331
-
332
- gc.collect()
333
-
334
- return {"url": download_url, "requests_remaining": rate_limiter.max_requests - rate_limiter.get_current_count(user_ip)}
335
 
336
 
337
 
 
197
 
198
  # In your function:
199
  api_rotator = ApiRotator([
 
200
  "https://cobalt-api.ayo.tf",
201
+ "https://cblt.fariz.dev",
202
  "http://34.107.254.11",
203
  "https://dwnld.nichind.dev",
204
  "https://cobalt-api.kwiatekmiki.com",
205
+ "https://yt.edd1e.xyz/"
 
206
  ])
207
 
208
 
 
317
  }
318
 
319
  else:
320
+ await run_in_threadpool(lambda: yt_dlp.YoutubeDL(ydl_opts).download([video_url]))
321
 
322
+ downloaded_files = list(Path(global_download_dir).glob(f"*_{timestamp}.mp4"))
323
+ if not downloaded_files:
324
+ return {"error": "Download failed"}
325
+
326
+ downloaded_file = downloaded_files[0]
327
+ encoded_filename = urllib.parse.quote(downloaded_file.name)
328
+ download_url = f"{BASE_URL}/file/{encoded_filename}"
329
+
330
+
331
+ gc.collect()
332
+
333
+ return {"url": download_url, "requests_remaining": rate_limiter.max_requests - rate_limiter.get_current_count(user_ip)}
334
 
335
 
336