0

I was looking for a way to display my last played Spotify track on my website. I succeeded using the Last.FM API. Spotify doesn't have an open API and the music part of Facebook seems to be locked down too. So I now scrobble everything to last.fm and use their API to get the last played song. This works fine, but I thought it would be fun to display a "play now" button to play the track on spotify.

To do that, I need the Spotify ID for the particular song, which the last.fm api doesn't seem to return.

So... two questions: 1) is there a way to get the same info from Spotify itself? 2) if not, is there a good way to get the matching spotify song using the Last.FM details?

Jasper
  • 1,697
  • 2
  • 23
  • 48

1 Answers1

2

1) No. Spotify doesn't have a play history API. However, you can use Facebook's listens endpoint if the user is publishing listens to Facebook.

2) Not directly, as far as I'm aware. However, a quick Google turns up this project. Failing that, you can use the Spotify Web Search API to search for a track matching the metadata. The Advanced Search Syntax may come in handy here.

iKenndac
  • 18,730
  • 3
  • 35
  • 51
  • Thanks. The listens endpoint of Facebook requires additional privileges. I checked the graph API explorer, but that doesn't seem to have an options to include those rights into a static API key. Do you know how to get one? As for the search option; that might work, but it won't guarantee that it's actually the same track. Bit too dodgy for my taste :) – Jasper Jul 08 '12 at 15:55