ニコニコ静画のAPIを少し調べてみた
先日、ニコニコ静画がリリースされました。
お題に沿った静止画をスライドの様に再生し、コメントをつける事が出来るサービスです。
そこで、Playerの使用しているAPIを調べてみました。
どうやら、ニコニコ静画では画像の読み出しに認証が必要ないようです。
追記: 画像の取得に認証は必要ないですが、listの取得には認証が必要でした
スライドに使用する画像やコメントは
で取得出来ます。
レスポンスは以下のようになっています
<response> <res_list> <res> <id>30993</id> <image_id>31240</image_id> <number>1</number> <created>2009-11-16 02:01:20</created> <comment_id>69893</comment_id> <type>2</type> <content>今思うと何で保存したんだろう。</content> <command /> <comment_created>2009-11-16 02:01:20</comment_created> <frame>-1</frame> <status>0</status> <source_url /> <inspection_status>1</inspection_status> <image_delete_flag>0</image_delete_flag> <comment_list> <comment> <id>75213</id> <res_id>30993</res_id> <content>@BGM</content> <command /> <created>2009-11-16 04:44:08</created> <frame>22680</frame> <status>0</status> <comment_id>75213</comment_id> </comment> </comment_list> </res> <res> <id>31017</id> <image_id>31263</image_id> <number>2</number> <created>2009-11-16 02:03:07</created> <comment_id>69962</comment_id> <type>1</type> <content /> <command /> <comment_created>2009-11-16 02:03:07</comment_created> <frame>-1</frame> <status>0</status> <source_url /> <inspection_status>1</inspection_status> <image_delete_flag>0</image_delete_flag> <comment_list> <comment> <id>78635</id> <res_id>31017</res_id> <content>wwww</content> <command /> <created>2009-11-16 09:22:38</created> <frame>19740</frame> <status>0</status> <comment_id>78635</comment_id> </comment> <comment> <id>83991</id> <res_id>31017</res_id> <content>www</content> <command /> <created>2009-11-16 16:14:51</created> <frame>59304</frame> <status>0</status> <comment_id>83991</comment_id> </comment> </comment_list> </res> </res_list> </response>
- image_id 画像取得用のID
- comment_list その画像についているコメント達を格納
- comment コメント1つ分
- content コメント
- res_id コメント先のスレID
後は、要素名そのままです(コメント日時やコマンドなど)
frameはコメントの入場開始フレーム数でしょうか。
後は画像の取得先ですが
です。
image_idの後ろに「l」が付くのがポイントです。(小文字のエルです)
このような感じでスライドに使用する画像を取得しています。
認証がないので、画像の保存は簡単ですね。
他にも、カウンターをインクリメントするAPIもありました。
後、静画のPlayerってFlexなんですね。