Fred808 commited on
Commit
a495771
·
verified ·
1 Parent(s): 2a99cac

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +10 -6
main.py CHANGED
@@ -363,7 +363,9 @@ class BatchYouTubeDownloader:
363
  base_cmd.extend(["-f", "bestaudio/best"])
364
  else:
365
  if quality == "best":
366
- base_cmd.extend(["-f", "best[height<=720]"])
 
 
367
  elif quality == "worst":
368
  base_cmd.extend(["-f", "worst"])
369
  else:
@@ -947,8 +949,8 @@ async def download_video(request: DownloadRequest, background_tasks: BackgroundT
947
  async def batch_get_video_info(request: BatchVideoInfoRequest):
948
  """Get information for multiple videos"""
949
  try:
950
- if len(request.urls) > 50: # Limit batch size
951
- raise HTTPException(status_code=400, detail="Maximum 50 URLs allowed per batch")
952
 
953
  urls = [str(url) for url in request.urls]
954
 
@@ -979,8 +981,8 @@ async def batch_get_video_info(request: BatchVideoInfoRequest):
979
  async def batch_download_videos(request: BatchDownloadRequest, background_tasks: BackgroundTasks):
980
  """Start batch download of multiple videos"""
981
  try:
982
- if len(request.urls) > 20: # Limit batch size for downloads
983
- raise HTTPException(status_code=400, detail="Maximum 20 URLs allowed per batch download")
984
 
985
  if request.max_concurrent > 5: # Limit concurrent downloads
986
  raise HTTPException(status_code=400, detail="Maximum 5 concurrent downloads allowed")
@@ -1153,4 +1155,6 @@ if __name__ == "__main__":
1153
  port=port,
1154
  reload=False,
1155
  log_level="info"
1156
- )
 
 
 
363
  base_cmd.extend(["-f", "bestaudio/best"])
364
  else:
365
  if quality == "best":
366
+ base_cmd.extend(["-f", "bestvideo[height<=720]+bestaudio/best[height<=720]"])
367
+ elif quality == "720p":
368
+ base_cmd.extend(["-f", "bestvideo[height=720]+bestaudio/best[height=720]"])
369
  elif quality == "worst":
370
  base_cmd.extend(["-f", "worst"])
371
  else:
 
949
  async def batch_get_video_info(request: BatchVideoInfoRequest):
950
  """Get information for multiple videos"""
951
  try:
952
+ if len(request.urls) > 10000: # Limit batch size
953
+ raise HTTPException(status_code=400, detail="Maximum 10000 URLs allowed per batch")
954
 
955
  urls = [str(url) for url in request.urls]
956
 
 
981
  async def batch_download_videos(request: BatchDownloadRequest, background_tasks: BackgroundTasks):
982
  """Start batch download of multiple videos"""
983
  try:
984
+ if len(request.urls) > 10000: # Limit batch size
985
+ raise HTTPException(status_code=400, detail="Maximum 10000 URLs allowed per batch download")
986
 
987
  if request.max_concurrent > 5: # Limit concurrent downloads
988
  raise HTTPException(status_code=400, detail="Maximum 5 concurrent downloads allowed")
 
1155
  port=port,
1156
  reload=False,
1157
  log_level="info"
1158
+ )
1159
+
1160
+