Skip to content

Latest commit

 

History

History
137 lines (97 loc) · 2.71 KB

File metadata and controls

137 lines (97 loc) · 2.71 KB

LastFm-Playing Documentation

Go back | API Url

Navigation

Usage

API Endpoint url is api.codcatdev.site/lastfmPlaying. Lets start

Get card

For getting a card, you need a GET request to api

curl https://api.codcatdev.site/lastfmPlaying/?user={USER}
<img alt="card" src="https://api.codcatdev.site/lastfmPlaying/?user={USER}">
or
![](https://api.codcatdev.site/lastfmPlaying/?user={USER})

Return a svg card with content-type image/svg+xml; charset=utf-8

Parameters

Arg Value Description
user String (e.g: ?user=codcatdev) Last.fm username

Errors

Format

{
    "code":404, // Code error [INT]
    "error":true, // Error or api response [BOOL]
    "msg":"Not found", // Message in error [STR]
    "data":{} // JSON. Maybe.. with error data [JSON]
}

Self-Hosting

Requirements

  • Python 3.13
  • 200 Mb+ RAM

Download and install libs

Go to SSH on your server and run

git clone https://github.com/CodCatDev/Lastfm-Playing.git
cd Lastfm-Playing
cd src

Create a Venv

python3 -m venv venv

If you get an error, install Python-Venv module

For Ubuntu/Debian: sudo apt update && sudo apt install python3-venv python3-pip -y

For CentOS/RHEL/Rocky Linux/AlmaLinux: sudo dnf install python3 python3-pip -y

For Alpine Linux: apk add python3 py3-pip

For Arch Linux: sudo pacman -Syu python python-pip --noconfirm


open venv and install libs

source venv/bin/activate

P.s if it not working, use a SH command:

. venv/bin/activate

And install libs

pip install -r requirements.txt

Running

gunicorn --bind 0.0.0.0:80 app:app

And done! Server running on http://YOUR_SERVER_IP/

Endpoints for self-hosting

For self-host, endpoint is different!

Get card (SELF-HOST)

curl http://YOUR_SEVRER_IP/api/v1/?user={USER}
<img alt="card" src="http://YOUR_SEVRER_IP/api/v1/?user={USER}">
or
![](http://YOUR_SEVRER_IP/api/v1/?user={USER})

Return a svg card with content-type image/svg+xml; charset=utf-8

Parameters

Arg Value Description
user String (e.g: ?user=codcatdev) Last.fm username