npm.io
1.2.1 • Published 1 year ago

bangumi

Licence
Apache-2.0
Version
1.2.1
Deps
0
Size
87 kB
Vulns
0
Weekly
0
Stars
8

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

Documentation

See documentation site and Bangumi API official docs

Keywords