Ustream.tvの放送状況を確認する

Ustream.tvの放送状況を確認して放送中なら再生するというものが作れないかと思って少し調べたメモです.

やりたいのはこんな感じ.

  • Ustream.tvの「登録済みチャンネル」から放送中のチャンネルを抽出
  • 放送中のものがあったら再生
  • 放送中のものがなかったらNASA.TV辺りを流す

APIをざっと見てみるとチャンネルの放送状況は取得できました.

この機能はデベロッパーIDなども必要ないようです.

$ w3m -dump_source https://api.ustream.tv/channels/17125175.xml|grep status
        <status><![CDATA[live]]></status>
$ w3m -dump_source https://api.ustream.tv/channels/27482.xml|grep status
        <status><![CDATA[offair]]></status>

ここで指定するのはチャンネルIDでチャンネルURLの後ろのチャンネルではありません.これは以下のAPIで取得できます.

$ w3m -dump_source http://api.ustream.tv/xml/channel/ospn-tv/getValueOf/id|grep results
<results>10635140</results>

ということで「登録済みチャンネル」の取得以外は出来そうです.後はこれをlivestreamerに流し込むとUstream.tvのサイネージが作れそうな感じ.

ちなみにAPIにはLive開始時などに教えてくれる機能などもあるようですがそちらはレシーバが必要になるので今回の用途には向か無さそうなのでちゃんと調べていません.


コメントを残す

メールアドレスが公開されることはありません。 ※ が付いている欄は必須項目です

Your post must include a link to this post.

How does this work?
Write a response on your own website and include a link to this post. Then submit your response’s URL here. Your response may appear here after moderation. To update or remove it, edit or delete your original post and submit the same URL again. Learn more about Webmentions.