#!/bin/bash if [ -z "$1" ]; then echo "Usage: `basename $0` [URL]"; echo echo "Example:" echo " `basename $0` http://soundcloud.com/disco-dave"; exit fi page=`wget $1 -q --user-agent='Mozilla/5.0' -O -` pagetotal=`echo "$page" | tr '"' "\n" | grep "tracks?page=" | sort -u | tail -n 1 | cut -d "=" -f 2` echo "[*] Processing ..." x=1 while [ $x -le $((`echo $pagetotal`)) ] do page=`wget $1/tracks?page="${x}" -q --user-agent='Mozilla/5.0' -O -` songs=`echo "${page}" | grep 'streamUrl' | tr '"' "\n" | grep 'http://media.soundcloud.com/stream/'`; titles=`echo "${page}" | grep 'title":"' | tr ',' "\n" | grep 'title' | cut -d '"' -f 4 | sed 's/\// vs /g'` songs2=$songs$'\n'$songs2 titles2=$titles$'\n'$titles2 x=$(( $x + 1 )) done if [ -z "${songs2}" ]; then echo "No song(s) found at this url."; exit; fi songcount=$((`echo "$songs2" | wc -l` - 1)) echo "[*] Found $songcount songs!"; for (( songid=1; songid <= $songcount; songid++ )) do title=`echo "${titles2}" | sed -n "${songid}"p` echo "[*] Downloading "${title}"..." wget -L `echo "${songs2}" | sed -n "${songid}"p` -q --user-agent='Mozilla/5.0' -O "`echo $title`.mp3"; done