spice
spice

Reputation: 1512

Soundcloud content retrieval without a client ID. Is it at all possible?

Soundcloud have locked off their API and nobody is able to request a new Client ID. Before they closed it off they were simply ignoring API key requests for months. They obviously have their reasons but it's been this way for ages now and it's really annoying.

Does anybody know any cheeky workarounds to retrieve track data from a supplied username?

I've tried parsing the dom and scraping it but it doesn't work as they return "no javascript" errors when scraping which renders the homepage and not the user page.

Example :

$url = "https://soundcloud.com/username/tracks";
$dom = new Dom;
$dom->loadFromUrl($url);

$dom = $dom->find('title',0)->text;

Should return :

username | Free Listening on SoundCloud

But instead we get :

SoundCloud - Hear the world’s sounds

Upvotes: 2

Views: 2881

Answers (1)

JAL
JAL

Reputation: 42449

My suggestion would be to use an existing public API key, for example, the CLIENT_ID youtube-dl uses to download SoundCloud tracks.

You'll first need to get the id from the username. We'll use the /resolve endpoint for this:

HTTP GET: http://api.soundcloud.com/resolve?url=http://soundcloud.com/{username}&client_id={CLIENT_ID}

Then, get the user's tracks from the /users/{id}/tracks endpoint:

HTTP GET: https://api.soundcloud.com//users/{id}/tracks

Upvotes: 2

Related Questions