1
votes
  1. Anyone know how to formulate the search syntax of a track within a playlist (set) of a particular user?
  2. Once I have that, how do I use something like oembed to show the matching tracks?

1 SEARCH SYNTAX

http://developers.soundcloud.com/docs/api/guide#search says:

Resources such as sounds, users, sets and groups can be searched using our API. Most endpoints will accept a q param which you can use to specify a keyword to search for in fields like title, username, description, etc. depending on the resource type.

So exactly how do I get a player for a given user's set, filtered by a search term?

I thought https://soundcloud.com/search/sounds?q=newchoir%20100%20years%20tenor&filter.user=newchoir might work, but it doesn't.

Specifically I am interested in embedding a player on my website (which incidentally uses Atlassian Confluence, but I assume we can ignore that for now.)

The only tracks I want to show belong to this user: https://soundcloud.com/newchoir - I explicitly need to exclude any other user.

I want to be able to search within Sets such as this one: https://soundcloud.com/newchoir/sets/tenor-rehearsal-tracks

So the searches I want are:

  • by week "Week 4"
  • by title "100 Years"

We put week and the song name as text in the title field.


2 oEMBED

http://developers.soundcloud.com/docs/oembed#introduction shows how a Soundcloud URL can be processed to return a structure containing an embeddable player that contains that URL.

http://oembed.com goes on to say that for many types, the structure contains an 'html' element in the JSON/XML that can be then extracted by javascript.

https://github.com/starfishmod/jquery-oembed-all provides a jquery extractor with support for soundcloud.

However, the oEmbed method supports only http://soundcloud.com/ URLs, rather than http://api.soundcloud.com URLs.


So, am I reading it right:

  1. I have to write code? It's not possible to just embed an "iframe src=" in my site?
  2. That I need to use api.soundcloud + client key? It seems overkill
  3. It's not possible to search a particular Soundcloud account for a given named track and show a player that matches these terms?
1

1 Answers

2
votes

Anyone know how to formulate the search syntax of a track within a playlist (set) of a particular user?

I think you will have to do an API request to get user’s sets (http://api.soundcloud.com/users/USER_ID/playlists.json?client_id=YOUR_CLIENT_ID) and then search through the tracks there.

Once I have that, how do I use something like oembed to show the matching tracks?

It actually does work with API URLs: https://soundcloud.com/oembed.json?url=https%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F64492288. But you could save on one HTTP request and make your app speedier, creating the HTML code with an easy replace call on a string (for example, in JavaScript):

var template = '<iframe width="100%" height="" scrolling="no" src="http://w.soundcloud.com/player/?url=API_URL" frameborder="0"></iframe>';
var html = template.replace('API_URL', 'https%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F64492288');

… I need to use api.soundcloud + client key? It seems overkill

It isn't, this is exactly what API is for and it will let you have way more flexibility over what you are doing.