π§ Description:
A simple Python FastAPI backend that provides 30-second song previews from Deezer. Perfect for integrating into a website or app that needs legal music snippets without storing audio files locally.
- Search songs by title or artist
- Retrieve 30-second previews from Deezer automatically
- Response is served directly in audio/mpeg format
- Response headers include:
X-Track-Titleβ song titleX-Artist-Nameβ artist name
- Clone this repository:
git clone <repo-url>
cd <repo-folder>
Install dependencies:
bash
Salin kode
pip install -r req.txt
Run the API:
bash
Salin kode
uvicorn app:app --reload
π Endpoints
GET / β Homepage
http
Salin kode
http://127.0.0.1:8000/
GET /preview β Get a 30-second song preview
http
Salin kode
http://127.0.0.1:8000/preview?query=lofi
Query Parameters:
query β Song title or artist name
Response:
30-second audio file
Headers: X-Track-Title and X-Artist-Name