I got command line recording working from a batch file using rtmpdump in Windows. Here's how I did it:
I've been wanting to record
Coast To Coast AM since it comes on well after I've gone to sleep but have never been able to do it reliably. Here in Houston it comes on KTRH-AM and is also available via iheartradio, so I created a batch file that contains the following:
REM Download the XML file containing the unique auth code
wget "http://p2.ktrh-am.ccomrcdn.com/player/player_dispatcher.html?section=radio&action=listen _live"
REM delete the existing XML file from the previous recording
del ktrh-am.xml
REM rename the newly-downloaded XML file from above to a usable format
ren "player_dispatcher.html@section=radio&action=liste n_live" ktrh-am.xml
REM Get the unique auth code from the XML file (the dots in the line below are used to get all 68 characters of the unique auth code)
for /f "delims=" %%a in ('sed -n "s/.*\(auth=......................................... ...........................\).*/\1/p" ktrh-am.xml') do @set ccam=%%a
REM Build the URL that will be passed to rtmpdump
set ktrh="rtmp://cp20100.live.edgefcs.net/live/Hou_TX_KTRH-AM_OR@s7890?%ccam%&aifp=1234&CHANNELID=2285&CPROG= _&MARKET=HOUSTON-TX&REQUESTOR=KTRH-AM&SERVER_NAME=p2.ktrh-am.ccomrcdn.com&SITE_ID=700&STATION_ID=KTRH-AM&MNM=1&TYPEOFPLAY=0"
REM Record the audio
rtmpdump.exe -v -r %ktrh% -o d:\recordings\coasttocoastam.flv
I had to use two Unix commands (ported to Windows):
sed and
wget to make everything work correctly. I noticed that each time I refreshed the XML page only the auth code changed. This allowed me to script the process using the batch commands above.
This is by no means perfect but it can be run as a scheduled task and works for what I need.