2012年5月12日土曜日

ニコニコ静画のお題と漫画のAPI



  1. お題の一覧取得

http://seiga.nicovideo.jp/theme/list/{カテゴリタイプ}/?page={ページ番号}&sort={ソート種別}

[カテゴリタイプ]
all:総合
genre_ent:エンターテイメント・ニュース・スポーツ・音楽
ent:エンターテイメント
news:ニュース
sports:スポーツ
music:音楽
genre_culture:アニメ・ゲーム・漫画
anime:アニメ
game:ゲーム
comic:漫画
genre_life:生活
animal:動物
cook:料理
vehicle:乗り物
view:風景
nature:自然
genre_other:描いてみた・モバイル・ニコニコ生放送・テスト・その他
draw:描いてみた
mobile:モバイル
live:ニコニコ生放送
test:テスト
other:その他
genre_adult:R-18ジャンル
r18:R-18

[ページ番号]
1から

[ソート種別]
comment_created:コメントの新しい順
comment_created_a:コメントの古い順
res_created:画像の新しい順
res_created_a:画像の古い順
theme_created:作成の新しい順
theme_created_a:作成の古い順
theme_mylist:マイリスト登録の多い順
theme_mylist_a:マイリスト登録の少ない順
theme_speed:勢いの速い順
theme_speed_a:勢いの遅い順
theme_view:再生数の多い順
theme_view_a:再生数の少ない順
res_count:画像投稿数の多い順
res_count_a:画像投稿数の少ない順
comment_count:コメントの多い順
comment_count_a:コメントの少ない順

ログイン不要です。
/bbs/sgxxxxx/を検出し、お題番号の抽出でいけると思います。
動画履歴が含まれているので、http://seiga.nicovideo.jp/my/historyから動画履歴情報を
取得して、除外するといいと思います。
動画履歴情報はCookieに関連付けられているので、Cookieのクリア後、取得のほうが
スマートですね。


  1. お題情報取得


http://seiga.nicovideo.jp/api/theme/info?id={静画番号}

[静画番号]
静画番号の数値の部分だけです。
sg11111なら11111ですね。

レスポンスは下記のような感じ
<?xml version="1.0" encoding="UTF-8"?>
<response>
<theme>
<id>33674</id>
<title>第七回MMD静止画選手権 本選 第3投稿会場</title>
<res_count>56</res_count>
<comment_count>115</comment_count>
<view_count>1231</view_count>
<mylist_count>25</mylist_count>
<speed>57</speed>
<status>0</status>
<bgm_id />
<import_flag>0</import_flag>
<delete_flag>0</delete_flag>
<campaign_name />
<theme_type>0</theme_type>
<content />
<command>shita</command>
<created>2012-05-11 22:51:52</created>
<updated>2012-05-12 20:00:50</updated>
<image_id>2044438</image_id>
<tag_list>
<tag>
<target_id>33674</target_id>
<tag_id>6</tag_id>
<lock_status>1</lock_status>
<created>2009-11-14 15:08:07</created>
<updated>2009-11-14 15:08:07</updated>
<id>6</id>
<name>描いてみた</name>
<normalize>描イテミタ</normalize>
<normalize_tag_id>6</normalize_tag_id>
<manga_count>0</manga_count>
</tag>
<tag>
                         ・
                         ・
                         ・
</tag>
</tag_list>
<thumbnail_url>http://lohas.nicoseiga.jp/thumb/2044438s</thumbnail_url>
<image_count>56</image_count>
<description />
</theme>
</response>


  1. 静画一覧取得(お題)

http://seiga.nicovideo.jp/api/theme/data?theme%5Fid={静画番号}

[静画番号]
静画番号の数値の部分だけです。
sg11111なら11111ですね。

レスポンスは下記のような感じ
<?xml version="1.0" encoding="UTF-8"?>
<response>
<image_list>
<image>
<id>2044438</id>
<number>1</number>
<res_id>1092373</res_id>
<comment_count>3</comment_count>
<image_id>2044438</image_id>
<delete_flag>0</delete_flag>
<delete_type>0</delete_type>
<comment_id>9110019</comment_id>
<comment_user_id>1293397</comment_user_id>
<user_name />
<user_hash>d+moNaUJgaU4Hhqwv0Vy+8+xd6k</user_hash>
<anonymous_flag>1</anonymous_flag>
<content />
<command>shita</command>
<comment_number>1</comment_number>
<type>2</type>
<send_from>0</send_from>
<ip_address>180.2.40.154</ip_address>
<comment_delete_flag>0</comment_delete_flag>
<comment_status>0</comment_status>
</image>
<image>
                  ・
                  ・
                  ・
</image>
</image_list>
<comment_list>
<comment>
<comment_id>9110019</comment_id>
<id>9110019</id>
<image_id>2044438</image_id>
<res_id>1092373</res_id>
<content />
<command>shita</command>
<created>2012-05-11 22:51:52</created>
<frame>-1</frame>
<user_hash>d+moNaUJgaU4Hhqwv0Vy+8+xd6k</user_hash>
<anonymous_flag>1</anonymous_flag>
</comment>
<comment>
                  ・
                  ・
                  ・
</comment>
</comment_list>
</response>


  1. 漫画一覧取得

[総合]
http://seiga.nicovideo.jp/manga/list?page={ページ}&sort={ソート方法}
[カテゴリ指定]
http://seiga.nicovideo.jp/manga/list?page={ページ}&sort={ソート方法}&category={カテゴリ}
[公式]
http://seiga.nicovideo.jp/manga/list?page={ページ}&official=1&sort={ソート方法}

{ソート方法}
manga_updated:更新が新しい順
manga_updated_a:更新が古い順
manga_created:投稿が新しい順
manga_created_a:投稿が古い順
manga_view:再生数が多い順
manga_view_a:再生数が少ない順

{ページ}
1から

{カテゴリ}
shonen:少年マンガ
seinen:青年マンガ
shojo:少女マンガ
yonkoma:4コママンガ
other:その他マンガ
fan:ファンコミック

comic/29を取り出し、漫画番号(<-だと29)を取得したらいいと思います。


  1. 漫画のエピソード情報取得

http://seiga.nicovideo.jp/rss/manga/{漫画番号}

RSS形式です。

レスポンスは下記
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>真の勇者はしゃべらない - ニコニコ静画(漫画)</title>
    <link>http://seiga.nicovideo.jp/manga/613</link>
    <description><![CDATA[真の勇者はしゃべらない の更新情報です]]></description>
    <pubDate>Sat, 12 May 2012 21:10:24 +0900</pubDate>
    <language>ja</language>
    <copyright>(c) niwango, inc. All rights reserved.</copyright>
   
      <item>
        <title>真の勇者はしゃべらない 第1話「我輩は勇者である。台詞はもうない。」</title>
        <link>http://seiga.nicovideo.jp/watch/mg31432</link>
        <description><![CDATA[
          <p class="nicoseiga-thumbnail">
            <img src="http://lohas.nicoseiga.jp/thumb/1921262q" border="0" />
          </p>
          <p class="nicoseiga-description">魔王がいる世界。この世界では毎年くじによって勇者が決められる。
勇者になったものは一年間勇者として魔王を討伐しにいかなくてはならないのだが、今まで倒すことができなかった。
今年は少年が勇者に選ばれた。少年は魔王を倒すことができるのか?(一部編集しました)</p>
          <p class="nicoseiga-info"><small>
            <strong class="nico-info-date">2012年04月01日 17:58 投稿</strong>
          </small></p>
        ]]></description>
        <guid isPermaLink="false">efdf562ce2fb0ad460fd8e9d33e57f57</guid>
        <pubDate>Sun, 01 Apr 2012 17:58:38 +0900</pubDate>
      </item>
      <item>
       ・
       ・
       ・
      </item>
 
  </channel>
</rss>


  1. 静画一覧取得(漫画)

http://seiga.nicovideo.jp/api/theme/data?theme%5Fid={漫画番号}

[漫画番号]
漫画番号の数値の部分だけです。
mg11111なら11111ですね。


レスポンスは下記
<?xml version="1.0" encoding="UTF-8"?>
<response>
<image_count>53</image_count>
<image_list>
<image>
<id>1921156</id>
<se_id />
<bgm_id>3832</bgm_id>
<bgm_loop>0</bgm_loop>
<duration>80</duration>
<thread>2705</thread>
<leaf>4</leaf>
<width>2048</width>
<height>1536</height>
<cache_time />
<bgm_path>/sound/bgm/30132c/3832</bgm_path>
<balloon>
<image_id>1921156</image_id>
<x>490</x>
<y>6</y>
<w>128</w>
<h>225</h>
<is_auto>1</is_auto>
</balloon>
</image>
<image>
         ・
         ・
         ・
</image>
</image_list>
<comment_list>
<comment />
</comment_list>
<threads>
<thread>
<id>2705</id>
<url>http://msg01.seiga.nicovideo.jp:80/</url>
</thread>
</threads>
</response>


  1. 漫画コメント

http://msg01.seiga.nicovideo.jp/api/thread?thread={threadid}&version=20090904&res_from=-1000

[threadid]
静画一覧取得(漫画)で取得できるthread

レスポンスは下記
<packet>
<thread resultcode="0" thread="2705" last_res="84" ticket="0x17837480" revision="1" server_time="1336826321"/>
<leaf thread="2705" leaf="1" count="2"/>
<leaf thread="2705" leaf="3" count="2"/>



<leaf thread="2705" leaf="51" count="5"/>
<leaf thread="2705" leaf="52" count="6"/>
<view_counter video="0" id="mg31432"/>
<chat thread="2705" no="1" vpos="11437" date="1333271513" mail="184" user_id="lsjMy2AAWvZ2KrbFT6UlukxuFm0" anonymity="1" leaf="1">um</chat>
<chat thread="2705" no="2" vpos="67812" date="1333271543" mail="184" user_id="lsjMy2AAWvZ2KrbFT6UlukxuFm0" anonymity="1" leaf="11">BGMいいね</chat>



<chat thread="2705" no="83" vpos="269187" date="1336790348" mail="184" user_id="5q4BsOtcITXPdG3-ukLCGuvDaw0" anonymity="1" leaf="44">w</chat>
<chat thread="2705" no="84" vpos="295375" date="1336790365" mail="184" user_id="5q4BsOtcITXPdG3-ukLCGuvDaw0" anonymity="1" leaf="49">いやはなすがふつうだろ</chat>
</packet>

0 件のコメント:

コメントを投稿