[Update 21st Aug 2013
Post code replaced with a Github GIST.
Please fork and help improve this script 🙂
[Updated 7th Feb 2012
+ 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.
23 thoughts on “Downloading SoundCloud Playlists”
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?
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.
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.
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.
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!!!
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 🙂
thx anyway great script!!
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 ?
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.
Doesn’t seem to be working any more. I’ll take a closer look at the code.
it only download the playlist file!
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””;
Thanks for the enhancement.
I’ve applied it to the gist.
When using the following URLs, the script only gets a few or none of the tracks. Thoughts on how to fix?
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?
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.
this really drove me crazy 😀
been trying this on ubuntu and nothin.. just creates the playlist file , which is worthless without songs 😀
That’s a little strange that it’s creating a playlist but not downloading tracks.
Can you pastebinit the output of the script?
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 😛 )
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?
Two of the limitations of this script are:
1. you have to specify 1 set at a time.
2. 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.
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?
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 🙂