On 09/01/2008, Iain Wallace <[EMAIL PROTECTED]> wrote:
> Confusing how?

I am confused to where a lot of the URLs actually come from.
It would be helpful if someone said where all these many URLs came
from instead of just saying "use this URL".

I haven't read PHP for a *long* time (several years since I last used
it, and even then I was a beginner).

Can you confirm the following steps (based on your PHP code):
1. Obtain PID from page URL (8 digits prior to the file extension).
2. Fetch: http://www.bbc.co.uk/iplayer/page/item/PID_HERE.shtml
3. Scan for pids
4. Fetch: http://www.bbc.co.uk/mediaselector/3/stream/check/iplayer?pid=PID_HERE
and parse XML for tags token, identifier, and server
5. Fetch: http://SERVER_HERE/fcs/ident and parse XML for tag ip
6. Perform RTMP on:
rtmp://IP_HERE:1935/ondemand?_fcs_vhost=SERVER_HERE&auth=TOKEN_HERE&aifp=v001&slist=IDENTIFIER_HERE

1935 is defined by IANA as:
> macromedia-fcs  1935/tcp    Macromedia Flash Communications Server MX
> macromedia-fcs  1935/udp    Macromedia Flash Communications server MX
> From: http://www.iana.org/assignments/port-numbers

Do we have a list of applications and versions known to support RTMP?

> The flash iPlayer itself does most of the logic, which can
> be read easily with any number of freely available flash decompilers.

You mean it is necessary to reverse engineer the binary flash file?
And I thought the BBC said that reverse engineering was almost impossible.


And now a worked example (so I can see if I understand right).
This is on "The vicar of dibley" (it was on the front page and I am that lazy).
URL from address bar:
http://www.bbc.co.uk/iplayer/page/item/b007cjrb.shtml
PID: b007cjrb (anyone think "James Bond" when seeing that ID?)

View Source:
iplayer.host = "www.bbc.co.uk";
iplayer.flash_debug = false;
iplayer.prog = " The Vicar of Dibley";
iplayer.guidance = "";
iplayer.pid = 'b007cjrb';
iplayer.versions = [
  {
    type      : 'Original',
    pid       : 'b006py02',
    download  : [
      { start : new Date(2008, 0, 09, 22, 01, 00),
        end   : new Date(2008, 0, 16, 21, 59, 00)}
    ],
    streaming : [
      { start : new Date(2008, 0, 09, 22, 01, 00),
        end   : new Date(2008, 0, 16, 21, 59, 00)}
    ],
    filesize  : '600Mb'
  }
];

I see two PIDs the original one "b007cjrb" and the one from versions: "b006py02"
I am guessing I use the second one?
Also note the dates it is available from and the filesize.
Is there always just one version "Original" or is there an occasion
where there are different versions? It should be possible to interpret
most of the without needing a full HTML and Javascript parser,
provided the BBC don't change it too much.

Request:
> GET /mediaselector/3/stream/check/iplayer?pid=b006py02 HTTP/1.1
> HOST: www.bbc.co.uk
Response:
> <?xml version="1.0" encoding="utf-8"?>
> <stream version="0.1">
>         <server>cp41752.edgefcs.net</server>
>         <identifier>secure/b0006py02-streaming68309978</identifier>
>         <subtitleUrl></subtitleUrl>
>         
> <token>daEcncIbfdxcWd6a1a4dVcqdRbIb6aUbHae-bhHZU_-cCp-EppEFqzpNEvEqwI</token>
>
>
> </stream>

Request:
> GET /mediaselector/3/stream/check/iplayer?pid=b007cjrb HTTP/1.1
> HOST: www.bbc.co.uk
Response:
> <?xml version="1.0" encoding="utf-8"?>
> <stream version="0.1">
>
>           <error id="notavailable"/>
>
> </stream>

>From this we can see that the stream can return either the
server,identifier,subtitleURL,token combination or an error ID.
Helpful if you want to find out which versions can and can't be used.
Not sure how to use subtitle (none provided for this clip anyway)

Select the PID b006py02 as it's the only "available" one (I think we
should only be using IDs from the version array anyway).
Set server,identifier,subtitleURL,token accordingly.

Fetch the IP from http://cp41752.edgefcs.net/fcs/ident
Request:
> GET /fcs/ident HTTP/1.1
> HOST: cp41752.edgefcs.net
Response:
> <?xml version="1.0" encoding="utf-8" ?>
> <fcs><ip>217.243.192.45</ip></fcs>

Set IP address to 217.243.192.45

Request: 
rtmp://217.243.192.45:1935/ondemand?_fcs_vhost=cp41752.edgefcs.net&auth=daEcncIbfdxcWd6a1a4dVcqdRbIb6aUbHae-bhHZU_-cCp-EppEFqzpNEvEqwI&aifp=v001&slist=secure/b0006py02-streaming68309978

wget complains unsupported scheme.
mPlayer also fails.

Of course I can't check that URL is correct without an RTMP client of some sort.

Of course this may break as soon as the BBC changes anything.
Formal definitions for the XML would be helpful.
What error conditions occur? Why do they occur? What tags are used?
How does subtitleURL work?

Andy

-- 
Computers are like air conditioners.  Both stop working, if you open windows.
                -- Adam Heath
-
Sent via the backstage.bbc.co.uk discussion group.  To unsubscribe, please 
visit http://backstage.bbc.co.uk/archives/2005/01/mailing_list.html.  
Unofficial list archive: http://www.mail-archive.com/[email protected]/

Reply via email to