Update app.py
Browse files
app.py
CHANGED
@@ -508,8 +508,8 @@ async def download_high_quality_video(request: Request):
|
|
508 |
quality = data.get('quality', '720') # Default to 1080p if not specified
|
509 |
|
510 |
# Check if the requested quality is above 1080p
|
511 |
-
if int(quality) >
|
512 |
-
error_message = "Quality above
|
513 |
help_url = "https://chrunos.com/premium-shortcuts/" # Replace with your actual URL
|
514 |
return {"error": error_message, "url": help_url}
|
515 |
|
@@ -521,11 +521,13 @@ async def download_high_quality_video(request: Request):
|
|
521 |
|
522 |
# Convert quality string to height
|
523 |
height_map = {
|
|
|
|
|
524 |
'480': 480,
|
525 |
'720': 720,
|
526 |
'1080': 1080
|
527 |
}
|
528 |
-
max_height = height_map.get(quality,
|
529 |
|
530 |
# Determine format string based on quality
|
531 |
format_str = f'bestvideo[height<={max_height}][vcodec^=avc]+bestaudio/best'
|
|
|
508 |
quality = data.get('quality', '720') # Default to 1080p if not specified
|
509 |
|
510 |
# Check if the requested quality is above 1080p
|
511 |
+
if int(quality) > 720:
|
512 |
+
error_message = "Quality above 720p is for Premium Members Only. Please check the URL for more information."
|
513 |
help_url = "https://chrunos.com/premium-shortcuts/" # Replace with your actual URL
|
514 |
return {"error": error_message, "url": help_url}
|
515 |
|
|
|
521 |
|
522 |
# Convert quality string to height
|
523 |
height_map = {
|
524 |
+
'240': 240,
|
525 |
+
'360': 360,
|
526 |
'480': 480,
|
527 |
'720': 720,
|
528 |
'1080': 1080
|
529 |
}
|
530 |
+
max_height = height_map.get(quality, 720) # Use the quality variable correctly
|
531 |
|
532 |
# Determine format string based on quality
|
533 |
format_str = f'bestvideo[height<={max_height}][vcodec^=avc]+bestaudio/best'
|