Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
409 views
in Technique[技术] by (71.8m points)

python - get the name of a track from its id in spotipy

I have found lots of methods to get the id of a Spotify track but I haven't managed to find a method where I can get the name of one, couldn't find anything in the docs, or I'm just looking in the wrong place. Can anyone help?

question from:https://stackoverflow.com/questions/65904677/get-the-name-of-a-track-from-its-id-in-spotipy

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The track() function returns all kinds of information about a track in JSON format. To access the name, simply do something like:

track = 'spotify:track:0Svkvt5I79wficMFgqEQJ'
track = sp.track(track)

print(track["name"])

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...