Search-nico-js

niconico API Client Library for JavaScript - unofficial

niconico API Client Library for JavaScript - unofficial

search-nico-js aims to provide a complete, asynchronous client library for the niconico Search API.

For API details and how to use promises, see the JavaScript Promises.

search-nico-js is an unofficial library.

niconico

niconico - http://www.nicovideo.jp/

API documentation

http://shoito.github.io/search-nico-js/doc/

Requirements

Support Promises

Can I use Promises?

Browser

Use a polyfill script tag:

<script src="https://www.promisejs.org/polyfills/promise-4.0.0.js"></script>

The global variable Promise becomes available after the above script tag.

Installation

Node.js

npm install search-nico-js --save

Browser

bower install search-nico-js --save

or clone the repository or just copy the files search-nico.js or search-nico.min.js to your server.

and then include it in your pages with <script src="search-nico.min.js"></script>

Examples

Code

var cs = SearchNico.contents({
    'issuer': 'search-nico-js',
    'reason': 'html5jc'
});

var csPromise = cs.service('video')
                    .keyword('hoge')
                    .target(['title','description','tags'])
                    .filter([
                        cs.equalFilter('ppv_type', 'free'),
                        cs.rangeFilter('view_counter', '100', '1000', true, false)
                    ])
                    .sort('view_counter', 'asc')
                    .select(['cmsid','title','description','view_counter','mylist_counter'])
                    .from(0)
                    .size(5)
                    .fetch();

csPromise.then(function(result) {
    console.log(result);
}, function(err) {
    console.error(err);
});

See also

License

MIT License - http://opensource.org/licenses/MIT