Skip to content

Instantly share code, notes, and snippets.

@RobertAudi
Created October 3, 2013 17:09
Show Gist options
  • Save RobertAudi/6813340 to your computer and use it in GitHub Desktop.
Save RobertAudi/6813340 to your computer and use it in GitHub Desktop.
Function to get the track URL for a SoundCloud track and copy it to the clipboard on OS X. Requires `jq` (`brew install jq`)
scurl() {
curl "http://api.soundcloud.com/resolve.json?url=$1&client_id=[SOUNDCLOUD_API_CLIENT_ID]" 2> /dev/null | jq '.location' | awk -F '\?' '{print $1}' | sed 's/\.json$//' | sed 's/^"//' | tr -d '\n' | pbcopy
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment