spotify icon indicating copy to clipboard operation
spotify copied to clipboard

fix: force market as request option to search for shows

Open Santiago-Balcero opened this issue 1 year ago • 4 comments

As put in this issue https://github.com/zmb3/spotify/issues/257 calling for client.Search with SearchTypeShow was always returning zero values for Shows data.

When doing same request I got same issue, so when looking into Spotify Developer Forums here and here it turned out to be a Spotify unfixed issue since, at least, 2020.

The solution to this as put by the community is to add market as query parameter as in:

curl --location 'https://api.spotify.com/v1/search?q=cyclast&type=show&market=co' \
--header 'Authorization: Bearer your-token'

This PR has:

  • Enforces the use of market parameter when using client.Search with SearchTypeShow so client won't return zero values for correct search values.
  • Creates a unit test for client.Search with SearchTypeShow.
  • Adds CountryColombia.

Santiago-Balcero avatar Apr 14 '24 19:04 Santiago-Balcero

after a quick local test session, I don't think market is the core issue here, when using curl or postman I can get the results without having to pass in the market parameter, something else is wrong, probably the way we're parsing the shows, will have a further look into it later image

subash774 avatar Apr 18 '24 22:04 subash774

aplogies, I was wrong, found the issue - when using bearer token generated from developer.spotify.com, the returned json contains all the data we need, however, when we use the client id and secret to generate a bearer token on each request, using the token spotify returns does not return any shows unless market parameter is passed in. Issue is on spotify side, @zmb3 @strideynet not sure how you wanna proceed here

subash774 avatar Apr 18 '24 22:04 subash774

Followed @subash774 suggestion on new Error. As seen on Spotify forums it is on their side. Waiting for @zmb3 and @strideynet answer to see if they will proceed with this PR or not. Anyways I will be glad to help.

Santiago-Balcero avatar Apr 18 '24 23:04 Santiago-Balcero

Thanks for raising this - I believe the market issue has been a "problem"/expected behaviour for a while. When using an access token, the native market of the user who the token is associated with is used. When only the Client ID/Secret is used, there is no default market to fall back on.

I'll take a look at this PR later today.

strideynet avatar Apr 19 '24 12:04 strideynet