Author Topic: Downloading BBC iPlayer using RTMPdump  (Read 14765 times)

0 Members and 1 Guest are viewing this topic.

Offline lifeonmarsfan

  • Hero Member
  • *****
  • Posts: 1,145
    • View Profile
Re: Downloading BBC iPlayer using RTMPdump
« Reply #15 on: August 04, 2011, 01:19:04 AM »
The first thing I downloaded with RD this afternoon is the Proms program. I suspect it\'s the entire show rather than just 50 minutes. The BBC lists the programs as 2 50 minute episodes, but this is probably both episodes like they did with Doctor Who last year.

Offline Janaru

  • Administrator
  • Hero Member
  • *****
  • Posts: 18,371
    • View Profile
Re: Downloading BBC iPlayer using RTMPdump
« Reply #16 on: August 04, 2011, 03:10:55 AM »
Mine seems to be moving a little better at the moment, thank goodness. Glad you got something at least, Mars. :)
Note to self:  Use your powers for good, not for evil.....

Offline lifeonmarsfan

  • Hero Member
  • *****
  • Posts: 1,145
    • View Profile
Re: Downloading BBC iPlayer using RTMPdump
« Reply #17 on: August 04, 2011, 03:38:39 AM »
I hadn\'t quite got to the DTs stage of withdrawal yet, but I wanted to have a complete set of Cabin Pressure at the very least.

The Proms download started at 2:30 and it\'s still going at 7:34 so I don\'t know if the traffic is just slow or if this is more than two hours of music.

I looked ahead on what\'s coming up on the Proms and they have an interesting program on the music of Spaghetti Westerns. I don\'t think it will be the usual orchestral set up nor will it be like the major Sondheim or Rodgers and Hammerstein Proms from last year.

Offline PAW

  • Hero Member
  • *****
  • Posts: 1,338
    • View Profile
Re: Downloading BBC iPlayer using RTMPdump
« Reply #18 on: August 04, 2011, 04:05:03 PM »
If the Proms you\'re talking about are the Horrible Histories, then the files are:

part 1 - 2 hours 30 & 137mb, it has the first part of the prom (just over an hour), then the Twenty Minutes programme in the interval, then the second part of the prom (just over an hour), and about 15 minutes of the next programme.

part 2 is 1 hour 35 & 87mb, it has the last 10 minutes of Twenty Minutes, then part two of the prom, then about 30 minutes of the next programme.

So don\'t bother getting the second file.

Offline lifeonmarsfan

  • Hero Member
  • *****
  • Posts: 1,145
    • View Profile
Re: Downloading BBC iPlayer using RTMPdump
« Reply #19 on: August 04, 2011, 06:03:38 PM »
That\'s what I thought. Thanks Paul.

Offline lifeonmarsfan

  • Hero Member
  • *****
  • Posts: 1,145
    • View Profile
Re: Downloading BBC iPlayer using RTMPdump
« Reply #20 on: August 04, 2011, 08:22:06 PM »
Janaru Wrote:
-------------------------------------------------------
> I\'ve had some difficult today as well. For awhile
> there I couldn\'t connect to any BBC streams and
> the websites were pretty iffy too. It seems better
> now, though a bit slower than usual. Even the
> Phorum is loading slower today.
>
> (By the by, Mars, my TRP has a setting that takes
> care of the gaps automatically, so I don\'t even
> know they existed. Love that feature. )

I think we can safely say the slow down is due to the time of day. It\'s lunch time here on the left coast and coffee break time on the east coast. Today is slow as well. But all that has probably to do with the free fall Wall Street is taking today. People are checking to see if there\'s anything left of their investments.

Offline Janaru

  • Administrator
  • Hero Member
  • *****
  • Posts: 18,371
    • View Profile
Re: Downloading BBC iPlayer using RTMPdump
« Reply #21 on: August 04, 2011, 10:43:09 PM »
Very likely, Mars.
Note to self:  Use your powers for good, not for evil.....

Offline Ed

  • Full Member
  • ***
  • Posts: 122
    • View Profile
Re: Downloading BBC iPlayer using RTMPdump
« Reply #22 on: August 09, 2011, 09:17:38 AM »
lifeonmarsfan Wrote:
-------------------------------------------------------
> Can someone please walk me through the process of
> how to do this? I am not sure where to start. I
> have installed RTMPdump, now what?


BBC iPlayer for Radio - Revised RTMPDump batch file

First, get the URL of the page that plays the radio show you want, from this page -

 http://www.bbc.co.uk/radio4extra/programmes/schedules


Second, open the Playlist page with the following command (replace the 8 zero\'s with the 8 digit ID number from the URL of the page that plays the radio show):-

 http://www.bbc.co.uk/iplayer/playlist/00000000


Third, open the Media Selector page with the following command (replace the 8 zero\'s with the 8 digit Identifier from the Playlist page):-

 http://www.bbc.co.uk/mediaselector/4/mtis/stream/00000000

Note - This is the Media Selector page, which contains all the information needed below.


The on-demand stream: AAC in MP4A in FLV

In the Media Selector page, find the section marked bitrate=\"128\" and encoding=\"aac\". All the details needed below come from that section.

1. Write a batch file using Notepad.exe (i.e. copy and paste the blue text below into an empty text file, save it using Notepad, then rename the file 4EXTRA.BAT).

Note - The file must be named 4EXTRA.BAT not 4EXTRA.BAT.TXT

Note - Batch files are explained at http://www.computerhope.com/batch.htm

2. Complete the settings et= and fmta-token= and identifier= and mp= with the settings in the Media Selector page.

Note - The text in the rest of the batch file always remains the same. Only these four settings need altering. Don\'t change anything else.

3. Put the batch file in the same folder/directory as RTMPDUMP.EXE v2.1d

4. Double-click the batch file, with a live internet connection open.

Note - It will stream at the maximum speed for your connection. If you use dial-up, you might need to resume the download if it stops. Just add --resume to the end of the command, after -o output.flv


:: Settings which do NOT change -
SET server=bbcodspdns.fcod.llnwd.net
SET application=a5999/e1
SET as=adobe-hmac-sha256
SET av=1
SET te=connect

:: Settings from Media Selector page -
SET et=
SET fmta-token=
SET identifier=
SET mp=

rtmpdump -r \"rtmp://bbcodspdns.fcod.llnwd.net:1935/a5999/e1?as=adobe-hmac-sha256&av=1&te=connect&mp=%mp%&et=%et%&fmta-token=%fmta-token%\" -a \"a5999/e1?as=adobe-hmac-sha256&av=1&te=connect&mp=%mp%&et=%et%&fmta-token=%fmta-token%\" -y \"%identifier%\" -o output.flv



To resume an interrupted download, add the option --resume to the command.


Example

This is an example of the contents of a .BAT batch file.

The GREEN text has been added from the Media Selector page, obtained above (from the section of the Media Selector page marked bitrate=\"128\" and encoding=\"aac\").

Use a copy-and-paste operation to copy text from the Media Selector page into your .BAT batch file.


:: Settings which do NOT change -
SET server=bbcodspdns.fcod.llnwd.net
SET application=a5999/e1
SET as=adobe-hmac-sha256
SET av=1
SET te=connect


:: Settings from Media Selector page -

SET mp=radio4extra/secure_auth/modem/RBN2_radio_4_extra_-_monday_ 0230_b0028jz6_2011_07_18_03_51_39.mp4, radio4extra/secure_auth/ RBN2_radio_4_extra_-_monday_0230_b0028jz6_2011_07_18_03_45_17.mp4

SET et=1310975824

SET fmta-token=ad86f56eb16052f9214234a3fbfbfa0c2e09e0ffcfa33fc7a122d3814012b9c1

SET identifier=mp4:radio4extra/secure_auth/RBN2_radio_4_extra_-_monday_0230_b0028jz6_2011_07_18_03_45_17.mp4


rtmpdump -r \"rtmp://bbcodspdns.fcod.llnwd.net:1935/a5999/e1?as=adobe-hmac-sha256&av=1&te=connect&mp=%mp%&et=%et%&fmta-token=%fmta-token%\" -a \"a5999/e1?as=adobe-hmac-sha256&av=1&te=connect&mp=%mp%&et=%et%&fmta-token=%fmta-token%\" -y \"%identifier%\" -o output.flv





Other Solutions

RTMPDump v2.2d solutions -
http://stream-recorder.com/forum/rtmpdump-v2-2d-command-exit-code-1-t6663.html

RTMPE streams and RTMPDump v2.4 -
http://stream-recorder.com/forum/showthread.php?p=31422#post31422

RTMPDump general solutions -
http://streemeboxvcr.yuku.com/topic/2238

Solutions involving Get_iPlayer / RTMPDump / MP3 streams / WMA streams -
http://myweb.tiscali.co.uk/bridip/clitheroe/iplayer.htm

Offline lifeonmarsfan

  • Hero Member
  • *****
  • Posts: 1,145
    • View Profile
Re: Downloading BBC iPlayer using RTMPdump
« Reply #23 on: August 09, 2011, 06:46:44 PM »
Thanks Ed, this is a gift. Your help is much appreciated.

Offline Ed

  • Full Member
  • ***
  • Posts: 122
    • View Profile
Re: Downloading BBC iPlayer using RTMPdump
« Reply #24 on: August 19, 2011, 10:44:56 AM »
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.



Run #1 - Preliminary Matters + Start RTMPSRV.bat

Code: [Select]
@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:\prorgam files (x86)\rtmpdump\rtmpsrv.exe" > RTMPdump_run.bat


:END
cls




Run #3 - Run RTMPdump_run.bat

Code: [Select]
@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\%username%\AppData\Roaming\Microsoft\Windows\Cookies\*@bbc.*[*].txt
DEL C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Cookies\*@bbc.co[*].txt
DEL C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Cookies\*@www.bbc.co[*].txt
DEL C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Cookies\*@cookie.radioplayer.co[*].txt
DEL C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Cookies\*@static.radioplayer.co[*].txt

:: ================================================================= ::

cls




Run #4 - Rename FLV file.bat

Code: [Select]
@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"
)
« Last Edit: June 18, 2017, 05:50:14 PM by Ed »

Offline Ed

  • Full Member
  • ***
  • Posts: 122
    • View Profile
Manual Downloader
« Reply #25 on: January 07, 2012, 11:56:17 AM »
Now here is a .BAT (batch) file for downloading an RTMP stream (i.e. a radio show) from the radio iplayer.

The details to be inserted in the sections mp= and et= and fmta-token= and identifier= are obtained from the mediaselector page for the radio show in question (in the section marked bitrate="128" encoding="aac").

The url address of the media selector page looks like this (except that the 8 zero's are replaced with an ID code unique to each radio show) -

  http://www.bbc.co.uk/mediaselector/4/mtis/stream/00000000


For all Radio 4 Extra shows broadcast in the last seven days, the complete media selector url can be found at -

  http://www.bbc.co.uk/radio/aod/availability/radio4extra.xml

That is a master index of all currently available 'listen again' shows for the Radio 4 Extra station.



Note : This post takes into account all changes made to BBC iPlayer in 2011.




Download.bat

Code: [Select]
::  *** Always different ***
SET mp=
SET et=
SET fmta-token=
SET identifier=

::  *** Always the same ***
SET server=bbcodspdns.fcod.llnwd.net
SET application=a5999/e1
SET as=adobe-hmac-sha256
SET av=1
SET te=connect

::  *** RTMPDump location ***
SET rtmpdump="C:\Program Files\rtmpdump\rtmpdump.exe"

::  *** Command : Radio 4 Extra ***
%rtmpdump% --protocol 0 --host "%server%" -a "%application%?as=%as%&av=%av%&te=%te%&mp=%mp%&et=%et%&fmta-token=%fmta-token%" -y "%identifier%" -o "%identifier%"



Example

Here is an example of what the 128 kbps aac stream details, in the media selector page, look like. I have highlighted in bold the key parts -

Quote
<media bitrate="128" encoding="aac" expires="2012-01-14T01:02:00+00:00" kind="audio" service="iplayer_uk_stream_aac_rtmp_concrete" type="audio/mp4">
<connection application="a5999/e1" authExpires="2012-01-07T13:45:03+00:00" authString="as=adobe-hmac-sha256&av=1&te=connect&mp=radio4extra/secure_auth/RBN2_radio_4_extra_-_saturday_0030_b0027xx1_2012_01_07_01_32_09.mp4,radio4extra/secure_auth/modem/RBN2_radio_4_extra_-_saturday_0030_b0027xx1_2012_01_07_01_34_02.mp4&et=1325945232&fmta-token=c871135ef1b90cb394894c3ef8b3ea2580ea4f711cc956547cda16deafd5af98" identifier="mp4:radio4extra/secure_auth/RBN2_radio_4_extra_-_saturday_0030_b0027xx1_2012_01_07_01_32_09.mp4" kind="limelight" priority="9" protocol="rtmp" server="bbcodspdns.fcod.llnwd.net" supplier="limelight" />
</media>
« Last Edit: June 18, 2017, 05:53:44 PM by Ed »

Offline Janaru

  • Administrator
  • Hero Member
  • *****
  • Posts: 18,371
    • View Profile
Re: Manual Downloader
« Reply #26 on: January 07, 2012, 10:31:34 PM »
Thanks for that, Ed. :)
Note to self:  Use your powers for good, not for evil.....

Offline Ed

  • Full Member
  • ***
  • Posts: 122
    • View Profile
Parsing a BBC MediaSelector XML page with Javascript
« Reply #27 on: February 17, 2012, 09:03:07 PM »
I have now developed a method for downloading an iPlayer radio file using the MediaSelector url (e.g. obtained from http://www.bbc.co.uk/radio/aod/availability/radio4extra.xml ).

I will post the code, merely a standard HTM file actually, at the foot of this page.

Offline Ed

  • Full Member
  • ***
  • Posts: 122
    • View Profile
Parsing a BBC MediaSelector XML page with Javascript
« Reply #28 on: February 17, 2012, 09:09:47 PM »
This is a method for downloading an iPlayer file using a MediaSelector url (e.g. obtained from http://www.bbc.co.uk/radio/aod/availability/radio4extra.xml ).

The code, below, is the content for the file Download.htm (a file which runs Javascript).

Create an empty text file using NOTEPAD.EXE and copy-and-paste the HTML code below into it. This type of Javascript requires Internet Explorer. Run the .HTM file from your hard disk, in Internet Explorer; it won't run if you upload it to the internet.

To run it successfully, the user need only change the MediaSelector url highlighted in red (i.e. substitute the MediaSelector url of the iPlayer radio show you want to download).

The .HTM file creates a .BAT (batch) file on your Desktop. Put RTMPDUMP.EXE in the directory C:\Program Files\rtmpdump in order to run this .BAT file.

It downloads a media file with the extension .mp4 so you must alter that file's extension from .mp4 to .flv (and play it in GOM Player, or in Winamp 5.60 or later). The media file is an AAC file at 128 kbps (the highest quality used by the radio iPlayer). MP4 Audio using AAC at 128 kbps is what is commonly termed an iTunes format file.


Code: [Select]
<html>
<head>
<title>Parse XML File</title>

<!-- Downloading from a BBC iPlayer page -->
<!-- This parses the elements in a MediaSelector xml page -->


<SCRIPT>

// Target XML file's URL address [MediaSelector URL]
var url = "http://www.bbc.co.uk/mediaselector/4/mtis/stream/b01by95r" ;


var xmlDoc;

window.open('','_self');

function loadxml()
{
   xmlDoc = new ActiveXObject( "Microsoft.XMLDOM" );
   xmlDoc.async = false;
   xmlDoc.onreadystatechange = readXML;
   xmlDoc.load(url);
}


function readXML()
{
   if(xmlDoc.readyState == 4) {
   // This function is called on statechange
   // When the state reaches 4 this function reads the xml document


   // Create a Text File

   var fso = new ActiveXObject( "Scripting.FileSystemObject" );
   var fh = fso.CreateTextFile( "MediaSelector.bat", true );

   for(i=0; i<xmlDoc.getElementsByTagName( "media" ).length; i++) {

   bitrate  = xmlDoc.getElementsByTagName( "media" )[i].attributes.getNamedItem( "bitrate" ).nodeValue  ;
   encoding = xmlDoc.getElementsByTagName( "media" )[i].attributes.getNamedItem( "encoding" ).nodeValue ;

      if ( bitrate==128 && encoding=="aac" ){

      fh.WriteLine( ':: Media tag #' + [i] );
      fh.WriteLine( '' );
      fh.WriteLine( 'SET rtmpdump=C:\Program Files\rtmpdump\rtmpdump.exe' );
      fh.WriteLine( '' );
      fh.WriteLine( 'SET server=' +
         xmlDoc.getElementsByTagName( "media" )[i].firstChild.attributes.getNamedItem( "server" ).nodeValue );
      fh.WriteLine( '' );
      fh.WriteLine( 'SET application=' +
         xmlDoc.getElementsByTagName( "media" )[i].firstChild.attributes.getNamedItem( "application" ).nodeValue );
      fh.WriteLine( '' );
      fh.WriteLine( 'SET identifier=' +
         xmlDoc.getElementsByTagName( "media" )[i].firstChild.attributes.getNamedItem( "identifier" ).nodeValue );
      fh.WriteLine( '' );
      var str1=xmlDoc.getElementsByTagName( "media" )[i].firstChild.attributes.getNamedItem( "authString" ).nodeValue ;
      fh.WriteLine( 'SET authString=' + str1.replace( /&/g,"^&" ) );
      fh.WriteLine( '' );
      var str2=xmlDoc.getElementsByTagName( "media" )[i].firstChild.attributes.getNamedItem( "identifier" ).nodeValue ;
      fh.WriteLine( '"%rtmpdump%" --protocol 0 --host "%server%" -a "%application%?%authString%" ' +
                    '-y "%identifier%" -o ' + str2.slice(28,999) );
      fh.WriteLine( '' );
      fh.WriteLine( 'pause' );

      }
   }

   fh.Close() ;

   }
}

</SCRIPT>

</head>
<body onload="loadxml();window.close()"> </body>
</html>
« Last Edit: June 18, 2017, 05:39:56 PM by Ed »

Offline Janaru

  • Administrator
  • Hero Member
  • *****
  • Posts: 18,371
    • View Profile
Re: Parsing a BBC MediaSelector XML page with Javascript
« Reply #29 on: February 18, 2012, 05:57:01 PM »
I don\'t understand the details, Ed, but the result sounds pretty nifty! Thanks for putting it up :)-D
Note to self:  Use your powers for good, not for evil.....