bangumi
v1.2.1
Published
A simple Node.js client library for Bangumi REST API.
Downloads
14
Readme
A simple Node.js client library for legacy Bangumi REST API.
Installation
npm install bangumi --save
Getting Started
Setup API
const Bangumi = require('bangumi');
const bgm = new Bangumi({
access_token: "fill in your access token here"
});
How to get and refresh access token
This library currently does not handle token requests or renew. Please follow these steps to get your valid token.
Once you get a new token, it can be replaced live with
bgm.setAccessToken(your_token);
Examples of Usage
Set up custom promise library
bgm.setPromiseProvider(require('bluebird'));
Using promise
bgm.search('天元突破',{
responseGroup: 'small',
max_results:2,
start:1,
type:2
}).then(data => console.log(JSON.stringify(data))).catch(console.error);
Using callback
bgm.search('天元突破',{
responseGroup: 'small',
max_results:2,
start:1,
type:2
},function(err, data){
console.log(JSON.stringify(data));
});
Changelog
See Releases