revolution / niconico
niconico api
Installs: 2 103
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: ^8.0
- ext-json: *
- ext-simplexml: *
- guzzlehttp/guzzle: ^7.0
Requires (Dev)
- mockery/mockery: ^1.3
- phpunit/phpunit: ^10.0
README
Requirements
PHP >= 8.0
実装済みAPI
自分で使う用なので必要なAPIのみ実装。
- getthumbinfo https://dic.nicovideo.jp/a/%E3%83%8B%E3%82%B3%E3%83%8B%E3%82%B3%E5%8B%95%E7%94%BBapi
- スナップショット検索API v2 https://site.nicovideo.jp/search-api-docs/snapshot
Install
Composer
composer require revolution/niconico
Usage
example1
<?php use Revolution\Niconico\Search; use Revolution\Niconico\Search\Query; $query = new Query(); $query->q = "初音ミク"; $query->targets = 'title,tags'; $query->_sort = "-viewCounter"; $query->filters(['filters[mylistCounter][gte]=10000', 'filters[commentCounter][gte]=100000']); $search = new Search(); // returns object $response = $search->search($query); // returns array $response = $search->search($query, true);
example2
<?php use Revolution\Niconico\Search\Query; $query = new Query([ 'q' => '初音ミク', 'targets' => 'title,tags', '_sort' => '-viewCounter', ]);
example3
<?php use Revolution\Niconico\Search\Query; $query = Query::create([ 'q' => '初音ミク', 'targets' => 'title,tags', '_sort' => '-viewCounter', ])->filters([]);
example4
<?php use Revolution\Niconico\ThumbInfo; $thumb = new ThumbInfo(); $thumb->get('sm9'); var_dump($thumb->video_id);//'sm9' var_dump($thumb->toJson()); var_dump($thumb->toArray()); var_dump($thumb->toSimpleObject());
example5
<?php use Revolution\Niconico\ThumbInfo; $thumb = new ThumbInfo('sm9');
エンドポイントが変更されたら
publicプロパティなので変更できる。
$search = new Search(); $search->endpoint = 'http...';
LICENSE
MIT
Copyright kawax