You are checking for something that is not there. Replace:
Code:
var %status = $json(%j,status)

with:
Code:
var %status = $json(%j,stream,_id)

If _id exists, then the stream is online, otherwise it is offline.