A Flask backend application that fetches data required by the frontend to create a Genius lyrics card using the lyricsgenius library.
To get started with this project, you can follow the steps below:
git clone https://github.com/adhamali450/lyrics-card-maker-backend
cd lyrics-card-maker-backend
pip install -r requirements.txt
Once you have completed these steps, you should have the project set up and ready to use on your local machine.
Searches for a query and it returns a list of results
CURL /api/search
Parameter | Type | Description |
---|---|---|
query |
string |
Required. The song or artist name |
max |
int |
Optional. Max. results to return (default 5) |
Searches the lyrics for a specified song
CURL /api/song/lyrics/${song_id}
Get the dominant background/foreground colors for a song cover
CURL api/song/colors
Parameter | Type | Description |
---|---|---|
url |
string |
Required. The cover img url |
Gets the cover image (can be done for any image url), when CORS
headings isn't provided from Genius
CURL /api/cors
Parameter | Type | Description |
---|---|---|
url |
string |
Required. The cover img url |
To illustrate how to consume the API from a JavaScript application, we will provide a simple code example using axios
.
import axios from "axios";
const API_URL = "https://genius-unofficial-api.vercel.app/api";
const res = axios
.get(API_URL + `/search`, {
params: {
query: "Eminem lose yourself",
},
}).then((res) => {
console.log(res.data);
});