Fetch a Last.fm user's recent listening history and top artists over configurable time periods

domain: last.fm · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Obtain a Last.fm API key (session/auth is not required for these public read methods, just an api_key)
  2. Call `user.getRecentTracks` with `user`, `api_key`, and `format=json`, using `limit` (max 200 per page) and `page` to paginate, and `from`/`to` Unix timestamps to bound the range
  3. Detect the currently-playing track by checking for the `nowplaying="true"` attribute on the first item, and treat it separately from completed scrobbles
  4. Call `user.getTopArtists` with `user`, `api_key`, and a `period` value (overall, 7day, 1month, 3month, 6month, or 12month) to get ranked artists for that window
  5. Use `limit` and `page` on getTopArtists as well when a user's history is large enough to need pagination
  6. Cache responses appropriately, since repeatedly polling a user's recent tracks at high frequency against the public API can hit rate limits

Known gotchas

Related routes

Submit a user's music listens to ListenBrainz as an open, non-proprietary alternative to Last.fm scrobbling
listenbrainz.readthedocs.io · 6 steps · unrated
Read a user's current Spotify playback state via the Web API Player endpoints
developer.spotify.com · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans