[GH-ISSUE #963] Getting max search result #578

Closed
opened 2026-02-27 23:23:27 +03:00 by kerem · 1 comment
Owner

Originally created by @AkinSu on GitHub (Apr 10, 2023).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/963

So I'm trying to get every result in a search, but I don't understand the search max.

total_results = sp.search(q = sign, type='playlist', limit = 1)['playlists']['total'] playlists = sp.search(q = sign, type="playlist", limit=search_max), I tried this but kept giving me errors

Then I tried a loopwhile True: search_results = sp.search(q=q, type=search_type, limit=limit, offset=offset) items = search_results['tracks']['items'] if len(items) == 0 or len(items) < limit: break results_list.extend(items) offset += limit print(f'Found {len(results_list)} {search_type}s matching "{q}"') but got the same error.

Originally created by @AkinSu on GitHub (Apr 10, 2023). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/963 So I'm trying to get every result in a search, but I don't understand the search max. `total_results = sp.search(q = sign, type='playlist', limit = 1)['playlists']['total'] playlists = sp.search(q = sign, type="playlist", limit=search_max)`, I tried this but kept giving me errors Then I tried a loop`while True: search_results = sp.search(q=q, type=search_type, limit=limit, offset=offset) items = search_results['tracks']['items'] if len(items) == 0 or len(items) < limit: break results_list.extend(items) offset += limit print(f'Found {len(results_list)} {search_type}s matching "{q}"')` but got the same error.
kerem 2026-02-27 23:23:27 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@AkinSu commented on GitHub (Apr 10, 2023):

Also note I'm using client cred

client_credentials_manager = SpotifyClientCredentials(client_id=client_id, client_secret=client_secret) sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)

<!-- gh-comment-id:1501730427 --> @AkinSu commented on GitHub (Apr 10, 2023): Also note I'm using client cred `client_credentials_manager = SpotifyClientCredentials(client_id=client_id, client_secret=client_secret) sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)`
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotipy#578
No description provided.