PHPackages                             128na/niconico-rest-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. 128na/niconico-rest-client

AbandonedArchivedLibrary[HTTP &amp; Networking](/categories/http)

128na/niconico-rest-client
==========================

niconico rest client

2.0.1(3y ago)120[5 PRs](https://github.com/128na/niconico-rest-client/pulls)MITPHP

Since Mar 7Pushed 1y ago1 watchersCompare

[ Source](https://github.com/128na/niconico-rest-client)[ Packagist](https://packagist.org/packages/128na/niconico-rest-client)[ RSS](/packages/128na-niconico-rest-client/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (7)Versions (12)Used By (0)

NicoNicoRestClient
==================

[](#niconicorestclient)

ニコニコ動画の各種API的な何かを使ってデータ取得するライブラリ。 ログイン（セッション）不要のもののみ対応。

install
-------

[](#install)

```
composer require 128na/niconico-rest-client

```

Usage
-----

[](#usage)

```
use NicoNicoRestClient\ClientFactory;
use NicoNicoRestClient\ApiSnapshot\Query;

$client = ClientFactory::create();

$query = new Query(['q'=> 'test']);
$result = $client->apiSnapshotSearch($query);
echo $result->statusOk() ? 'ok' : 'fail';

$videos = $result->getVideos();

foreach($videos as $video) {
    echo $video->getTitle() . PHP_EOL;
}

```

With custom http client
-----------------------

[](#with-custom-http-client)

`Symfony\Contracts\HttpClient\HttpClientInterface` を実装しているクライアントであれば利用できます。

キャッシュ機能付きのクライアントを使用する例

```
use Symfony\Component\HttpClient\CachingHttpClient;
use Symfony\Component\HttpClient\HttpClient;
use Symfony\Component\HttpKernel\HttpCache\Store;

$store = new Store('/path/to/cache/storage/');
$httpClient = HttpClient::create();
$cachingHttpClient = new CachingHttpClient($httpClient, $store);

$client = ClientFactory::create($cachingHttpClient);

```

Supported APIs
==============

[](#supported-apis)

Public APIs
-----------

[](#public-apis)

公式から提供されているもの。

### スナップショットAPI

[](#スナップショットapi)

```
https://api.search.nicovideo.jp/api/v2/snapshot/video/contents/search

```

```
// クエリパラメーターを直接指定可能
$query = new Query(['q'=> 'test']);
// setメソッドでの設定も可能
$quert->setLimit(10);

$result = $client->apiSnapshotSearch($query);
echo $result->statusOk() ? 'ok' : 'fail';

$videos = $result->getVideos();

foreach($videos as $video) {
    echo $video->getTitle() . PHP_EOL;
}

```

Private APIs
------------

[](#private-apis)

公式には記載されていないがログイン不要なもの。動作保証外。

非公開だけど廃止時にアナウンスされる（やさしい

### ExtApi(getthumbinfo)

[](#extapigetthumbinfo)

動画単体の情報を取得可能。

```
https://ext.nicovideo.jp/api/getthumbinfo/***

```

```
$videoResult = $client->apiExtGet('sm0');

```

### CeApi

[](#ceapi)

```
https://api.ce.nicovideo.jp/api/v1/user.info?__format=json&user_id=2
https://api.ce.nicovideo.jp/nicoapi/v1/video.info?__format=json&v=***
https://api.ce.nicovideo.jp/nicoapi/v1/video.array?__format=json&v=***,***
https://api.ce.nicovideo.jp/nicoapi/v1/mylistgroup.get?__format=json&group_id=***
https://api.ce.nicovideo.jp/nicoapi/v1/mylist.list?__format=json&group_id=***&limit=50&from=0
https://api.ce.nicovideo.jp/nicoapi/v1/user.myvideo?__format=json&user_id=***

```

※group\_id=mylist\_id

```
$userResult = $client->userInfo($userId);
$videoResult = $client->apiCeVideoInfo('sm0');
$videosResult = $client->apiCeVideoArray(['sm0', 'sm1']);
$mylistResult = $client->apiCeMylistGroup($mylistId);
$videosResult = $client->apiCeMylistList($mylistId, $page);
$videosResult = $client->userMyVideo($userId, $page);

```

その他
---

[](#その他)

APIではないがデータ取得可能なもの。

### Rss

[](#rss)

```
https://www.nicovideo.jp/user/***/video?rss=atom
https://www.nicovideo.jp/user/***/mylist/***?rss=atom

```

```
$videosResult = $client->rssUser($userId, $page);
$videosResult = $client->rssUserMylist($userId, $mylistId, $page);
$videosResult = $client->rssMylist($mylistId, $page);

```

- Web

シリーズを取得出来る方法がなかったので無理やる作った感。

```
https://sp.nicovideo.jp/series/***

```

```
$videosResult = $client->webSeries($seriesId);

```

### Video fields

[](#video-fields)

API仕様によりできるフィールドが異なるため注意。

項目名MethodSnapshotExtRssCeCeWeb説明APIslistgetuserMylist, mylist, uservideoInfovideoArray, mylistGroup, mylistList, userMyVideoseries動画IDgetContentIdcontentIdvideo\_id〇video.idvideo.id\[data-watch\_id\]再生ページURLgetWatchUrl〇watch\_url[link.@attributes.href](mailto:link.@attributes.href)〇〇\[data-video\_url\]動画タイトルgetTitletitletitletitletitletitle\[data-title\]動画説明文getDescriptiondescriptiondescription〇descriptiondescription×サムネイルURLgetThumbnailUrlthumbnailUrlthumbnail\_url[media\_thumbnail.@attributes.url](mailto:media_thumbnail.@attributes.url)video.thumbnail\_urlvideo.thumbnail\_url\[data-original\]投稿日時getStartTimestartTimefirst\_retrievepublishedvideo.first\_retrievevideo.first\_retrieve.video-item-date (時刻無し、日付のみ)再生時間（h:i:s）getLengthString〇length×〇〇〇60分未満はi:s再生時間（秒）getLengthSecondslengthSeconds〇×video.length\_in\_secondsvideo.length\_in\_seconds\[data-video\_length\]再生数getViewCounterviewCounterview\_counter×video.view\_countervideo.view\_counter\[data-view\_counter\]コメント数getCommentCountercommentCountercomment\_num×video.length\_in\_secondsvideo.length\_in\_seconds\[data-comment\_counter\]マイリスト数getMylistCountermylistCountermylist\_counter×video.mylist\_countervideo.mylist\_counter\[data-mylist\_counter\]いいね数getLikeCounterlikeCounter××××\[data-like\_counter\]最後のコメント日時getLastCommentTimelastCommentTime×××××最後のコメント本文getLastResBodylastResBodylast\_res\_body××××タグ一覧getTagstagstags.tag×tags.tag\_info.tag××ジャンル名getGenregenregenre×video.genre.labelvideo.genre.label×オーナータイプgetOwnerType〇〇×video.option\_flag\_communityvideo.option\_flag\_community\[data-owner\_type\]user or channelオーナーIDgetOwnerIduserId, channelIduser\_id, ch\_id×video.user\_id, video.community\_idvideo.user\_id, video.community\_id\[data-owner\_id\]オーナー名getOwnerName×user\_nickname, ch\_name×××\[data-owner\_name\]オーナーアイコンURLgetOwnerIconUrl×user\_icon\_url, ch\_icon\_url×××\[data-owner\_icon\_url\]オーナー詳細URLgetOwnerUrl×××××\[data-owner\_url\]サムネイル形式getThumbType×thumb\_type××××埋め込み可getEmbeddable×embeddable××××再生にログイン必須getNoLivePlay×no\_live\_play××××動画形式getMovieType×movie\_type××××flv,mp4など高画質容量getSizeHigh×size\_high××××bytes低画質容量getSizeLow×size\_low××××bytes動画説明文(HTML)getDescriptionHTML××content×××削除フラグgetDeleted×××video.deletedvideo.deleted×マイリストアイテムIDgetMylistItemId××××mylist.item\_id×mylistListのみマイリストアイテムの説明getMylistDescription××××mylist.description×mylistListのみマイリストアイテム登録日時getMylistCreateTime××××mylist.create\_time×mylistListのみ

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~3 days

Total

5

Last Release

1203d ago

Major Versions

1.0.2 → 2.0.02023-03-18

### Community

Maintainers

![](https://www.gravatar.com/avatar/0a83963d9cc94ce2686e424ed329b28434fd9b52306b954a4c962925a6370886?d=identicon)[128na](/maintainers/128na)

---

Top Contributors

[![128na](https://avatars.githubusercontent.com/u/15730241?v=4)](https://github.com/128na "128na (35 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/128na-niconico-rest-client/health.svg)

```
[![Health](https://phpackages.com/badges/128na-niconico-rest-client/health.svg)](https://phpackages.com/packages/128na-niconico-rest-client)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[drupal/drupal-extension

Drupal extension for Behat

22215.7M173](/packages/drupal-drupal-extension)[spatie/crawler

Crawl all internal links found on a website

2.8k18.5M67](/packages/spatie-crawler)[blackfire/player

A powerful web crawler and web scraper with Blackfire support

49617.1k](/packages/blackfire-player)[chameleon-system/chameleon-base

The Chameleon System core.

1028.6k5](/packages/chameleon-system-chameleon-base)[sproutcms/cms

Enterprise content management and framework

242.5k4](/packages/sproutcms-cms)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
