Skip to content

w3teal/lastfm-badge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lastfm-badge

Generate a dynamic badge for the last played song on Last.fm. Insipired from abskmj/badges-lastfm

Features

  • 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)

Last Played

Displays the last played song scrobbled on Last.fm for a user.

![](http://lastfm-badge.vercel.app/last-played?user=RJ)

Configurations

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.

user

![](http://lastfm-badge.vercel.app/last-played?user=RJ)

provider

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)
![](http://lastfm-badge.vercel.app/last-played?user=RJ&provider=badgen)  
![](http://lastfm-badge.vercel.app/last-played?user=RJ&provider=badgers)


style

Only suppported in shields provider.

  • Supported values:
    • flat (Default)
    • flat-square
    • plastic
    • for-the-badge
    • social
![](http://lastfm-badge.vercel.app/last-played?user=RJ&style=social)

color

![](http://lastfm-badge.vercel.app/last-played?user=RJ&color=green)

label

![](http://lastfm-badge.vercel.app/last-played?user=RJ&label=What%20I%20listening%20now)

icon

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

![](http://lastfm-badge.vercel.app/last-played?user=RJ&icon=google)

Building

These are the steps to run it locally or deploy it to Vercel.

  1. 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.)

Local

  1. Clone this repository
git clone https://github.com/LIGMATV/lastfm-badge.git
cd lastfm-badge
npm install
  1. Create a new file ".env" with this content (Replace XXX... with your actual API key)
API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  1. Start in your terminal
npm start

Deploy

  1. Deploy with Vercel

Limitation

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.

About

Generate a dynamic badge for the last played song on Last.fm.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published