Miskatonic University Press

Finding the RSS feed for a Soundcloud account

code music podcasts

SoundCloud has lots of great stuff on it, but I prefer not to use their app for listening to podcasts, so I like to use the RSS feed. However, SoundCloud hide it because they want you to use their app or site. This little shell script will find it for you. I call it soundcloud2rss.sh:

#!/bin/sh

SOUNDCLOUD=$1

# There's a Javascript function in the SoundCloud URL that has
# information like this:
# "urn":"soundcloud:users:149281773","username":"patzr radio",
# We need to pick out that number.

NUMBER=`curl --silent "$SOUNDCLOUD" | grep "soundcloud:users" | sed 's/.*"soundcloud:users://' | sed 's/".*//'`

RSS="https://feeds.soundcloud.com/users/soundcloud:users:${NUMBER}/sounds.rss"
echo $RSS

Use it like so, after putting the script in ~/bin/ and running chmod 700 ~/bin/soundcloud2rss.sh to make it executable:

$ ~/bin/soundcloud2rss.sh https://soundcloud.com/cultural-anthropology
https://feeds.soundcloud.com/users/soundcloud:users:43958371/sounds.rss

This assumes you’re running some kind of Unix-like system. There are other ways you could pick the URL out of the one line of HTML, but I like sed’s simplicity.