[GH-ISSUE #576] featured_playlists not returning amount requested with limit #343

Closed
opened 2026-02-27 23:22:06 +03:00 by kerem · 2 comments
Owner

Originally created by @FL550 on GitHub (Sep 14, 2020).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/576

Describe the bug
When calling featured_playlists with no limit parameter or limit greater 11, max 11 playlists are received.

Your code

from logging import ERROR
import time
import spotipy

dc = "INSERT_DC"
key = "INSERT_KEY"

class SpotifyToken:
    """Represents a spotify token."""

    sp_dc = None
    sp_key = None
    _access_token = None
    _token_expires = 0

    def __init__(self, sp_dc, sp_key):
        self.sp_dc = sp_dc
        self.sp_key = sp_key

    def ensure_token_valid(self):
        if float(self._token_expires) > time.time():
            return True
        self.get_spotify_token()

    @property
    def access_token(self):
        self.ensure_token_valid()
        return self._access_token

    def get_spotify_token(self):
        import spotify_token as st

        try:
            self._access_token, self._token_expires = st.start_session(self.sp_dc, self.sp_key)
            expires = self._token_expires - int(time.time())
            return self._access_token, expires
        except:
            raise ERROR("Could not get spotify token")

client = spotipy.Spotify(auth=SpotifyToken(dc, key).access_token)
resp = {}
limit = 15
resp = client.featured_playlists(
        timestamp=None, limit=limit, offset=0
    )
print(f"Limit: {limit} Received: {resp.get('playlists').get('total')}")

Expected behavior
Receive more than 11 playlists.

Output
Limit: 15 Received: 11

Environment:

  • OS: Windows, Raspian
  • Python version: multiple, all greater thn 3.7.0
  • spotipy version 2.15.0

Additional context
According to https://developer.spotify.com/documentation/web-api/reference/browse/get-list-featured-playlists/ it should be possible to receive 50 playlists.

Originally created by @FL550 on GitHub (Sep 14, 2020). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/576 **Describe the bug** When calling **featured_playlists** with no limit parameter or limit greater 11, max 11 playlists are received. **Your code** ``` from logging import ERROR import time import spotipy dc = "INSERT_DC" key = "INSERT_KEY" class SpotifyToken: """Represents a spotify token.""" sp_dc = None sp_key = None _access_token = None _token_expires = 0 def __init__(self, sp_dc, sp_key): self.sp_dc = sp_dc self.sp_key = sp_key def ensure_token_valid(self): if float(self._token_expires) > time.time(): return True self.get_spotify_token() @property def access_token(self): self.ensure_token_valid() return self._access_token def get_spotify_token(self): import spotify_token as st try: self._access_token, self._token_expires = st.start_session(self.sp_dc, self.sp_key) expires = self._token_expires - int(time.time()) return self._access_token, expires except: raise ERROR("Could not get spotify token") client = spotipy.Spotify(auth=SpotifyToken(dc, key).access_token) resp = {} limit = 15 resp = client.featured_playlists( timestamp=None, limit=limit, offset=0 ) print(f"Limit: {limit} Received: {resp.get('playlists').get('total')}") ``` **Expected behavior** Receive more than 11 playlists. **Output** `Limit: 15 Received: 11` **Environment:** - OS: Windows, Raspian - Python version: multiple, all greater thn 3.7.0 - spotipy version 2.15.0 **Additional context** According to https://developer.spotify.com/documentation/web-api/reference/browse/get-list-featured-playlists/ it should be possible to receive 50 playlists.
kerem 2026-02-27 23:22:06 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@stephanebruckert commented on GitHub (Sep 14, 2020):

Could it be that there are no more than 11 featured playlists?

Received: {resp.get('playlists').get('total')}"

Here what you called "received" is actually "total". And "total" seems to be always the same, no matter what "limit" is.

<!-- gh-comment-id:691857277 --> @stephanebruckert commented on GitHub (Sep 14, 2020): Could it be that there are no more than 11 featured playlists? Received: {resp.get('playlists').get('total')}" Here what you called "received" is actually "total". And "total" seems to be always the same, no matter what "limit" is.
Author
Owner

@FL550 commented on GitHub (Sep 14, 2020):

You are right. Trying it with the console confirmed this. Sorry to bother you.

<!-- gh-comment-id:691885889 --> @FL550 commented on GitHub (Sep 14, 2020): You are right. Trying it with the [console](https://developer.spotify.com/console/get-featured-playlists/) confirmed this. Sorry to bother you.
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#343
No description provided.