Downloading SoundCloud Playlists

[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.

23 thoughts on “Downloading SoundCloud Playlists”

  1. 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?

  2. 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.

  3. 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.

    1. 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.

  4. 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!!!
    ๐Ÿ™‚

    1. 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 ๐Ÿ™‚

  5. 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

    1. 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.

  6. 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””;

    1. 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?

    2. 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.

  7. this really drove me crazy ๐Ÿ˜€
    been trying this on ubuntu and nothin.. just creates the playlist file , which is worthless without songs ๐Ÿ˜€

    1. 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 ๐Ÿ˜› )

    1. Hi Max,

      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.

    1. 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 ๐Ÿ™‚

Leave a Reply

Your email address will not be published. Required fields are marked *