mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-06-19 17:23:53 +00:00
18 lines
486 B
Python
18 lines
486 B
Python
# Shows the top artists for a user
|
|
import spotipy
|
|
from spotipy.oauth2 import SpotifyOAuth
|
|
|
|
scope = 'user-top-read'
|
|
ranges = ['short_term', 'medium_term', 'long_term']
|
|
|
|
sp = spotipy.Spotify(auth_manager=SpotifyOAuth(scope=scope))
|
|
|
|
for sp_range in ['short_term', 'medium_term', 'long_term']:
|
|
print("range:", sp_range)
|
|
|
|
results = sp.current_user_top_artists(time_range=sp_range, limit=50)
|
|
|
|
for i, item in enumerate(results['items']):
|
|
print(i, item['name'])
|
|
print()
|