mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-10-11 09:10:45 +00:00
show_featured_artists.py and update publishing docs (#821)
* show_featured_artists.py and update publishing docs * Don't update version Co-authored-by: Stéphane Bruckert <contact@stephanebruckert.com>
This commit is contained in:
1 parent
61c8cda006
commit
a4cfd83946
2 files changed
+36
-4
No files matched your search
@@ -0,0 +1,27 @@
|
||||
# Shows all artists featured on an album
|
||||
|
||||
# usage: featured_artists.py spotify:album:[album urn]
|
||||
|
||||
from spotipy.oauth2 import SpotifyClientCredentials
|
||||
import sys
|
||||
import spotipy
|
||||
from pprint import pprint
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
urn = sys.argv[1]
|
||||
else:
|
||||
urn = 'spotify:album:5yTx83u3qerZF7GRJu7eFk'
|
||||
|
||||
sp = spotipy.Spotify(client_credentials_manager=SpotifyClientCredentials())
|
||||
album = sp.album(urn)
|
||||
|
||||
featured_artists = set()
|
||||
|
||||
items = album['tracks']['items']
|
||||
|
||||
for item in items:
|
||||
for ele in item['artists']:
|
||||
if 'name' in ele:
|
||||
featured_artists.add(ele['name'])
|
||||
|
||||
pprint(featured_artists)
|
||||
Reference in new issue
Block a user