zmb3 / spotify

A Go wrapper for the Spotify Web API
Apache License 2.0
1.38k stars 292 forks source link

fix: force market as request option to search for shows #258

Open Santiago-Balcero opened 5 months ago

Santiago-Balcero commented 5 months ago

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:

subash774 commented 5 months ago

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 commented 5 months ago

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

Santiago-Balcero commented 5 months ago

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.

strideynet commented 5 months ago

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.