Update app.py
Browse files
app.py
CHANGED
|
@@ -324,6 +324,29 @@ async def jio_download(request: JioDownloadRequest):
|
|
| 324 |
logger.error(f"Error in jio_download: {e}")
|
| 325 |
raise HTTPException(status_code=500, detail=f"An error occurred during download: {str(e)}")
|
| 326 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 327 |
|
| 328 |
|
| 329 |
def process_url(title: str) -> str:
|
|
|
|
| 324 |
logger.error(f"Error in jio_download: {e}")
|
| 325 |
raise HTTPException(status_code=500, detail=f"An error occurred during download: {str(e)}")
|
| 326 |
|
| 327 |
+
@app.post("/jio_dls")
|
| 328 |
+
async def jio_download(request: JioDownloadRequest):
|
| 329 |
+
try:
|
| 330 |
+
url = request.url
|
| 331 |
+
quality = request.quality
|
| 332 |
+
if not url or not quality:
|
| 333 |
+
logger.error("Missing 'url' or 'quality' in request data.")
|
| 334 |
+
raise HTTPException(status_code=400, detail="Missing 'url' or 'quality' in request data")
|
| 335 |
+
if quality == '320kbps':
|
| 336 |
+
return {
|
| 337 |
+
"error": "Quality 320kbps is for Premium users only",
|
| 338 |
+
"premium": "https://chrunos.com/premium-shortcuts/"
|
| 339 |
+
}
|
| 340 |
+
else:
|
| 341 |
+
download_url = jio_fetch(url, quality)
|
| 342 |
+
return {"download_url": download_url}
|
| 343 |
+
except HTTPException:
|
| 344 |
+
# Re - raise the HTTPException if it's already raised in jio_fetch
|
| 345 |
+
raise
|
| 346 |
+
except Exception as e:
|
| 347 |
+
logger.error(f"Error in jio_download: {e}")
|
| 348 |
+
raise HTTPException(status_code=500, detail=f"An error occurred during download: {str(e)}")
|
| 349 |
+
|
| 350 |
|
| 351 |
|
| 352 |
def process_url(title: str) -> str:
|