Genres and types filters not working in Soundcloud

2019-04-02 03:49发布

问题:

This link does not return tracks from the rock genre as described in this post: Using the genres filter on Soundcloud API

Is this something that recently broke?

I'm using the Python SDK and have tried various calls to get the filter to work, and currently I can only get the created_at filter to be respected. Here is the python code:

track_page=client.get('/tracks', 
            created_at={'from':'2013-01-01 00:00:00','to':'2013-01-07 00:00:00'}, 
            genre='house',
            types=['recording','remix','original'],
            limit=limit_size,
            offset=offset)

The relevant documentation is here

回答1:

i just found a solution, add q='*' in your query. it will return correct results for the genre.

but i'm not sure about created_at[from/to] and duration[from/to]



回答2:

They haven't blogged about this change, but given that they're responding with 400 Client Error and the message "'q' parameter is required", it looks like you MUST supply a query now. (This is a new error that wasn't there a few days ago AFAIK).

I just tried passing an empty q parameter with a genre filter and it seemed to return appropriately filtered results.



回答3:

Your sample code shows that you're passing a genre parameter instead of the plural genres parameter. Make sure your actual code uses the plural — Soundcloud's API silently ignores the singular, as I learned the hard way last week.