javpet
javpet

Reputation: 33

Soundcloud ruby gem - genres / tags filter doesn't work

I'm trying to get certain tracks with filters on genres / tags, and it seems to work when it's only one genre, although it doesn't work when it's multiple genres in array meanwhile the documentation says it accepts a list: https://developers.soundcloud.com/docs/api/reference#tracks

client.get('/tracks', limit: 200, order: 'created_at', 'duration[from]' => 
180_000, 'duration[to]' => 360_000, 'created_at[from]' => 
3.days.ago.strftime('%Y-%m-%d %I:%M:%S'), q: 'something', tags: ['House', 'Techno'])`

It doesn't return error or anything, it's just the tracks returned are not picking up the filtering parameters it seems. Does anyone else experienced the same issue with / without the gem?

Upvotes: 3

Views: 107

Answers (1)

lacostenycoder
lacostenycoder

Reputation: 11226

Well looking at api docs https://developers.soundcloud.com/docs/api/reference#tracks

tags list a comma separated list of tags

Not sure but perhaps try a string param instead of array as docs say

client.get('/tracks', limit: 200, order: 'created_at', 
            'duration[from]' => 180_000, 'duration[to]' => 360_000, 
            'created_at[from]' => 3.days.ago.strftime('%Y-%m-%d %I:%M:%S'),
             q: 'something', tags: 'house,techno'
           )

If your tags have spaces in them use + instead of space i.e.

tags: 'house,techo,deep+house'

downcase the tags because soundcloud does anyway, for example you can type in your browser https://soundcloud.com/search/?q=lacostenyc&tags=house,techno

Upvotes: 2

Related Questions