Akamai problem

David Woodhouse dwmw2 at infradead.org
Wed May 26 08:06:20 EDT 2010


I'm confused by the Akamai behaviour. I have a really naïve patch in my
git tree on git.infradead.org which simple drops the extra 'auth=' from
the Akamai authString, which works even though it preserves the '&'
and other HTML entities.

James, you have a more complicated patch which looks like it's doing the
"right thing"... but it doesn't actually _work_.

For example, if I use your code and mine and '--pid b00sh6xp --debug', I
see the following differences in the output (-mine +yours).

I tweaked your version (patch below) to try to fix the Playpath (see
patch below). It makes no difference.

This is odd -- your version _looks_ right. It's doing precisely what I
see the real flash player doing, if I snoop its network traffic. But
even when I try running rtmpdump manually with the parameters I see in
that network capture, I can't make it work. Only the "obviously wrong"
version actually works...

 RTMPDump v2.2d
 (c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL
 DEBUG: Protocol : RTMP
 DEBUG: Hostname : cp41752.edgefcs.net
 DEBUG: Port     : 1935
-DEBUG: Playpath : mp4:secure/1500kbps/Young_British_and_Angry_19_05_2010_b00sh6xm?auth=daEcWayakcCc9d6aSbGazbPcJdYbLdCdob3-bl_qQH-bWG-JnpDApEpGEvErxE&aifp=v001&slist=secure/800kbps/Young_British_and_Angry_19_05_2010_b00sh6xm;secure/480kbps/Young_British_and_Angry_19_05_2010_b00sh6xm;secure/400kbps/Young_British_and_Angry_19_05_2010_b00sh6xm;secure/1500kbps/Young_British_and_Angry_19_05_2010_b00sh6xm&aifp=v001
-DEBUG: tcUrl    : rtmp://cp41752.edgefcs.net:80/ondemand?_fcs_vhost=cp41752.edgefcs.net&auth=daEcWayakcCc9d6aSbGazbPcJdYbLdCdob3-bl_qQH-bWG-JnpDApEpGEvErxE&aifp=v001&slist=secure/800kbps/Young_British_and_Angry_19_05_2010_b00sh6xm;secure/480kbps/Young_British_and_Angry_19_05_2010_b00sh6xm;secure/400kbps/Young_British_and_Angry_19_05_2010_b00sh6xm;secure/1500kbps/Young_British_and_Angry_19_05_2010_b00sh6xm&aifp=v001&slist=secure/1500kbps/Young_British_and_Angry_19_05_2010_b00sh6xm
+DEBUG: Playpath : mp4:secure/1500kbps/Young_British_and_Angry_19_05_2010_b00sh6xm?auth=daEdEc4aBcwbxcZbmaPcyaYbwahaYdycxdp-bl_qVD-bWG-BprDHpyoIDoFpwD&aifp=v001&slist=secure/1500kbps/Young_British_and_Angry_19_05_2010_b00sh6xm
+DEBUG: tcUrl    : rtmp://cp41752.edgefcs.net:1935/ondemand?_fcs_vhost=cp41752.edgefcs.net&auth=daEdEc4aBcwbxcZbmaPcyaYbwahaYdycxdp-bl_qVD-bWG-BprDHpyoIDoFpwD&aifp=v001&slist=secure/1500kbps/Young_British_and_Angry_19_05_2010_b00sh6xm
 DEBUG: swfUrl   : http://www.bbc.co.uk/emp/10player.swf
-DEBUG: app      : ondemand?_fcs_vhost=cp41752.edgefcs.net&auth=daEcWayakcCc9d6aSbGazbPcJdYbLdCdob3-bl_qQH-bWG-JnpDApEpGEvErxE&aifp=v001&slist=secure/800kbps/Young_British_and_Angry_19_05_2010_b00sh6xm;secure/480kbps/Young_British_and_Angry_19_05_2010_b00sh6xm;secure/400kbps/Young_British_and_Angry_19_05_2010_b00sh6xm;secure/1500kbps/Young_British_and_Angry_19_05_2010_b00sh6xm&aifp=v001&slist=secure/1500kbps/Young_British_and_Angry_19_05_2010_b00sh6xm
+DEBUG: app      : ondemand?_fcs_vhost=cp41752.edgefcs.net&auth=daEdEc4aBcwbxcZbmaPcyaYbwahaYdycxdp-bl_qVD-bWG-BprDHpyoIDoFpwD&aifp=v001&slist=secure/1500kbps/Young_British_and_Angry_19_05_2010_b00sh6xm
 DEBUG: live     : no
 DEBUG: timeout  : 10 sec
 DEBUG: SWFSHA256:

...

-DEBUG2:   0000:  02 00 07 5f 72 65 73 75  6c 74 00 3f f0 00 00 00   ..._result.?....  
-DEBUG2:   0010:  00 00 00 03 00 06 66 6d  73 56 65 72 02 00 0d 46   ......fmsVer...F  
-DEBUG2:   0020:  4d 53 2f 33 2c 35 2c 33  2c 38 31 36 00 0c 63 61   MS/3,5,3,816..ca  
-DEBUG2:   0030:  70 61 62 69 6c 69 74 69  65 73 00 40 5f c0 00 00   pabilities. at _...  
-DEBUG2:   0040:  00 00 00 00 04 6d 6f 64  65 00 3f f0 00 00 00 00   .....mode.?.....  
-DEBUG2:   0050:  00 00 00 00 09 03 00 05  6c 65 76 65 6c 02 00 06   ........level...  
-DEBUG2:   0060:  73 74 61 74 75 73 00 04  63 6f 64 65 02 00 1d 4e   status..code...N  
-DEBUG2:   0070:  65 74 43 6f 6e 6e 65 63  74 69 6f 6e 2e 43 6f 6e   etConnection.Con  
+DEBUG2:   0000:  03 00 00 00 00 00 86 14  00 00 00 00               ............      
+DEBUG2:   0000:  02 00 06 5f 65 72 72 6f  72 00 3f f0 00 00 00 00   ..._error.?.....  
+DEBUG2:   0010:  00 00 05 03 00 05 6c 65  76 65 6c 02 00 05 65 72   ......level...er  
+DEBUG2:   0020:  72 6f 72 00 04 63 6f 64  65 02 00 1e 4e 65 74 43   ror..code...NetC  
+DEBUG2:   0030:  6f 6e 6e 65 63 74 69 6f  6e 2e 43 6f 6e 6e 65 63   onnection.Connec  
+DEBUG2:   0040:  74 2e 52 65 6a 65 63 74  65 64 00 0b 64 65 73 63   t.Rejected..desc  
+DEBUG2:   0050:  72 69 70 74 69 6f 6e 02  00 29 5b 20 41 63 63 65   ription..)[ Acce  
+DEBUG2:   0060:  73 73 4d 61 6e 61 67 65  72 2e 52 65 6a 65 63 74   ssManager.Reject  
+DEBUG2:   0070:  20 5d 20 3a 20 41 63 63  65 73 73 20 64 65 6e 69    ] : Access deni  
 DEBUG2: RTMP_ReadPacket: fd=5
 DEBUG2:   0000:  c3                                                 .                 
-DEBUG2:   0000:  6e 65 63 74 2e 53 75 63  63 65 73 73 00 0b 64 65   nect.Success..de  
-DEBUG2:   0010:  73 63 72 69 70 74 69 6f  6e 02 00 15 43 6f 6e 6e   scription...Conn  
-DEBUG2:   0020:  65 63 74 69 6f 6e 20 73  75 63 63 65 65 64 65 64   ection succeeded  
-DEBUG2:   0030:  2e 00 0e 6f 62 6a 65 63  74 45 6e 63 6f 64 69 6e   ...objectEncodin  
-DEBUG2:   0040:  67 00 00 00 00 00 00 00  00 00 00 04 64 61 74 61   g...........data  
-DEBUG2:   0050:  08 00 00 00 00 00 07 76  65 72 73 69 6f 6e 02 00   .......version..  
-DEBUG2:   0060:  09 33 2c 35 2c 33 2c 38  31 36 00 00 09 00 00 09   .3,5,3,816......  

This is the patch I tried...

diff --git a/get_iplayer b/get_iplayer
index 016e548..ffa76dd 100755
--- a/get_iplayer
+++ b/get_iplayer
@@ -5627,7 +5627,7 @@ sub get_stream_data_cdn {
 		# Akamai CDN
 		if ( $cattribs->{kind} eq 'akamai' ) {
 			# disable akamai for now for video - broken...
-			next if $ext eq 'mp4';
+#			next if $ext eq 'mp4';
 			# Set the live flag if this is not an ondemand stream
 			$conn->{live} = 1 if defined $cattribs->{application} && $cattribs->{application} =~ /^live/;
 			# Default appication is 'ondemand'
@@ -5646,18 +5646,19 @@ sub get_stream_data_cdn {
 			}
 
 			if ( $cattribs->{authString} ) {
+				$conn->{playpath} = "$cattribs->{identifier}";
 				# rewrite authstring
 				$cattribs->{authString} =~ s|^auth=||gi;
+				$cattribs->{authString} =~ s/slist=(.+)$/slist=/g;
+				$cattribs->{identifier} =~ s/^mp[34]://;
+				$cattribs->{authString} .= $cattribs->{identifier};
 				decode_entities($cattribs->{authString});
-				$conn->{playpath} = "$cattribs->{identifier}?auth=$cattribs->{authString}";
+				$conn->{playpath} .= "?auth=$cattribs->{authString}";
 			} else {
 				$conn->{playpath} = $cattribs->{identifier};
 			}
 			# Remove offending mp3/mp4: at the start of the identifier (don't remove in stream url)
-			$cattribs->{identifier} =~ s/^mp[34]://;
 			# strip out alternative playlist items from slist in authString (replace with identifier)
-			$cattribs->{authString} =~ s/slist=(.+)$/slist=/g;
-			$cattribs->{authString} .= $cattribs->{identifier};
 			if ( $cattribs->{authString} ) {
 				$conn->{streamurl} = "rtmp://$cattribs->{server}:1935/$cattribs->{application}?_fcs_vhost=$cattribs->{server}&auth=$cattribs->{authString}&aifp=v001&slist=$cattribs->{identifier}";
 			} else {

-- 
dwmw2




More information about the get_iplayer mailing list