Issue with Search API returning different results

Reply

Issue with Search API returning different results

74pfe9-e_xawo
Newbie

Hi,

 

I'm trying to use the Search API to search for a podcast via a Spotify application.

When I try to use the Web Console, everything works fine. However, when I try to run the same logic via a Python script, the API response is different - potentially missing data. Here is the API response I receive from my script: 

 

 

{'shows': {'href': 'https://api.spotify.com/v1/search?query=dear+hank+%26+john&type=show&offset=0&limit=20',
  'items': [None, None],
  'limit': 20,
  'next': None,
  'offset': 0,
  'previous': None,
  'total': 2}}

 

I'd appreciate it if someone can point me in the right direction of figuring the error out from my side.

3 Replies

Freedom_Dev
Casual Listener

We are seeing exactly the same problem

Simple example to lookup track by isrc:USSM11906291

Result returned by OAuth token from search console (and expected result)

https://developer.spotify.com/console/get-search-item/?q=isrc%3AUSSM11906291&type=&market=&limit=1&o...

 

curl -X "GET" "https://api.spotify.com/v1/search?query=isrc%3AUSSM11906291&type=track&offset=0&limit=1" -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer xxxx"
{
  "tracks" : {
    "href" : "https://api.spotify.com/v1/search?query=isrc%3AUSSM11906291&type=track&offset=0&limit=1",
    "items" : [ ],
    "limit" : 1,
    "next" : null,
    "offset" : 0,
    "previous" : null,
    "total" : 0
  }
}{
  "tracks" : {
    "href" : "https://api.spotify.com/v1/search?query=isrc%3AUSSM11906291&type=track&offset=0&limit=1",
    "items" : [ {
      "album" : {
        "album_type" : "single",
        "artists" : [ {
          "external_urls" : {
            "spotify" : "https://open.spotify.com/artist/1MXZ0hsGic96dWRDKwAwdr"
          },
          "href" : "https://api.spotify.com/v1/artists/1MXZ0hsGic96dWRDKwAwdr",
          "id" : "1MXZ0hsGic96dWRDKwAwdr",
          "name" : "Tyla Yaweh",
          "type" : "artist",
          "uri" : "spotify:artist:1MXZ0hsGic96dWRDKwAwdr"
        } ],
        "available_markets" : [ "AE", "BH", "BY", "EG", "ID", "IN", "JO", "KR", "KW", "LB", "MY", "OM", "PH", "PS", "QA", "SA", "ZA" ],
        "external_urls" : {
          "spotify" : "https://open.spotify.com/album/5rYqahY5a5JngAtWhGsDxd"
        },
        "href" : "https://api.spotify.com/v1/albums/5rYqahY5a5JngAtWhGsDxd",
        "id" : "5rYqahY5a5JngAtWhGsDxd",
        "images" : [ {
          "height" : 640,
          "url" : "https://i.scdn.co/image/ab67616d0000b273fed5753dfd79d9ccabd1c8ab",
          "width" : 640
        }, {
          "height" : 300,
          "url" : "https://i.scdn.co/image/ab67616d00001e02fed5753dfd79d9ccabd1c8ab",
          "width" : 300
        }, {
          "height" : 64,
          "url" : "https://i.scdn.co/image/ab67616d00004851fed5753dfd79d9ccabd1c8ab",
          "width" : 64
        } ],
        "name" : "I Think I Luv Her (feat. YG)",
        "release_date" : "2019-09-27",
        "release_date_precision" : "day",
        "total_tracks" : 1,
        "type" : "album",
        "uri" : "spotify:album:5rYqahY5a5JngAtWhGsDxd"
      },
      "artists" : [ {
        "external_urls" : {
          "spotify" : "https://open.spotify.com/artist/1MXZ0hsGic96dWRDKwAwdr"
        },
        "href" : "https://api.spotify.com/v1/artists/1MXZ0hsGic96dWRDKwAwdr",
        "id" : "1MXZ0hsGic96dWRDKwAwdr",
        "name" : "Tyla Yaweh",
        "type" : "artist",
        "uri" : "spotify:artist:1MXZ0hsGic96dWRDKwAwdr"
      }, {
        "external_urls" : {
          "spotify" : "https://open.spotify.com/artist/0A0FS04o6zMoto8OKPsDwY"
        },
        "href" : "https://api.spotify.com/v1/artists/0A0FS04o6zMoto8OKPsDwY",
        "id" : "0A0FS04o6zMoto8OKPsDwY",
        "name" : "YG",
        "type" : "artist",
        "uri" : "spotify:artist:0A0FS04o6zMoto8OKPsDwY"
      } ],
      "available_markets" : [ "AE", "BH", "BY", "EG", "ID", "IN", "JO", "KR", "KW", "LB", "MY", "OM", "PH", "PS", "QA", "SA", "ZA" ],
      "disc_number" : 1,
      "duration_ms" : 160742,
      "explicit" : false,
      "external_ids" : {
        "isrc" : "USSM11906291"
      },
      "external_urls" : {
        "spotify" : "https://open.spotify.com/track/46jINX5I0agia69cDovyYg"
      },
      "href" : "https://api.spotify.com/v1/tracks/46jINX5I0agia69cDovyYg",
      "id" : "46jINX5I0agia69cDovyYg",
      "is_local" : false,
      "name" : "I Think I Luv Her (feat. YG)",
      "popularity" : 1,
      "preview_url" : "https://p.scdn.co/mp3-preview/c09049f6f62d361c78e1d2d97318b15900a4a4fd?cid=774b29d4f13844c495f206cafdad9c86",
      "track_number" : 1,
      "type" : "track",
      "uri" : "spotify:track:46jINX5I0agia69cDovyYg"
    } ],
    "limit" : 1,
    "next" : null,
    "offset" : 0,
    "previous" : null,
    "total" : 1
  }
}

 

However, results returned by using token generated from client id/secret

curl -X "GET" "https://api.spotify.com/v1/search?query=isrc%3AUSSM11906291&type=track&offset=0&limit=1" -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Barer xxxx"
{
  "tracks" : {
    "href" : "https://api.spotify.com/v1/search?query=isrc%3AUSSM11906291&type=track&offset=0&limit=1",
    "items" : [ ],
    "limit" : 1,
    "next" : null,
    "offset" : 0,
    "previous" : null,
    "total" : 0
  }

 While other ISRC seems to work fine? ex: USWB11902981

Freedom_Dev
Casual Listener
Additionally, we have found following ISRCs returns data after client auth
USSM11600446
USWB11901040
USWB11901041
USWB11901840

However, using in spotify console with user auth, these ISRC returns no data for some reason

Hubo
Rock Star 16
Rock Star 16
Hey there, thanks for reaching out here!

Hmm, let's dive into this! Could you try to do this search without the "'" (apostrophe)? Does the API return the right results? Let me know how you get on!

Have a good one,
Hubo
HuboRock Star 16
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.
SUGGESTED POSTS