These are the three batch files I use for downloading 'Listen Again' radio shows from the BBC iPlayer, for station
Radio 4 Extra (formerly Radio 7), using
RTMPdump.exe and RTMPsrv.exe v2.1d :
Note : The only edit needed each time is in line 2 of the first file, replacing the 8 zero's with the 8 digit PID - Programme ID - from the URL address of the iPlayer page that plays the radio show you want.
Note : I set up these files on a test laptop that was running Windows 7. The HOSTS directory address on your computer may be different in earlier versions of Windows.
Note : I am including an attachment containing all three of these batch files, plus some other files that I find useful. You'll just need to extract the .zip file to an empty directory and add your preferred version of RTMPDump.exe and RTMPsrv.exe (use v2.1d or later).
Run #1 - Preliminary Matters + Start RTMPSRV.bat
Code:
@echo off
SET PID=00000000
:: ======================================================== ::
cls
SET open="C:\Program Files (x86)\Internet Explorer\IEXPLORE.EXE"
:: Open the Playlist page (to obtain Identifier) -
%open% http://www.bbc.co.uk/iplayer/playlist/%PID%
:: Create a URL for the MediaSelector page (to inject Identifier in) -
echo @echo off>> MediaSelector.bat
echo. >> MediaSelector.bat
echo "C:\Program Files (x86)\Internet Explorer\IEXPLORE.EXE" http://www.bbc.co.uk/mediaselector/4/mtis/stream/00000000>> MediaSelector.bat
echo. >> MediaSelector.bat
echo cls>> MediaSelector.bat
C:\WINDOWS\NOTEPAD.EXE MediaSelector.bat
:: ======================================================== ::
rem *** Create "Run #2" Link ***
IF EXIST Run#2*.PIF DEL Run#2*.PIF
IF EXIST "Run #2.url" DEL "Run #2.url"
IF EXIST "Run #2 - Play iPlayer.url" DEL "Run #2 - Play iPlayer.url"
echo @ECHO OFF>> "Run #2.bat"
echo "C:\Program Files (x86)\Internet Explorer\iexplore.exe" "http://www.bbc.co.uk/iplayer/console/%PID%">> "Run #2.bat"
echo CLS>> "Run #2.bat"
:: ================================================================= ::
rem *** Create "Photos" Links ***
echo @ECHO OFF>> Photos.bat
echo.>> Photos.bat
echo SET open="C:\Program Files (x86)\Internet Explorer\iexplore.exe">> Photos.bat
echo SET url=http://node2.bbcimg.co.uk/iplayer/images/episode>> Photos.bat
echo.>> Photos.bat
echo %%open%% %%url%%/%PID%_150_84.jpg>> Photos.bat
echo %%open%% %%url%%/%PID%_178_100.jpg>> Photos.bat
echo %%open%% %%url%%/%PID%_261_147.jpg>> Photos.bat
echo %%open%% %%url%%/%PID%_303_170.jpg>> Photos.bat
echo %%open%% %%url%%/%PID%_512_288.jpg>> Photos.bat
echo %%open%% %%url%%/%PID%_528_297.jpg>> Photos.bat
echo %%open%% %%url%%/%PID%_640_360.jpg>> Photos.bat
echo.>> Photos.bat
echo CLS>> Photos.bat
echo.>> Photos.bat
echo.>> Photos.bat
:: ================================================================= ::
rem *** Edit the HOSTS file ***
IF EXIST C:\WINDOWS\SYSTEM32\DRIVERS\ETC\NOHOSTS REN C:\WINDOWS\SYSTEM32\DRIVERS\ETC\NOHOSTS HOSTS
rem Replace line 1 with this:
rem 127.0.0.1 bbcmedia.fcod.llnwd.net
IF EXIST C:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS_XX ECHO.
IF EXIST C:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS_XX ECHO HOSTS_XX already exists: Aborting!
IF EXIST C:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS_XX PAUSE
IF EXIST C:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS_XX GOTO END
C:\WINDOWS\SYSTEM32\ATTRIB.EXE -R -S -H C:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS
REN C:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS HOSTS_XX
:: Next line: Setting prior to 1pm on 12 July '10
:: echo 127.0.0.1 bbcmedia.fcod.llnwd.net> C:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS
:: Next line: Setting FROM 1pm on 12 July '10 onwards
echo 127.0.0.1 bbcodspdns.fcod.llnwd.net> C:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS
C:\WINDOWS\SYSTEM32\ATTRIB.EXE +R +H C:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS
cls
:: ================================================================= ::
rem *** Start RTMPSRV ***
:: Start RTMPSRV.EXE and pipe the URLs it displays to a .BAT file
:: to be used with RTMPDUMP to download the iPlayer file
"C:\Users\dg\Desktop\General\iPlayer\- Recording iPlayer\rtmpsrv.exe" > RTMPdump_run.bat
:END
cls
Run #3 - Run RTMPdump_run.bat
Code:
@echo off
rem *** Edit the HOSTS file ***
rem Wait 8 Seconds
echo.
echo Wait 8 Seconds ...
echo.
@CHOICE /T 8 /C yn /D y > NUL
cls
rem Restore the normal line 1:
rem 127.0.0.1 localhost
C:\WINDOWS\SYSTEM32\ATTRIB.EXE -R -S -H C:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS
IF EXIST C:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS_XX DEL C:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS
IF EXIST C:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS_XX REN C:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS_XX HOSTS
C:\WINDOWS\SYSTEM32\ATTRIB.EXE +R +H C:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS
:: ================================================================= ::
rem *** Run RTMPDUMP ***
CALL RTMPdump_run.bat
rem *** Rename the downloaded file ***
:: REN *.MP4 *.flv
rem *** Save the Download command ***
COPY "Notes.txt"+"RTMPdump_run.bat" "Notes_New.txt"
echo. >> "Notes_New.txt"
DEL "Notes.txt"
REN "Notes_New.txt" "Notes.txt"
rem *** Save the SWFINFO file ***
COPY "Notes.txt"+".swfinfo" "Notes_New.txt"
echo. >> "Notes_New.txt"
echo. >> "Notes_New.txt"
DEL "Notes.txt"
REN "Notes_New.txt" "Notes.txt"
rem *** Open MediaSelector page ***
IF EXIST MediaSelector.bat CALL MediaSelector.bat
rem *** Tidy Up ***
IF EXIST *.swfinfo DEL *.swfinfo
IF EXIST RTMPdump_run.bat DEL RTMPdump_run.bat
IF EXIST MediaSelector.bat DEL MediaSelector.bat
IF EXIST Run#2*.PIF DEL Run#2*.PIF
IF EXIST "Run #2.BAT" DEL "Run #2.BAT"
:: ================================================================= ::
:: Delete BBC Cookies
DEL C:\Users\dg\AppData\Roaming\Microsoft\Windows\Cookies\dg@bbc.*[*].txt
DEL C:\Users\dg\AppData\Roaming\Microsoft\Windows\Cookies\dg@bbc.co[*].txt
DEL C:\Users\dg\AppData\Roaming\Microsoft\Windows\Cookies\dg@www.bbc.co[*].txt
DEL C:\Users\dg\AppData\Roaming\Microsoft\Windows\Cookies\dg@cookie.radioplayer.co[*].txt
DEL C:\Users\dg\AppData\Roaming\Microsoft\Windows\Cookies\dg@static.radioplayer.co[*].txt
:: ================================================================= ::
cls
Run #4 - Rename FLV file.bat
Code:
@echo off
rem *** Rename the downloaded file ***
IF EXIST *.MP4 REN *.MP4 *.flv
setlocal enabledelayedexpansion
for %%j in (RBN2_radio_4_*.flv) do (
set filename=%%~nj
set filename=!filename:RBN2_radio_4_-_=!
set filename=!filename:RBN2_radio_4_extra_-_=!
set filename=!filename:monday=Mon!
set filename=!filename:tuesday=Tue!
set filename=!filename:wednesday=Wed!
set filename=!filename:thursday=Thu!
set filename=!filename:friday=Fri!
set filename=!filename:saturday=Sat!
set filename=!filename:sunday=Sun!
set filename=!filename:_b00= [b00!
set filename=!filename:_b01= [b01!
set filename=!filename:_2011_01_=] 2011-01-!
set filename=!filename:_2011_02_=] 2011-02-!
set filename=!filename:_2011_03_=] 2011-03-!
set filename=!filename:_2011_04_=] 2011-04-!
set filename=!filename:_2011_05_=] 2011-05-!
set filename=!filename:_2011_06_=] 2011-06-!
set filename=!filename:_2011_07_=] 2011-07-!
set filename=!filename:_2011_08_=] 2011-08-!
set filename=!filename:_2011_09_=] 2011-09-!
set filename=!filename:_2011_10_=] 2011-10-!
set filename=!filename:_2011_11_=] 2011-11-!
set filename=!filename:_2011_12_=] 2011-12-!
set filename=!filename:~0,-9%!
set filename=!filename:_= !
if not "!filename!"=="%%~nj" ren "%%j" "!filename!%%~xj"
)