mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-27 00:25:54 +03:00
[GH-ISSUE #963] Getting max search result #578
Labels
No labels
api-bug
bug
dependencies
documentation
duplicate
enhancement
external-ide
headless-mode
implicit-grant-flow
invalid
missing-endpoint
pr-welcome
private-api
pull-request
question
spotipy3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotipy#578
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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 errorsThen 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.@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)