tecuts commited on
Commit
b6349c3
·
verified ·
1 Parent(s): 281abd2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -1
app.py CHANGED
@@ -66,8 +66,27 @@ def get_best_formats_with_fallback(data: dict, requested_quality: int):
66
  raise ValueError("Could not find suitable video and/or audio streams from the Info API.")
67
  return video_url, audio_url
68
 
 
 
69
  def run_ytdlp_download(url: str, out_path: Path):
70
- ydl_opts = {'outtmpl': str(out_path), 'quiet': True, 'noprogress': True}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  with YoutubeDL(ydl_opts) as ydl:
72
  ydl.download([url])
73
 
 
66
  raise ValueError("Could not find suitable video and/or audio streams from the Info API.")
67
  return video_url, audio_url
68
 
69
+
70
+
71
  def run_ytdlp_download(url: str, out_path: Path):
72
+ """
73
+ Runs a single yt-dlp download using the high-speed 'aria2c' downloader.
74
+ """
75
+ ydl_opts = {
76
+ 'outtmpl': str(out_path),
77
+ 'quiet': True,
78
+ 'noprogress': True,
79
+ # --- SPEED OPTIMIZATION ---
80
+ # Use the aria2c external downloader for multi-connection downloads
81
+ 'external_downloader': 'aria2c',
82
+ # Arguments to pass to aria2c for maximum speed
83
+ 'external_downloader_args': [
84
+ '--min-split-size=1M',
85
+ '--max-connection-per-server=16',
86
+ '--max-concurrent-downloads=16',
87
+ '--split=16'
88
+ ],
89
+ }
90
  with YoutubeDL(ydl_opts) as ydl:
91
  ydl.download([url])
92