Spoitfy and Echo Nest API Mismatches, How to Fix?

I am using the Spotify and Echo Nest APIs to get audio information about songs. The basic flow is:

  • Search for a song with Spotify's API using track title and artist name
  • Get the Spotify URL for the track from the response
  • Query the Echo Nest API to get the audio summary, using the Spotify ID
  • This has been working well for a long time. But in the past few months I have noticed more and more tracks that cannot be found in the Echo Nest API with the given Spotify ID.

    Here's an example from today. Sufjan Stevens's track "Chicago"

    Search for it on Spotify.http://ws.spotify.com/search/1/track.json?q=artist:sufjan%20track:chicago The first result gives us the spotify ID: spotify:track:7Bo0xLcXWx3pdhqwthqGaz

    Query Echo Nest for this Spotify ID: http://developer.echonest.com/api/v4/song/profile?api_key=V91CRTEB0IFMAJBMB&track_id=spotify:track:7Bo0xLcXWx3pdhqwthqGaz&bucket=audio_summary

    (For this URL I used their example API key, so you can see the result. Of course in my app I am using my own API key.)

    The response is "The Identifier specified does not exist: spotifyv2-ZZ:track:spotify:track:7Bo0xLcXWx3pdhqwthqGaz"

    But Echo Nest clearly does have this track in their database, because I can search for it, and even get Spotify Ids: http://developer.echonest.com/api/v4/song/search?api_key=V91CRTEB0IFMAJBMB&format=json&results=1&artist=sufjan&title=chicago&bucket=id:spotify&bucket=tracks (But the Spotify Id returned by Echo Nest is not the same as the one returned by Spotify.)

    Is there any way for me to fix this?


    Im noticing the same issue- what I did is to use Echo Nest's search instead, which actually allows you to do both at once. One less API call!

    for track in search_tracks:
        results = nest.get('song/search', artist=track['artist'],
            title=track['title'], bucket='audio_summary')
        if results['songs']:
            tracks.append(results['songs'][0])
    
    链接地址: http://www.djcxy.com/p/55598.html

    上一篇: Spotify API中是否有可以自动运行的方法?

    下一篇: Spoitfy和Echo Nest API不匹配,如何解决?