Silvano H.
Silvano H.

Reputation: 63

search songs by bpm range and key using spotipy

On spotipy's docs I can see that the only way it seems to be possible to search songs is by artist's name or title.

results = sp.search(q='weezer', limit=20)
for idx, track in enumerate(results['tracks']['items']):
    print(idx, track['name'])

Is there any way to search by BPM,KEY and GENRE all togheter?

Upvotes: 1

Views: 1199

Answers (1)

zunkelty
zunkelty

Reputation: 317

Yes there is! The endpoint https://api.spotify.com/v1/recommendations lets you get songs based on BPM, key and genre (and much more). You can provide Spotify with a target_key, target_tempo and up to 5 genres under seed_genres. Spotify then returns songs that fit the given parameters.

Upvotes: 1

Related Questions