An Example of URL Reverse Engineering

Or, What I Didn't Know About SoundCloud Feeds

Slowly going up Rrose’s back catalog since her last appearance in Munich, I end up on her 2012 set for the Resident Advisor Podcast.

The version on Mixcloud is a shy 69k mp4, while SoundCloud only streams the dreaded 128k mp3.

Resident Advisor · RA.318 Rrose

I know Resident Advisor brodcasts 320k versions on their feed. I look for the <enclosure .../> tag of episode 318:

~$ curl "https://ra.co/xml/podcast.xml" | xq | less -R

Unfortunately, I notice that the feed only keeps the last 400 episodes, and definitely does not include what I am looking for. I also notice that they use chrt.fm to resolve mp3 files. For example, last episode’s file is referenced via:

<enclosure type="audio/mpeg" url="https://chrt.fm/track/C54868/http://feeds.soundcloud.com/stream/1455221263-resident-advisor-ra873-solid-blake.mp3" length="171982635"/>

The URL structure is consistent across entries:

https://chrt.fm/track/C54868/http://feeds.soundcloud.com/stream/<id>-resident-advisor-ra<number>-<artist>.mp3

I seem to have all the information except the SoundCloud track id. One could dig in the page source and find the api uri. I use yt-dlp1 instead:

~$ yt-dlp -F "https://soundcloud.com/resident-advisor/ra318-rrose"
[soundcloud] Extracting URL: https://soundcloud.com/resident-advisor/ra318-rrose
[soundcloud] resident-advisor/ra318-rrose: Downloading info JSON
[soundcloud] 236925033: Downloading JSON metadata

The id is 236925033. We’ll need to follow a couple of redirects and save the output to a file with curl:

~$ curl -L "https://chrt.fm/track/C54868/http://feeds.soundcloud.com/stream/236925033-resident-advisor-ra318-rrose.mp3" --output RA.318-Rrose.mp3

There you are:

exiftool RA.318-Rrose.mp3
ExifTool Version Number         : 12.50
File Name                       : RA.318-Rrose.mp3
Directory                       : .
File Size                       : 138 MB
File Modification Date/Time     : 2023:03:06 19:33:31+01:00
File Access Date/Time           : 2023:03:06 19:33:09+01:00
File Inode Change Date/Time     : 2023:03:06 19:33:31+01:00
File Permissions                : -rw-r--r--
File Type                       : MP3
File Type Extension             : mp3
MIME Type                       : audio/mpeg
MPEG Audio Version              : 1
Audio Layer                     : 3
Audio Bitrate                   : 320 kbps
Sample Rate                     : 44100
Channel Mode                    : Joint Stereo
MS Stereo                       : Off
Intensity Stereo                : Off
Copyright Flag                  : False
Original Media                  : False
Emphasis                        : None
ID3 Size                        : 387427
Encoder Settings                : Logic Pro 9.1.7
Date                            : 2607
Time                            : 1825
Year                            : 2012
Title                           : RA.318 Rrose - 2012.07.02 [320k]
Album                           : Resident Advisor podcast
Artist                          : Rrose
Initial Key                     : C
User Defined URL                : (URL) http://rrose.ro http://eaux.ro
Comment                         : Find out more about RA.318 with Rrose on Resident Advisor: www.residentadvisor.net/podcast-episode.aspx?id=318
Picture Format                  : JPG
Picture Type                    : Other
Picture Description             :
Picture                         : (Binary data 376602 bytes, use -b option to extract)
Genre                           : Techno
Date/Time Original              : 2012:26:07 18:25
Duration                        : 0:57:19 (approx)

Categories:  #web  #music