生配信チェッカーサイトを作りたいブログ

生配信チェッカーサイトを作りたい人がメモ書きをするブログ

Ustreamから情報取得

最近Ustreamは人気ないのかな?
かなり企業向けのサービスになったイメージ
APIはこちら
http://ustream.github.io/api-docs/

参考phpコード

<?php
date_default_timezone_set('Asia/Tokyo');
$url_base = 'http://api.ustream.tv/json/channel/';
$id_ustream = "nasa-hd-tv"; //取得チャンネルのID
$ust_url = $url_base . $id_ustream . '/getInfo' ; 
//$json = json_encode($xml);
//$array = json_decode($json,TRUE);

$json = file_get_contents($ust_url);
$arr = json_decode($json,true);

//var_dump($arr);
$id = $arr['results']['id'];
$user_id = $arr['results']['user']['id'];
$user_name = $arr['results']['user']['userName'];
$user_url = $arr['results']['user']['url'];
$title = $arr['results']['title'];
$description = $arr['results']['description'];
$urlTitleName = $arr['results']['urlTitleName'];
$url = $arr['results']['url'];
$status = $arr['results']['status']; // "live" or "offair"
$createdAt = $arr['results']['createdAt'];
$image_small = $arr['results']['small'];
$image_medium = $arr['results']['medium'];
$rating = $arr['results']['rating'];
$embedTag = $arr['results']['embedTag'];//動画埋め込み用のタグ
$embedTagSourceUrl = $arr['results']['embedTagSourceUrl'];
$embedTagSourceUrl = $arr['results']['hasTags'];
$comments = $arr['results']['numberOf']['comments'];
$comments = $arr['results']['numberOf']['comments'];
$ratings = $arr['results']['numberOf']['ratings'];
$favorites = $arr['results']['numberOf']['favorites'];
$views = $arr['results']['numberOf']['views'];
$tags = $arr['results']['numberOf']['tags'];
$chat_embedTag = $arr['results']['chat']['embedTag'];//チャット埋め込み用のタグ