anidbjs

2.4.4 • Public • Published

Node AniDB wrapper

Build Status dependency status dev dependency status License Downloads

npm badge

A minimalistic AniDB HTTP API wrapper for Node.js.

This module provides a very minimal interface to fetch data from anidb.net. You may want to read the guidelines in the anidb wiki first.

You need a client registered on AniDB to use this "lib".

Usage

The module exports a constructor function which accepts 2 objects - credentials and options as its only two arguments.

When consuming the response object, you're going to have to check for undefined in certain nested objects such as character.seiyuu and similar ¯\_(ツ)_/¯

Optional chaining might be helpful here.

Options

These are the available config options that are passed to the 2nd constructor argument.

{
  // `url` is the server baseURL that will be used for the request
  url: 'http://api.anidb.net:9001/httpapi', // default

  // the request timeout in milliseconds
  timeout: 5 * 1000, // default

  // proxy server url
  proxy: '192.168.1.1:9000',

  // any additional headers that you'd like to pass
  headers: {
    'User-Agent': 'my-cool-app/1.0.0'
  }
}

Example

const AniDb = require("anidbjs");
const client = new AniDb({ client: "myclient", version: 1 });

client
  .randomRecommendation()
  .then(res => console.log(res))
  .catch(err => console.error(err));

client
  .anime(1)
  .then(res => {
    res.characters.forEach(char =>
      console.log(char.seiyuu && char.seiyuu.name)
    );
  })
  .catch(err => console.error(err));

Readme

Keywords

Package Sidebar

Install

npm i anidbjs

Weekly Downloads

3

Version

2.4.4

License

MIT

Unpacked Size

334 kB

Total Files

26

Last publish

Collaborators

  • miraris