Downloading SoundCloud Playlists
By Iain Cuthbertson
[Update 21st Aug 2013
Post code replaced with a Github GIST.
Please fork and help improve this script 🙂
[Updated 7th Feb 2012
Changes:
- file names are now as they would be if you downloaded via web browser
- Playlist is now in reverse date uploaded order]
I like to have music while I’m coding. It breaks the silence while working alone at home.
When I have music playing, it’s best if I don’t have to think about setting up playlists, which is why I used to listen to the radio. The radio has it’s limits though, not enough Ninja Tune I think.
Speaking of Ninja Tune, I <3 their SolidSteel mixes http://soundcloud.com/ninja-tune/sets/solid-steel-radio-shows/
What I don’t like is having to listen via my web browser and their music player in Flash. A recourse hog and not great if you want their music on a device disconnected from the ’net.
Thankfully, with SoundCloud tracks, you can download any file you wish. The downside to it is that there’s a lot to download. What if you want a whole playlist? A playlist of (currently) 151 tracks for instance?
The script below will download all of the tracks in a set to a directory and create a .m3u
playlist at the same time.
Please excuse the justified text and syntax-highlighting gone wrong. View plain, or copy to clipboard and it’ll be fine.
Comments
matt says: 18th November 2011 at 6:21 pm
this is great. ive been looking for somewhere or something that can help me download soundcloud sets.
can you tell me what to do with the code frame to run it? do i need a certain program to execute? or can i just save as a .bat or something like?
what im asking is what steps do i need to take to run the script and download a playlist?
Iain says: 18th November 2011 at 6:26 pm
Matt: This is a PHP script to be run from the command line (or slightly modified and run from a server in a web browser).
Have a look at http://windows.php.net/ for information about using the language on Windows.
It’s by no means a perfect script as it assumes that all files are MP3s. Will fix this at some point.
myuu says: 6th December 2012 at 2:35 am
Is it possible to make this script ready for other users?
I’d like to give my fans a link in which they can download all of my songs in just one set instead of clicking on download at any track.
Iain says: 2nd January 2013 at 3:10 pm
As I pointed out to matt, this is a script to be run from a Command Line Interface using PHP. By no means is it for general GUI use. Though with the right knowledge, somebody might like to make a GUI interface to do this.
Line 3 can be changed to point at sets of tracks by other artists as required, so it’s not limited to just SolidSteel.
dude says: 30th December 2012 at 8:11 pm
If this works it is totally awsome!
I haven`t seen any other posibillity to do this.
I am sure if you would make an .exe or something else usable for noobs, you would be the internets next superhero!!!
🙂
Iain says: 2nd January 2013 at 3:13 pm
This script was to scratch an itch. I’m a web developer by trade and thus have not had much experience of creating GUI applications.
Somebody else might like to take on the challenge 🙂
dude says: 3rd January 2013 at 11:55 am
thx anyway great script!!
AxelTwin says: 3rd January 2013 at 3:24 am
Hi,
I tried the script today with WAMP but didn’t get anything. it makes WAMP running but the max I got were the folders but nothing inside…
Any advice ?
cheers
Iain says: 3rd January 2013 at 12:01 pm
As it stands, this is a command line script rather than a web app.
You could modify it to work on a web server, but you should ensure that it works from the CLI first.
Note that I use Linux and have no experience of running PHP in Windows.
Also, the script depends upon having access to CURL. Ensure you have it installed for PHP.
MikeonTV says: 29th May 2013 at 10:07 am
Doesn’t seem to be working any more. I’ll take a closer look at the code.
abdelhameed says: 3rd June 2013 at 12:52 am
it only download the playlist file!
circuit_breaker says: 5th July 2013 at 9:33 am
On Linux you must change the $command string to what I pasted below. This enables downloading files with spaces and apostrophes in their names.
$command = “wget “$baseURL$uri” -O “$storage_dir/$outputFilename””;
Iain says: 22nd August 2013 at 11:07 pm
Thanks for the enhancement.
I’ve applied it to the gist.
doom2 says: 1st August 2013 at 4:44 pm
When using the following URLs, the script only gets a few or none of the tracks. Thoughts on how to fix?
https://soundcloud.com/stereogum/sets/stereogum-cruel-summer-2013/
https://soundcloud.com/stereogum/sets/stereogum-monthly-mix-july/
doom2 says: 1st August 2013 at 4:53 pm
So I followed the advice from circuit_breaker and was able to download 3 of 30 for one and 11 of 42 for the other. I had to change it to ‘http’ rather than ‘https’ for it to work. Maybe that’s part of it? Is there a workaround for that?
Iain says: 1st August 2013 at 5:00 pm
Not all files on soundcloud can be downloaded.
This script will only work for those with a download link.
In the 1st URL you pasted: the 1st 3 tracks are not available for download, but the 4th one is. And so on down the list. This is why you’re not getting all of the tracks from a playlist.
abdelhameed says: 21st September 2013 at 10:25 pm
this really drove me crazy 😀
been trying this on ubuntu and nothin.. just creates the playlist file , which is worthless without songs 😀
Iain says: 22nd September 2013 at 10:21 am
That’s a little strange that it’s creating a playlist but not downloading tracks.
Can you pastebinit the output of the script?
Elvira says: 19th July 2014 at 11:00 pm
I had the same problem and it turns out I hadn’t noticed the url I used began with https instead of http, and as mentioned in a comment above, it doesn’t work.
Check your url and try again (7 months later. It’s never too late 😛 )
Max says: 13th January 2014 at 8:34 am
Hi,
I also tried to use your script for another set on Soundcloud which is https://soundcloud.com/katermukke/sets
But it downloads nothing, just creates the *.m3u file. Or should it point directly to a certain set?
What shall I change inside the script in order to download sth.?? Which passages?
Iain says: 13th January 2014 at 9:03 am
Hi Max,
Two of the limitations of this script are:
- you have to specify 1 set at a time.
- it will only download tracks if they are available for download.
Have a look at https://soundcloud.com/ninja-tune/sets/solid-steel-radio-shows/
Hover over each track and you will see a row of icons. The one on the far right, a downward pointing arrow to a horizontal line, is the download link.
If a track does not have this icon, then one cannot download the file without paying for it and manually downloading.
The sets that you have linked to do not offer the free download option.
Remember that I’ve written this script to scratch an itch. So it’s taylored to my own requirements.
That said, if people think that it would be useful to have the script handle multiple sets with one command, then I might alter it to do so.
Tilden says: 22nd July 2014 at 8:44 pm
I have been trying to use this but I have been finding that it only creates the playlist and does not actually download the mp3’s. I have been running it in php desktop https://code.google.com/p/phpdesktop/. I am I doing something wrong?
Iain says: 30th July 2014 at 3:09 pm
Make sure you display errors, it’s possible that you don’t have a dependency installed.
Have a look at the other comments in this post, there are multiple reasons why it’s not working for you.
1st and foremost, check that you can actually download files from the sound cloud playlist yourself 🙂