Spotipy音频功能 - 从uri获取音轨名称

时间:2016-08-08 23:21:30

标签: python spotipy

Spotify的audio features endpoint会返回如下请求:

{ audio_features: 
   [ { "danceability": 0.808,
       "energy": 0.626,
       "key": 7,
       "loudness": -12.733,
       "mode": 1,
       "speechiness": 0.168,
       "acousticness": 0.00187,
       "instrumentalness": 0.159,
       "liveness": 0.376,
       "valence": 0.369,
       "tempo": 123.99,
       "type": "audio_features",
       "id": "4JpKVNYnVcJ8tuMKjAj50A",
       "uri": "spotify:track:4JpKVNYnVcJ8tuMKjAj50A",
       "track_href": "https://api.spotify.com/v1/tracks/4JpKVNYnVcJ8tuMKjAj50A",
       "analysis_url": "http://echonest-analysis.s3.amazonaws.com/TR/WhpYUARk1kNJ_qP0AdKGcDDFKOQTTgsOoINrqyPQjkUnbteuuBiyj_u94iFCSGzdxGiwqQ6d77f4QLL_8=/3/full.json?AWSAccessKeyId=AKIAJRDFEY23UEVW42BQ&Expires=1458063189&Signature=JRE8SDZStpNOdUsPN/PoS49FMtQ%3D",
       "duration_ms": 535223,
       "time_signature": 4 
     },

我想在条件下打印曲目名称和给定的功能,如下所示:

features = show_audio_features(artist)

low_energy_songs = [x['energy'] for x in features if x < 0.5]

如何打印歌曲名称 +参数,而不是打印其url

我必须向其他endpoint提出请求吗?

谢谢!

0 个答案:

没有答案