tunedrop/backend/main.py
2025-07-10 10:11:40 +03:00

15 lines
504 B
Python

from fastapi import FastAPI, Query, HTTPException
from fastapi.responses import JSONResponse
from downloader import download_song
from config import settings
app = FastAPI(title="Tunedrop")
@app.get("/download")
def download(query: str = Query(..., description="Song name or YouTube search term")):
try:
result = download_song(query)
return JSONResponse(content={"status": "success", **result})
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))