Skip to content

Instantly share code, notes, and snippets.

@bijanebrahimi
Created April 7, 2014 17:33
Show Gist options
  • Save bijanebrahimi/10024693 to your computer and use it in GitHub Desktop.
Save bijanebrahimi/10024693 to your computer and use it in GitHub Desktop.
Download SoundCloud Music from terminal
#!/bin/bash
#
# GetSoundcloud
#
# Copyright: 2014 Bijan Ebrahimi <[email protected]>
#
# You may distribute this file under the terms of the GNU General
# Public License as published by the Free Software Foundation; either
# version 3 of the License, or (at your option) any later version.
#
if [ "$#" -lt 1 ]; then
echo "Usage: `basename -s 'sh' $0` SoundCloud_URL [Proxy]"
echo "valid proxies like torify, proxychains and etc."
return 0
fi
url=$1
proxy=$2
name=$(basename -s "" $url)'.mp3'
echo -ne "Trying to get $name ...\r"
content=$($proxy wget "$url" --quiet -O -)
echo -ne "Trying to get the download link ...\r"
download_link=$(echo $content| grep -o -m 1 "http://media.soundcloud.com/stream/[^\"]*")
echo -e "Downloading the $name ...\r"
$proxy wget $download_link -O $name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment