-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: force market as request option to search for shows #258
base: master
Are you sure you want to change the base?
fix: force market as request option to search for shows #258
Conversation
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 |
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. |
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. |
@@ -124,6 +129,10 @@ func (c *Client) Search(ctx context.Context, query string, t SearchType, opts .. | |||
v.Set("q", query) | |||
v.Set("type", t.encode()) | |||
|
|||
if t == SearchTypeShow && v.Get("market") == "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this is specific to searching Shows - but I'm also not sure that returning an Error here is the right thing to do. Spotify could adjust their API behaviour in future. Perhaps we just need to better document that when using Client ID/Secret you need to specify the market as there's no default market.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed, better documentation is probably the way to go as we don't control the scope of these params or if/when this issue really will get fixed. we can't decode the bearer token to get user info for us to implement the fallback method can we?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can't decode the bearer token to get user info for us to implement the fallback method can we?
I think we'd probably want to avoid that - even if the bearer token was decodable it'd probably be a bad idea for us to couple with that.
As put in this issue #257 calling for
client.Search
withSearchTypeShow
was always returning zero values forShows
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:
This PR has:
client.Search
withSearchTypeShow
soclient
won't return zero values for correct search values.client.Search
withSearchTypeShow
.CountryColombia
.