Announcements

Help Wizard

Step 1

NEXT STEP

API Search not returning correct results for Short Names

API Search not returning correct results for Short Names

Hi

 

I'm writing a python script to generate playlists based on (amongst other things) a text file containing a list of artists.

 

For each artist/line in the file, I submit the name to the Spotify API using a basic spotipy search object (spObject.search(artistName, 1, 0, 'artist'). then use fuzzywuzzy to do a string comparison on the results to help fllter out false matches.

 

However, I've noticed there's a problem which looks to be specific to short names. If you have a look at the following log excerpt, you can see that the all the matches of 5 letters or below have had errant, longer matches returned by the API.

 

Fergus McCreadie Trio
Fergus McCreadie Trio : Fergus McCreadie Trio : 100 = [MATCH]
Fiona Hunter
Fiona Hunter : Fiona Hunter : 100 = [MATCH]
Elephant Sessions
Elephant Sessions : Elephant Sessions : 100 = [MATCH]
Fara
Fara : 4cAK3ppXdvOCI7gY9sktdO : Faraday Max : 53 = [FAIL]
Ímar
Ímar : 53XhwfbYqKCa1cC15pYq2q : Imagine Dragons : 32 = [FAIL]
Le Vent Du Nord
Le Vent Du Nord : Le Vent du Nord : 93 = [MATCH]
Lyre
Lyre : 6jX8VHUJomYSfi5Hobdmmn : Lyre Le Temps : 47 = [FAIL]
RANT
RANT : 1I2kSlGt4EuJd7A5kHqepp : Rantan Gee : 14 = [FAIL]
Sian
Sian : 2DTw633fgdoxrqv7uPdcCw : Sian Evans : 57 = [FAIL]
Siobhan Miller
Siobhan Miller : Siobhan Miller : 100 = [MATCH]
TRYST
TRYST : 7cFuB1Iqx6aq5hDmU4m8C4 : Tryst (UK) : 13 = [FAIL]

 

Some of these are relatively obscure artists, so I did initially wonder if maybe there was some kind of popularity weighting, but oddly though if I do a manual search for the same artists directly in the Spotipy app (Imar, RANT, Fara for example) as a general rule the first match is the correct one?

 

Is anybody able to explain this discrepancy, and/or know if there's anything I can do about it? The search object (https://developer.spotify.com/documentation/web-api/reference/search/search/) doesn't look to have much in the way of helpful parameters, unless I start trying to looping over the offset value to try more results.

 

Thanks. 

Alex.

Reply
0 Replies

Suggested posts