mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-06-19 17:23:53 +00:00
22 lines
627 B
Python
22 lines
627 B
Python
from spotipy.oauth2 import SpotifyClientCredentials
|
|
import spotipy
|
|
from pprint import pprint
|
|
|
|
sp = spotipy.Spotify(client_credentials_manager=SpotifyClientCredentials())
|
|
|
|
pl_id = 'spotify:playlist:5RIbzhG2QqdkaP24iXLnZX'
|
|
offset = 0
|
|
|
|
while True:
|
|
response = sp.playlist_items(pl_id,
|
|
offset=offset,
|
|
fields='items.track.id,total',
|
|
additional_types=['track'])
|
|
|
|
if len(response['items']) == 0:
|
|
break
|
|
|
|
pprint(response['items'])
|
|
offset = offset + len(response['items'])
|
|
print(offset, "/", response['total'])
|