commit 39ec30ed89e102a3f9a8c2b5ea37b646695db99a
parent 74e77775110fb97eee9399aa72dcc515f4523209
Author: Amit Dutta <mail@amit.is-a.dev>
Date: Wed, 16 Sep 2026 22:48:50 +0530
trying to fix again
Diffstat:
1 file changed, 27 insertions(+), 9 deletions(-)
diff --git a/app/main.py b/app/main.py
@@ -484,18 +484,36 @@ async def yt_download_cobalt(request: Request, body: YtRequest):
if status == "error":
error = data.get("error", {})
+ print("========== COBALT ERROR ==========")
+ print(f"Full response: {data}")
+
if isinstance(error, dict):
- error_code = error.get(
- "code",
- "Unknown Cobalt error",
- )
+ print(f"Error code: {error.get('code')}")
+ print(f"Error context: {error.get('context')}")
else:
- error_code = str(error)
+ print(f"Error: {error}")
+
+ print("==================================")
- raise HTTPException(
- status_code=400,
- detail=f"Cobalt error: {error_code}",
- )
+ if isinstance(error, dict):
+ raise HTTPException(
+ status_code=400,
+ detail={
+ "message": "Cobalt API failed",
+ "code": error.get("code"),
+ "context": error.get("context"),
+ "raw": data,
+ },
+ )
+ else:
+ raise HTTPException(
+ status_code=400,
+ detail={
+ "message": "Cobalt API failed",
+ "error": str(error),
+ "raw": data,
+ },
+ )
dl_url = data.get("url")