[GH-ISSUE #1076] Spotipy.search is returning incorrec Artist Info when limit set to 1 #635

Closed
opened 2026-02-28 00:00:25 +03:00 by kerem · 2 comments
Owner

Originally created by @XavaarQ on GitHub (Mar 1, 2024).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/1076

Describe the bug
Spotipy.search is returning incorrect Artist Info when limit set to 1 for example information for Drake is returned when Taylor swift is searched. If limit is set >1 then the first entry is the correct artist.

Your code
spotipy = spotipy.Spotify(auth_manager=SpotifyOAuth(scope=scope))
spotipy.search(q='Taylor Swift', type='artist', limit=1)

Expected behavior
Artist info for the artist searched for should be returned when limit is set to 1

Output

{'artists': {'href': 'https://api.spotify.com/v1/search?query=Taylor+Swift&type=artist&offset=0&limit=1',
  'items': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3TVXtAsR1Inumwj472S9r4'},
    'followers': {'href': None, 'total': 84483099},
    'genres': ['canadian hip hop',
     'canadian pop',
     'hip hop',
     'pop rap',
     'rap'],
    'href': 'https://api.spotify.com/v1/artists/3TVXtAsR1Inumwj472S9r4',
    'id': '3TVXtAsR1Inumwj472S9r4',
    'images': [{'height': 640,
      'url': 'https://i.scdn.co/image/ab6761610000e5eb4293385d324db8558179afd9',
      'width': 640},
     {'height': 320,
      'url': 'https://i.scdn.co/image/ab676161000051744293385d324db8558179afd9',
      'width': 320},
     {'height': 160,
      'url': 'https://i.scdn.co/image/ab6761610000f1784293385d324db8558179afd9',
      'width': 160}],
    'name': 'Drake',
    'popularity': 96,
    'type': 'artist',
    'uri': 'spotify:artist:3TVXtAsR1Inumwj472S9r4'}],
  'limit': 1,
  'next': 'https://api.spotify.com/v1/search?query=Taylor+Swift&type=artist&offset=1&limit=1',
  'offset': 0,
  'previous': None,
  'total': 2}}

Environment:

  • OS: Ubuntu 20.04.5 LTS
  • Python version 3.9.18
  • spotipy version 2.23.0
  • VScode

Additional context
This function was returning correct info yesterday Feb 29th, 2024

Originally created by @XavaarQ on GitHub (Mar 1, 2024). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/1076 **Describe the bug** Spotipy.search is returning incorrect Artist Info when limit set to 1 for example information for Drake is returned when Taylor swift is searched. If limit is set >1 then the first entry is the correct artist. **Your code** spotipy = spotipy.Spotify(auth_manager=SpotifyOAuth(scope=scope)) spotipy.search(q='Taylor Swift', type='artist', limit=1) **Expected behavior** Artist info for the artist searched for should be returned when limit is set to 1 **Output** ``` {'artists': {'href': 'https://api.spotify.com/v1/search?query=Taylor+Swift&type=artist&offset=0&limit=1', 'items': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3TVXtAsR1Inumwj472S9r4'}, 'followers': {'href': None, 'total': 84483099}, 'genres': ['canadian hip hop', 'canadian pop', 'hip hop', 'pop rap', 'rap'], 'href': 'https://api.spotify.com/v1/artists/3TVXtAsR1Inumwj472S9r4', 'id': '3TVXtAsR1Inumwj472S9r4', 'images': [{'height': 640, 'url': 'https://i.scdn.co/image/ab6761610000e5eb4293385d324db8558179afd9', 'width': 640}, {'height': 320, 'url': 'https://i.scdn.co/image/ab676161000051744293385d324db8558179afd9', 'width': 320}, {'height': 160, 'url': 'https://i.scdn.co/image/ab6761610000f1784293385d324db8558179afd9', 'width': 160}], 'name': 'Drake', 'popularity': 96, 'type': 'artist', 'uri': 'spotify:artist:3TVXtAsR1Inumwj472S9r4'}], 'limit': 1, 'next': 'https://api.spotify.com/v1/search?query=Taylor+Swift&type=artist&offset=1&limit=1', 'offset': 0, 'previous': None, 'total': 2}} ``` **Environment:** - OS: Ubuntu 20.04.5 LTS - Python version 3.9.18 - spotipy version 2.23.0 - VScode **Additional context** This function was returning correct info yesterday Feb 29th, 2024
kerem 2026-02-28 00:00:25 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@dieser-niko commented on GitHub (Apr 22, 2024):

This is more or less a problem with Spotify's API, not Spotipy. It also seems to be fixed now, at least I couldn't replicate the issue.

<!-- gh-comment-id:2068802624 --> @dieser-niko commented on GitHub (Apr 22, 2024): This is more or less a problem with Spotify's API, not Spotipy. It also seems to be fixed now, at least I couldn't replicate the issue.
Author
Owner

@dieser-niko commented on GitHub (May 23, 2024):

Any updates so far? Please close the issue if your problem has been resolved.

<!-- gh-comment-id:2126662070 --> @dieser-niko commented on GitHub (May 23, 2024): Any updates so far? Please close the issue if your problem has been resolved.
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#635
No description provided.