Generate a dynamic badge for the last played song on Last.fm. Insipired from abskmj/badges-lastfm
-
user.getRecentTracks
(last-played) -
user.getTopAlbums
(top-album) -
user.getTopArtists
(top-artist) -
user.getTopTags
(top-tag) -
user.getTopTracks
(top-track) -
user.getWeeklyAlbumChart
(top-album-week) -
user.getWeeklyArtistChart
(top-artist-week) -
user.getWeeklyTrackChart
(top-track-week)
Displays the last played song scrobbled on Last.fm for a user.

You can see the configurations in https://github.com/LIGMATV/lastfm-badge/blob/main/index.js#L12-L17, there's also the default values for the configurations.

Where the badge will be rendered, lightweight alternatives from Shields.io. (Not support style
and icon
.)
- Supported values:
shields
(shields.io) (Default)badgen
(badgen.net)badgers
(badgers.space)


Only suppported in
shields
provider
.
- Supported values:
flat
(Default)flat-square
plastic
for-the-badge
social



Only suppported in
shields
provider
, until Badgen.net & Badgers supporting Simple Icons.

These are the steps to run it locally or deploy it to Vercel.
- Get Last.fm API key
- You must already signed up and login to LastFM account.
- Go to Create API account page.
- After fill up some informations (like Contact email and Application name), click Submit.
- Copy the value next to "API key". (The character must be 32.)
- Clone this repository
git clone https://github.com/LIGMATV/lastfm-badge.git
cd lastfm-badge
npm install
- Create a new file "
.env
" with this content (ReplaceXXX...
with your actual API key)
API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
- Start in your terminal
npm start
LastFM does not provide any limits for API per user, including Vercel which does not provide any limits for requests and visitors.
You can also check out LastFM API TOS and Vercel Limits Overview to learn more.
I would recommend you to use your own deployed version to get a stable experience.