8

I've inherited a database of Soundcloud IDs and would like to build a page linking to each track on Soundcloud. Is it possible to link to a track on the Soundcloud website using only its ID e.g.

http://www.soundcloud.com/tracks/{trackId}

The website seems to use the format:

http://www.soundcloud.com/{user}/{trackname}

but I don't have either of those.

Paul Carvill
  • 183
  • 1
  • 2
  • 7

3 Answers3

9

You can scrape it from the "widget" URL

https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/{trackId}

contains a link element

<link rel="canonical" href="{canonicalURI}">
Mohammad
  • 21,175
  • 15
  • 55
  • 84
Alan Trewartha
  • 131
  • 1
  • 4
0

It seems that the way to do this is to use the API. With a track number, you can call

http://api.soundcloud.com/tracks/12345678.json?client_id=YOUR_CLIENT_ID

This returns a JSON object with a permalink_url property which gives you the full url including the user and track name.

See the API tracks documentation for more details.

harriyott
  • 10,505
  • 10
  • 64
  • 103
0

First you will need to register an app at https://soundcloud.com/you/apps.

Then use the API to return a JSON object of the track using the track ID and your client ID.

e.g. (using jQuery) …

$.ajax({ url: "http://api.soundcloud.com/playlists/405726.json?client_id=XXXX", type: 'GET', success: function (data) { console.log(data); } });

Where XXX is your Client ID.

cdcdcd
  • 1,612
  • 13
  • 18
  • 4
    Unfortunately, SoundCloud closed registration to their API around July 2017. This method is only valid for those who registered before then. – Illya Moskvin Jun 13 '18 at 23:51