mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-06-19 09:13:53 +00:00
19 lines
485 B
Python
19 lines
485 B
Python
import spotipy
|
|
from spotipy.oauth2 import SpotifyClientCredentials
|
|
import sys
|
|
|
|
client_credentials_manager = SpotifyClientCredentials()
|
|
sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)
|
|
|
|
if len(sys.argv) > 1:
|
|
name = ' '.join(sys.argv[1:])
|
|
else:
|
|
name = 'Radiohead'
|
|
|
|
results = sp.search(q='artist:' + name, type='artist')
|
|
items = results['artists']['items']
|
|
if len(items) > 0:
|
|
artist = items[0]
|
|
print(artist['name'], artist['images'][0]['url'])
|
|
|