Get HTTP MP3 stream from every song Get HTTP MP3 stream from every song json json

Get HTTP MP3 stream from every song


I think this specifically has to do with the type of client_id you pass into the API request.

HTTP GET: http://api.soundcloud.com/i1/tracks/167132129/streams?client_id=[CLIENT_ID]

Using a standard application client_id, I don't see the http link:

Response:

{  "hls_mp3_128_url": "https://ec-hls-media.soundcloud.com/playlist/KZ5qiLqZ0OSk.128.mp3/playlist.m3u8?f10880d39085a94a0418a7e062b03d52bbdc0e179b82bde1d76ce7a51e4e690d4aa9adbb8e264aa259bfba6e1a3d52e8f8020eeb45fac9d9fbb175e4c35dbd26bdf59ac00d0f2cd80b7e7a685e9cd57c89622a7cc8b7266f4b7317b4",  "rtmp_mp3_128_url": "rtmp://ec-rtmp-media.soundcloud.com/mp3:KZ5qiLqZ0OSk.128?9527d18f1063a01f059bf10590159adb10dea0996b8c0cdb674f9c282214839d8263f0608a1a3bbe02e4a0ffc5cf5bef80087ca63aa316e338f6cbba24b1493d8355aea84dc2e529757f72273e1fdfc9f88437c992e92845b3e3",  "preview_mp3_128_url": "https://ec-preview-media.sndcdn.com/preview/0/90/KZ5qiLqZ0OSk.128.mp3?f10880d39085a94a0418a7e162b03d52e21adf826af17a391e1b741835259dfd645b4f9f979acc1e4d50dd281c2b93dca58d9e3bd086be0aed9c5ae0ae369364f50bd63ee4f1b167cc29b19cf3462f735b8f"}

However, using the youtube-dl iPhone client_id, the http url is returned:

Response:

{    "http_mp3_128_url": "https://ec-media.sndcdn.com/KZ5qiLqZ0OSk.128.mp3?f10880d39085a94a0418a7ef69b03d522cd6dfee9399eeb9a522029c69f0bd356988380857d739f55360e9ce802160a1ecf506cfa53f249070d96b19de5ac3234cdbd4201d",    "hls_mp3_128_url": "https://ec-hls-media.soundcloud.com/playlist/KZ5qiLqZ0OSk.128.mp3/playlist.m3u8?f10880d39085a94a0418a7e062b03d52bbdc0e179b82bde1d76ce7a51e4e6e074a18d603fc2146725c4f70a8844d81268632e8339ce8b52aab8fcfbfd450330b409e8614da1996b8e4cd371f07c9eb0d5cc65ffbf60230336388b323",    "rtmp_mp3_128_url": "rtmp://ec-rtmp-media.soundcloud.com/mp3:KZ5qiLqZ0OSk.128?9527d18f1063a01f059bf10590159adb10dea0996b8c0cdb674f9c28221b8a972788cc587dee254b285c2a0c9e5b57a79b4bd174401f92b31df0cf4260d9f3f6fe542e181d30b4e9314ac36e70737095ddb2b215bd98884660cb",    "preview_mp3_128_url": "https://ec-preview-media.sndcdn.com/preview/0/90/KZ5qiLqZ0OSk.128.mp3?f10880d39085a94a0418a7e162b03d52e21adf826af17a391e1b7418352a94f7cbd4ec4b06d76ae6caf6f3cc29aed3f7b0922885d994c71a503c307cf86b653b3f6108990bebaae5a15efc74075285b13f23"}

More information can be found in this commit and this issue on the youtube-dl page. I don't know exactly what the difference is between a regular client_id and an iPhone client_id, but I can clearly see the difference in what is returned by the API request. It would appear that the iPhone client_id is the API key used by the SoundCloud iOS client to stream tracks in the app.


soundcloud re-encodes all uploads to 128k mp3 for streaming playback. as long as you have streaming enabled and the track is public, all you should need is

https://api.soundcloud.com/tracks/TRACKID/stream?client_id=CLIENTID