Skip to content

Instantly share code, notes, and snippets.

@coldclimate
Created April 5, 2014 17:22
Show Gist options
  • Select an option

  • Save coldclimate/9994931 to your computer and use it in GitHub Desktop.

Select an option

Save coldclimate/9994931 to your computer and use it in GitHub Desktop.
Grab your last.fm all time stats and see what you've contributed to the world listening stats.
import lastfm
api_key = 'REPLACEME'
api = lastfm.Api(api_key)
user = api.get_user('REPLACEME')
tracks = user.top_tracks
for track in tracks:
gcount = api.get_track(artist=track.artist.name,track=track.name).stats.playcount
print "%s %s %s of %s (%f )" % (track.artist.name,track.name, track.stats.playcount, gcount, track.stats.playcount/gcount)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment