Announcements

Help Wizard

Step 1

NEXT STEP

Recommendations Endpoint Returns Null Lists

Recommendations Endpoint Returns Null Lists

I've been working on an application that requires gathering a large dataset of tracks for model training. For this, I've been using the recommendations endpoint via Spotipy. Over the last month, I have had no issues; but just recently the endpoint started returning null lists.

 

Here's the code...

 

 

 

 

# Get list of genre seeds
    genre_seeds = sp.recommendation_genre_seeds()
    
    # For each genre...
    for genre_seed in tqdm(genre_seeds['genres']):
        # Create empty list to store genre's inserts
        inserts = []
        
        print(sp.recommendations(seed_genres=[genre_seed], limit=100))
        
        # Retrieve 100 recommendations for genre (wait & retry if timeout)
        try:
            doc = sp.recommendations(seed_genres=[genre_seed], limit=100)
        except ReadTimeout:
            time.sleep(60)
            doc = sp.recommendations(seed_genres=[genre_seed], limit=100)
            
        print(doc)

 

 

 

 

 

Here are some example responses...

 

 

 

 

{'tracks': [], 'seeds': [{'initialPoolSize': 0, 'afterFilteringSize': 0, 'afterRelinkingSize': 0, 'id': 'latino', 'type': 'GENRE', 'href': None}]}
{'tracks': [], 'seeds': [{'initialPoolSize': 0, 'afterFilteringSize': 0, 'afterRelinkingSize': 0, 'id': 'malay', 'type': 'GENRE', 'href': None}]}
{'tracks': [], 'seeds': [{'initialPoolSize': 0, 'afterFilteringSize': 0, 'afterRelinkingSize': 0, 'id': 'mandopop', 'type': 'GENRE', 'href': None}]}
{'tracks': [], 'seeds': [{'initialPoolSize': 0, 'afterFilteringSize': 0, 'afterRelinkingSize': 0, 'id': 'metal', 'type': 'GENRE', 'href': None}]}
{'tracks': [], 'seeds': [{'initialPoolSize': 0, 'afterFilteringSize': 0, 'afterRelinkingSize': 0, 'id': 'metal-misc', 'type': 'GENRE', 'href': None}]}
{'tracks': [], 'seeds': [{'initialPoolSize': 0, 'afterFilteringSize': 0, 'afterRelinkingSize': 0, 'id': 'metalcore', 'type': 'GENRE', 'href': None}]}
{'tracks': [], 'seeds': [{'initialPoolSize': 0, 'afterFilteringSize': 0, 'afterRelinkingSize': 0, 'id': 'minimal-techno', 'type': 'GENRE', 'href': None}]}
{'tracks': [], 'seeds': [{'initialPoolSize': 0, 'afterFilteringSize': 0, 'afterRelinkingSize': 0, 'id': 'movies', 'type': 'GENRE', 'href': None}]}
{'tracks': [], 'seeds': [{'initialPoolSize': 0, 'afterFilteringSize': 0, 'afterRelinkingSize': 0, 'id': 'mpb', 'type': 'GENRE', 'href': None}]}

 

 

 

 

 

To my knowledge, all other endpoints are still working as expected- not sure what's going on here... anyone have any ideas?

Reply
7 Replies

Same here as well. Getting recommendations by genre has been working well for me for well over six months, then suddenly stopped working last week. Is there any update from Spotify yet?

Same here! 

I'm having a similar issue as well, I wrote an app that returns a random song based on the selected genre. One workaround I found was that I had to add an artist argument, which kind of defeats the point because I wouldn't know the artist being recommended beforehand, but this does return a non-empty list of tracks

 

`https://api.spotify.com/v1/recommendations?limit=1&market=ES&seed_artists=4NHQUGzhtTLFvgF5SZesLK&seed_genres=${genre}`

 

I just noticed the artist and track seeds are REQUIRED now in their recommendation spec. That wasn't the case before. Did they make a breaking change and neglect to notify the community? 

That's weird, because they're definitely not BOTH required. You can still send just an artist or a track and get recommendations back.

If you are looking for playlists with genres, you can go to the website Every Noise At Once.

Suggested posts