= ニコニコ生放送 API一覧 =
[[PageOutline]]
== 汎用
基本的にCokkieのセッション情報が必要。
=== GetPlayerStatus
概要を書く
==== URL
* http://watch.live.nicovideo.jp/api/getplayerstatus
==== パラメタ(GET)
* v: 放送ID
==== 応答(成功)
細かいところは分かる方お願いします。。
{{{
<?xml version="1.0" encoding="utf-8" ?>
<getplayerstatus status="ok" time="1251561291">
<stream>
<id>放送ID(lv***)</id>
<provider_type>配信元種別(community,)</provider_type>
<default_community>コミュニティID</default_community>
<owner_id>生主ID</owner_id>
<owner_name>生主名</owner_name>
<is_reserved>通常枠:0 予約枠:1</is_reserved>
<watch_count>来場者数</watch_count>
<comment_count>コメント数</comment_count>
<danjo_comment_mode>0</danjo_comment_mode>
<relay_comment>0</relay_comment>
<bourbon_url />
<full_video />
<after_video />
<before_video />
<kickout_video />
<archive>生放送:0 タイムシフト:1</archive>
<ichiba_notice_enable>0</ichiba_notice_enable>
<comment_lock>コメント禁止?(0,1)</comment_lock>
<background_comment>0</background_comment>
<telop>
<enable>0</enable>
</telop>
<base_time>1251559568</base_time>
<open_time>1251559568</open_time>
<start_time>1251559568</start_time>
<contents_list>
<contents id="main" disableAudio="0" disableVideo="0" start_time="1251559569">rtmp:liverepeater:rtmp://nlpoca18.live.nicovideo.jp:1935/publicorigin/lv3488915</contents>
</contents_list>
</stream>
<user>
<user_id>ユーザID</user_id>
<nickname>ユーザ名</nickname>
<is_premium>プレミアムか(0,1)</is_premium>
<userAge>自分の年齢</userAge>
<userSex>性別(0女,1男)</userSex>
<userPrefecture>都道府県ID</userPrefecture>
<room_label>コミュニティID</room_label>
<room_seetno>座席番号</room_seetno>
<is_join>コミュメンバー:1 非メンバー:0</is_join>
</user>
<rtmp>
<url>rtmp://nleza04.live.nicovideo.jp:1935/liveedge</url>
<ticket>ユーザID:放送ID:0:1251561291:f5d5640e8e6e30e1</ticket>
</rtmp>
<ms>
<addr>コメントサーバURL</addr>
<port>ポート</port>
<thread>スレッドID</thread>
</ms>
</getplayerstatus>
}}}
==== 応答(失敗--既に放送が終了している)
{{{
<?xml version="1.0" encoding="utf-8" ?>
<getplayerstatus status="fail" time="1264322387">
<error>
<code>closed</code>
</error>
</getplayerstatus>
}}}
=== ConfigureNgWord
概要を書く
==== URL
* http://live.nicovideo.jp/api/configurengword
==== パラメタ(GET)
* video: 放送ID
* mode: モード(get:NGリスト取得, )
=== HeartBeat
概要を書く
==== URL
* http://live.nicovideo.jp/api/heartbeat
==== パラメタ(GET)
* v: 放送ID
==== 応答(成功)
{{{
<heartbeat status="ok">
<watchCount>来場者数</watchCount>
<commentCount>総コメント数</commentCount>
<ticket>チケット(697078:lv10026020:0:1264074677:f356f69482195ffa)</ticket>
</heartbeat>
}}}
==== 応答(失敗)
{{{
<heartbeat status="fail">
−
<error>
<code>NOTFOUND_USERLIVESLOT</code>
<description>lost userliveslot</description>
<reject>true</reject>
</error>
</heartbeat>
}}}
==== セクション情報要否
* この値もいるかな
== タイムシフト関係
=== GetWayBackKey
==== URL
* http://watch.live.nicovideo.jp/api/getwaybackkey
==== パラメタ(GET)
* thread : (恐らく)GetPlayerStatusのThread
==== 応答
{{{
waybackkey=1264384286.3jbrG2Y6MKlBNwBa6h_6R9ZGNY8
}}}
== アラート関係
詳しくは[http://dic.nicovideo.jp/a/%E3%83%8B%E3%82%B3%E7%94%9F%E3%82%A2%E3%83%A9%E3%83%BC%E3%83%88%28%E6%9C%AC%E5%AE%B6%29%E3%81%AE%E4%BB%95%E6%A7%98 大百科の項目]を参照。
なお、ここのAPIはCookieを必要としない。
=== GetStreamInfo
番組情報の取得。
ただし放送開始からしばらくするとnot_permittedで失敗になる模様。
==== URL
* http://live.nicovideo.jp/api/getstreaminfo/lv***
==== パラメタ(GET)
* 放送ID
=== GetAlertServer
概要を書く
==== URL
* http://live.nicovideo.jp/api/getalertstatus
==== パラメタ(POST)
* ticket: チケット
== テンプレート
=== getpublishstatus
概要を書く
==== URL
* APIのURLをかく
==== パラメタ(GET)
* パラメタを書く(x: yの形式で)
==== パラメタ(POST)
* パラメタを書く(x: yの形式で)
==== 応答
open_time (枠に入れる時間) start_time (開始時間) open_timeは、予約枠での3分前の時間
{{{
応答を書く
}}}
== テンプレート
=== API名
概要を書く
==== URL
* APIのURLをかく
==== パラメタ(GET)
* パラメタを書く(x: yの形式で)
==== パラメタ(POST)
* パラメタを書く(x: yの形式で)
==== 応答
{{{
応答を書く
}}}