Skip to content

Commit

Permalink
grabs all playlists
Browse files Browse the repository at this point in the history
  • Loading branch information
octoshrimpy committed Jun 10, 2021
1 parent eedf155 commit 6684f4b
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions spotui/src/spotifyApi.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,22 @@ def get_playlists(self):
self.auth()
if not self.token:
return []
playlists = self.client.current_user_playlists()
return list(map(self.__map_playlists, playlists["items"]))

# this grabs playlists spotify is trying to get the user to listen to
# playlists = self.client.user_playlists('spotify')

playlists = []
offset = 0

while True:
get_playlists = self.client.current_user_playlists(offset=offset)["items"]
playlists.extend(get_playlists)
if len(get_playlists) < 50:
break
offset += 50


return list(map(self.__map_playlists, playlists))
except Exception as e:
return []
pass
Expand Down

0 comments on commit 6684f4b

Please sign in to comment.