Parsing "stream_url" from JSON
#1
Hi

I have the following JSON response and I don't understand how it should be parsed to start a stream on XBMC Linux:

{"stream_url": "rtmpe://zattoo.fc.llnwd.net/zattoo/s_TF1?e=1305661167&h=28a6c8b89f1c82be36cdc4df474f67d9", "channel_session_id": "6fb1e87ac62917085c5e9d73a35
94e51", "authorized": "yes", "do_lookup": true}


Can someone please turn me round and point me in the right direction please ?

Thanks

David
Reply
#2
dlake02 Wrote:Hi

I have the following JSON response and I don't understand how it should be parsed to start a stream on XBMC Linux:

{"stream_url": "rtmpe://zattoo.fc.llnwd.net/zattoo/s_TF1?e=1305661167&h=28a6c8b89f1c82be36cdc4df474f67d9", "channel_session_id": "6fb1e87ac62917085c5e9d73a35
94e51", "authorized": "yes", "do_lookup": true}


Can someone please turn me round and point me in the right direction please ?

Thanks

David

i've had a look at zattoo before and don't think librtmp supports these streams at the moment unless someone else knows better?
Reply
#3
This thread has good info about rtmp streams. - http://forum.xbmc.org/showthread.php?tid=93280
Reply
#4
Thanks.

I'm using the latest svn of rtmpdump that fixes the handshake issue and I get through swf verification for the live stream, but it fails to start the stream:

Quote:DEBUG: Property: <Name: fmsVer, STRING: FMS/3,5,5,2004>
DEBUG: Property: <Name: capabilities, NUMBER: 127.00>
DEBUG: Property: <Name: mode, NUMBER: 1.00>
DEBUG: (object end)
DEBUG: (object begin)
DEBUG: Property: <Name: level, STRING: status>
DEBUG: Property: <Name: code, STRING: NetConnection.Connect.Success>
DEBUG: Property: <Name: description, STRING: Connection succeeded.>
DEBUG: Property: <Name: objectEncoding, NUMBER: 0.00>
DEBUG: Property: <Name: data, OBJECT>
DEBUG: (object begin)
DEBUG: Property: <Name: version, STRING: 3,5,5,2004>
DEBUG: (object end)
DEBUG: (object end)
DEBUG: (object end)
DEBUG: HandleInvoke, server invoking <_result>
DEBUG: HandleInvoke, received result for method call <connect>
DEBUG: sending ctrl. type: 0x0003
DEBUG: Invoking createStream
DEBUG: RTMP_ClientPacket, received: invoke 21 bytes
DEBUG: (object begin)
DEBUG: Property: NULL
DEBUG: (object end)
DEBUG: HandleInvoke, server invoking <onBWDone>
DEBUG: Invoking _checkbw
DEBUG: RTMP_ClientPacket, received: invoke 29 bytes
DEBUG: (object begin)
DEBUG: Property: NULL
DEBUG: (object end)
DEBUG: HandleInvoke, server invoking <_result>
DEBUG: HandleInvoke, received result for method call <createStream>
DEBUG: SendPlay, seekTime=0, stopTime=0, sending play: s_TF1?e=1305661167&h=28a6c8b89f1c82be36cdc4df474f67d9
DEBUG: Invoking play
DEBUG: sending ctrl. type: 0x0003
DEBUG: RTMP_ClientPacket, received: invoke 16419 bytes
DEBUG: (object begin)
DEBUG: Property: NULL
DEBUG: (object end)
DEBUG: HandleInvoke, server invoking <_onbwcheck>
DEBUG: Invoking _result
DEBUG: RTMP_ClientPacket, received: invoke 133 bytes
DEBUG: (object begin)
DEBUG: Property: NULL
DEBUG: (object begin)
DEBUG: Property: <Name: level, STRING: error>
DEBUG: Property: <Name: code, STRING: NetStream.Failed>
DEBUG: Property: <Name: description, STRING: Failed to play (stream ID: 1).>
DEBUG: Property: <Name: clientid, STRING: CyNowEUk>
DEBUG: (object end)
DEBUG: (object end)
DEBUG: HandleInvoke, server invoking <onStatus>
DEBUG: HandleInvoke, onStatus: NetStream.Failed
ERROR: Closing connection: NetStream.Failed
DEBUG: Closing connection.
Reply
#5
dlake02 Wrote:Thanks.

I'm using the latest svn of rtmpdump that fixes the handshake issue and I get through swf verification for the live stream, but it fails to start the stream:

ah, so it does!

i managed to get it to stream using the following rtmpdump command
Code:
./rtmpdump -r rtmpe://zattoo.fc.llnwd.net/zattoo/ -a zattoo  -o test.flv  -W "http://zattoo.com/static/player-e31b5baccc281acb0b0034cb7d83b788.swf" -p http://www.zattoo.com/view -v -y "s_CH_france24?e=1305678445&h=ffd1a838baccbd62739730a2cecf3e55"

the e & h codes don't last very long - i tested by reloading the json url in the browser and quickly copying the playpath into the otherwise prepared command line. so it should be possible to get xbmc to do this!

thanks,

t0mm0
Reply
#6
Excellent !

So, what I am doing is:

wget http://www.encodage.org/tvo/TVO_ver2.txt

This provides me with the base URL for Zattoo including the token and UUID.

I then add the channel name (e.g. TF1, France2) to the end of the URL, and request that via a Swiss proxy.

That in turn dumps me the JSON response.

From there, we should be able to stream all that Zattoo has available.....
Reply
#7
Quote:-W "http://zattoo.com/static/player-e31b5baccc281acb0b0034cb7d83b788.swf"

Is this syntax correct ? If I put the session_id in after the "-", I get an error:

Quote:ERROR: RTMP_HashSWF: swfurl http://zattoo.com/static/player-81606abb...97a5a2.swf not found
\

As long as the e and h values are still valid, the stream plays, but only for 60 seconds...

I've tried putting the hash value after the player.swf, but not sure if this is correct ?

David
Reply
#8
dlake02 Wrote:Is this syntax correct ? If I put the session_id in after the "-", I get an error:

\

As long as the e and h values are still valid, the stream plays, but only for 60 seconds...

I've tried putting the hash value after the player.swf, but not sure if this is correct ?

David

yes that's correct - see the command line i posted earlier (assuming you are still using rtmpdump rather than through xbmc)

the url of the swf file changes - you need to scrape it from the page (zattoo.setStaticAssets).

t0mm0.
Reply

Logout Mark Read Team Forum Stats Members Help
Parsing "stream_url" from JSON0