mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-06-19 01:03:53 +00:00
* Update playlist endpoints to modern format Deprecate user_playlist_* in favor of the following replacements: * user_playlist_change_details -> playlist_change_details * user_playlist_unfollow -> current_user_unfollow_playlist * user_playlist_add_tracks -> playlist_add_tracks * user_playlist_replace_tracks -> playlist_replace_tracks * user_playlist_reorder_tracks -> playlist_reorder_tracks * user_playlist_remove_all_occurrences_of_tracks -> playlist_remove_all_occurrences_of_tracks * user_playlist_remove_specific_occurrences_of_tracks -> playlist_remove_specific_occurrences_of_tracks * user_playlist_follow_playlist -> current_user_follow_playlist * user_playlist_is_following -> playlist_is_following * Add current_user_following_artists and current_user_following_users * Update tests and examples Resolve TODO in test_user_endpoints.py > SpotifyFollowApiTests.test_user_follows_and_unfollows_user Use modern playlist endpoints (no username required) in tests and examples. * Update changelog * Deprecate playlist_tracks in favor of playlist_items * Link deprecated functions to new functions and change tracks to items * Fix references to playlist_tracks * Change test_playlist_add_items as requested
21 lines
626 B
Python
21 lines
626 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'])
|
|
pprint(response['items'])
|
|
offset = offset + len(response['items'])
|
|
print(offset, "/", response['total'])
|
|
|
|
if len(response['items']) == 0:
|
|
break
|