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


コメントを残す

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

To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Find out more about Webmentions.)