• このエントリーをはてなブックマークに追加

uずらさん のコメント

http://api.search.nicovideo.jp/api/v2/snapshot/video/contents/search?q=test&targets=tagsExact&_sort=viewCounter&_context=apiguide

今叩くと, fields 省略できるみたい? (仕様変わった?)
No.11
80ヶ月前
このコメントは以下の記事についています
追記 2019年4月22日 2019年6月3日から動画と生放送以外は廃止されるのに言及。 niconico で使われていた 新検索β を js や PHP などから使う方法は2015年11月に非推奨になり、新しく V2 として公開された。今回の V2 の特徴はタグレポと同じようにブラウザから直接検索して json が返ってくるので誰でも手軽に利用できる。 新しいAPI: niconico コンテンツ検索APIガイド(2019年6月3日に動画と生放送以外は廃止) 新しいAPI: コンテンツ検索APIドキュメント(ドキュメント削除を確認 2017年3月17日) 従来のAPI: Mashup Awards 11向け提供APIガイド(ドキュメント削除を確認 2017年3月17日) 新しいスナップショットAPI: ニコニコ動画 『スナップショット検索API v2』 ガイド 従来のスナップショットAPI: ニコニコ動画 『スナップショット検索API』 ガイド(ドキュメント削除を確認 2017年3月18日) タグレポの記事はこちら: 新機能「タグレポ」について 今回の大きな特徴はブラウザからでも手軽に調べられるのと、従来のAPIでは一度に取得できるデータが100でそれが 3 4分割されていたのが分割されなくなったので従来よりも高速に処理できるが、取得上限が 1600 1700(offset が1600なのでそこから+100) なのは変わらないので期間を区切るなど取得方法を工夫する必要がある。アクセス制限については 0.5秒間隔なら現状上手くいっている。2016年1月17日くらいから0.5秒間隔だと途中で取得できなくなり0.6秒間隔で上手くいっている。現在(2016年6月以降)は 0.6 秒でも 0.9 秒でも止まることがあるので待ち時間の設定は 0.5 秒で止まればリトライするようにしている。 対応サービスは以前と同じように、動画、生放送、静画(イラスト)、静画(マンガ)、 静画(書籍) 、チャンネル、ブロマガ記事(著名人)、ニュース、ゲーム、権利楽曲、動画マイリスト、まとめ、コミュニティである。その後、2017年5月19日にゲームと権利楽曲、2017年8月13日に動画マイリストも検索できるようになった。 クエリパラメータも以前と同じで、検索キーワード、調べる方法(タイトル、説明文、タグ)、調べる内容、フィルタ、ソート方法、オフセットの指定、取得数の指定、アプリケーション名が指定できる。 必須クエリパラメータは q(クエリ), targets(検索方法), _sort(順番), _context(アプリ名) である。 サービス別の fields の設定可能・不可能のグラフ ドキュメントでは fields の設定を省略できると書いてあるがどのサービスも省略できない。 追記 2017年8月22日、fields の省略について確かに省略は出来るが省略すると status, totalCount, id だけ返ってくる。この記事を書いた当時の記憶が曖昧なので省略したときにエラーが出たのかそれとも今と同じ仕様だったのか覚えていない。 まとめは2019年5月22日に終了する。  1:video, 2:live, 3:illust, 4:manga, 5:book , 6:channel, 7:channelarticle, 8:news, 9:game, 10:license_search, 11:mylist_video, 12:summary, 13:community 1 2 3 4 5 6 7 8 9 10 11 12 13 contentId 1 1 1 1 1 1 1 1 1 1 1 1 1 title 1 1 1 1 1 1 1 1 1 1 1 1 1 description 1 1 1 1 1 1 1 1 1 0 1 1 1 tags 1 1 1 1 1 1 1 1 1 0 0 1 1 categoryTags 1 1 1 1 0 0 0 0 0 0 0 0 0 viewCounter 1 1 1 1 1 0 0 0 0 0 0 0 0 mylistCounter 1 0 1 1 1 0 1 0 0 0 0 0 0 commentCounter 1 1 1 1 1 0 1 1 0 0 0 0 0 startTime 1 1 1 1 1 1 1 1 1 0 1 1 1 thumbnailUrl 1 1 1 1 1 1 1 0 0 0 0 1 1 communityIcon 0 1 0 0 0 0 0 0 0 0 0 0 0 scoreTimeshiftReserved 0 1 0 0 0 0 0 0 0 0 0 0 0 liveStatus 0 1 0 0 0 0 0 0 0 0 0 0 0 しかしドキュメントと読むと動画と生放送以外を調べるのに必要な説明が全く足りていないのでそれぞれのサンプルコマンドは以下のようにする。 limit は 0 にしても totalCount が返ってくるので総数を調べる場合に便利。 startTime について、2014-01-01T00:00:00+09:00 形式で POST する必要があったが、+09:00 部分はなくても良かった。それが 2016年9月12日の営業時間帯頃から仕様が変わって、それが必須項目になり + をエンコードして %2d にして 2014-01-01T00:00:00%2d00:00 形式で POST すると今まで通りの時間で応答がある。そして、時間指定がおかしかったのが 9月27日 までに直った。2014-01-01T00:00:00%2d09:00 形式で指定する。 生放送の liveStatus について、past は放送終了状態。onair は getplayerstatus の start_time 以降状態。reserved は予約枠で放送開始前から getplayerstatus の open_time 以降を含み、start_time 前(開場の状態から本編が始まる前)までの状態。 動画 https://api.search.nicovideo.jp/api/v2/video/contents/search?q=初音ミク&targets=title&fields=contentId,title,description,tags,categoryTags,viewCounter,mylistCounter,commentCounter,startTime,thumbnailUrl&filters[viewCounter][gte]=1000000&_sort=-viewCounter&_offset=0&_limit=100&_context=apiguide 生放送 https://api.search.nicovideo.jp/api/v2/live/contents/search?q=%E3%82%A2%E3%83%8B%E3%83%A1%0d%0a&targets=tags&fields=contentId,title,start_time,live_end_time,comment_counter,score_timeshift_reserved,provider_type,tags,member_only,viewCounter,timeshift_enabled&_context=apiguide&filters%5BliveStatus%5D%5B0%5D=past&filters%5BstartTime%5D%5Bgte%5D=2008-01-01T00:00:00-09:00&filters%5BstartTime%5D%5Blt%5D=2030-04-01T00:00:00-09:00&_sort=-score_timeshift_reserved&_limit=100 静画(イラスト) https://api.search.nicovideo.jp/api/v2/illust/contents/search?q=デイリーパンツ&targets=tags&fields=contentId,title,description,tags,categoryTags,viewCounter,mylistCounter,commentCounter,startTime,thumbnailUrl&_sort=viewCounter&_context=apiguide 静画(マンガ) https://api.search.nicovideo.jp/api/v2/manga/contents/search?q=ワンパンマン&targets=tags&fields=contentId,title,description,tags,categoryTags,viewCounter,mylistCounter,commentCounter,startTime,thumbnailUrl&_sort=viewCounter&_context=apiguide 静画(書籍)、2017年10月4日に使えなくなった https://api.search.nicovideo.jp/api/v2/book/contents/search?q=の&targets=title&fields=contentId,title,description,tags,viewCounter,mylistCounter,commentCounter,startTime,thumbnailUrl&_sort=viewCounter&_context=apiguide チャンネル https://api.search.nicovideo.jp/api/v2/channel/contents/search?q=ゲーム&targets=title&fields=contentId,title,description,tags,startTime,thumbnailUrl,&_sort=startTime&_context=apiguide ブロマガ記事(著名人) https://api.search.nicovideo.jp/api/v2/channelarticle/contents/search?q=PS4&targets=title&fields=contentId,title,description,tags,mylistCounter,commentCounter,startTime,thumbnailUrl,&_sort=startTime&_context=apiguide ニュース(description,commentCounter が取得できなくなってた。2019年5月3日確認) https://api.search.nicovideo.jp/api/v2/news/contents/search?q=%E3%83%8E%E3%83%BC%E3%83%99%E3%83%AB%E8%B3%9E&targets=title&fields=contentId,title,tags,startTime&_sort=startTime&_context=apiguide ゲーム https://api.search.nicovideo.jp/api/v2/game/contents/search?q=アドベンチャー&targets=title&_context=apiguide&_sort=-startTime&fields=contentId,title,description,tags,startTime 権利楽曲 https://api.search.nicovideo.jp/api/v2/license_search/contents/search?q=孤独のグルメ&targets=title&_context=apiguide&_sort=-startTime&fields=contentId,title 動画マイリスト https://api.search.nicovideo.jp/api/v2/mylist_video/contents/search?q=初音ミク&targets=title&_context=apiguide&_sort=-startTime&fields=contentId,title,description,startTime まとめ(2019年5月22日廃止予定) https://api.search.nicovideo.jp/api/v2/summary/contents/search?q=RTA&fields=contentId,title,description,tags,startTime,thumbnailUrl&_sort=startTime&targets=title,tags&filters&_context=apiguide ニコニコミュニティ( データが入るのは2018年7月中の予定 ->2018年6月26日入ってた->2018年6月27日まだ全部入ってなかった) https://api.search.nicovideo.jp/api/v2/community/contents/search?q=RTA&targets=title,tags&fields=contentId,title,description,tags,startTime,thumbnailUrl&_sort=startTime&_context=apiguide 追記 2018年6月23日 「2018/03/05 検索対象のサービス に summary と community を追加」より、まとめとニコニコミュニティを追加した。 追記 2017年11月14日 「2017/10/04 検索対象のサービス から book を削除」とあるので削除した。 追記 2017年9月7日 ゲーム, 権利楽曲, 動画マイリスト の例を追加した。 追記 2017年5月20日 10番目のレス で教えてもらい API のドキュメントが新たに公開されていたのを追加した。 追記 2017年3月17日 「新検索β」終了のお知らせ|ニコニコインフォ より新検索ベータのウェブ上での検索が出来なくなったが、同時に以下のドキュメントのページも削除されトップページにリダイレクトされるようになった。 追記 2016年9月30日 startTime の仕様変更について。 追記 2019年1月5日 liveStatus の詳細を調べた。
ニコラボチャンネル のブログ
ニコニコの新機能解説や独自検証、動画や生放送等の各サービスの遊び方。

ユーザーが作った便利なツールや外部サイトの使い方を紹介します。