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:
dnlruizandStéphane Bruckert authored and GitHub committed 2022-06-18 23:26:43 +01:00
1 parent 61c8cda006
commit a4cfd83946
2 files changed
+36 -4

No files matched your search

+27
View File
@@ -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)