Skip to content
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

client.Search for SearchTypeShow returns zero values #257

Open
Santiago-Balcero opened this issue Mar 29, 2024 · 3 comments
Open

client.Search for SearchTypeShow returns zero values #257

Santiago-Balcero opened this issue Mar 29, 2024 · 3 comments

Comments

@Santiago-Balcero
Copy link

Hi!

Currently working in a project with this Spotify client. When using client.Search for SearchTypeShow it always returns zero values of type SimpleShowPage.

I create client in this way:

ctx := context.Background()
	authConfig := &clientcredentials.Config{
		ClientID:     SpotifyId,
		ClientSecret: SpotifySecret,
		TokenURL:     spotifyauth.TokenURL,
	}

	accessToken, err := authConfig.Token(ctx)
	if err != nil {
		log.Fatal("Error creating spotify client: ", err)
	}
	httpClient := spotifyauth.New().Client(ctx, accessToken)
	Spotify = *spotify.New(httpClient)

This is the line I use to call the search method, being podcastName a string:

result, err := client.Search(ctx, podcastName, spotify.SearchTypeShow)
if err != nil {
	return "", fmt.Errorf("error searching podcast: %v", err)
}

log.Println(result.Shows)

And this is what I get as result.Shows no matter which podcastName value I use:

2024/03/28 20:54:39 &{{https://api.spotify.com/v1/search?query=cosas+de+profes&type=show&offset=0&limit=20 20 0 399 https://api.spotify.com/v1/search?query=cosas+de+profes&type=show&offset=20&limit=20 } [{{[] []  false map[]   [] <nil> []     } {{ 0 0 0  } []}} {{[] []  false map[]   [] <nil> []     } {{ 0 0 0  } []}} {{[] []  false map[]   [] <nil> []     } {{ 0 0 0  } []}} {{[] []  false map[]   [] <nil> []     } {{ 0 0 0  } []}} {{[] []  false map[]   [] <nil> []     } {{ 0 0 0  } []}} {{[] []  false map[]   [] <nil> []     } {{ 0 0 0  } []}} {{[] []  false map[]   [] <nil> []     } {{ 0 0 0  } []}} {{[] []  false map[]   [] <nil> []     } {{ 0 0 0  } []}} {{[] []  false map[]   [] <nil> []     } {{ 0 0 0  } []}} {{[] []  false map[]   [] <nil> []     } {{ 0 0 0  } []}} {{[] []  false map[]   [] <nil> []     } {{ 0 0 0  } []}} {{[] []  false map[]   [] <nil> []     } {{ 0 0 0  } []}} {{[] []  false map[]   [] <nil> []     } {{ 0 0 0  } []}} {{[] []  false map[]   [] <nil> []     } {{ 0 0 0  } []}} {{[] []  false map[]   [] <nil> []     } {{ 0 0 0  } []}} {{[] []  false map[]   [] <nil> []     } {{ 0 0 0  } []}} {{[] []  false map[]   [] <nil> []     } {{ 0 0 0  } []}} {{[] []  false map[]   [] <nil> []     } {{ 0 0 0  } []}} {{[] []  false map[]   [] <nil> []     } {{ 0 0 0  } []}} {{[] []  false map[]   [] <nil> []     } {{ 0 0 0  } []}}]}

I am using the exact same way to search for SearchTypeArtist, which works perfectly.

Any help or comments would be helpful. Thanks!

@subash774
Copy link

@Santiago-Balcero result.Shows is of type SimpleShowPage, you'll find your actual shows inside that object, so result.Shows.Shows should give you what you're looking for.

@Santiago-Balcero
Copy link
Author

Santiago-Balcero commented Apr 12, 2024

@subash774 You are right, it should. But when looking into results.Shows.Shows I see nothing. Following line prints nothing.

for _, a := range result.Shows.Shows {
        log.Println(a)
}

@Santiago-Balcero
Copy link
Author

Created PR to fix this: PR #258

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants