2.4.4 • Published 4 years ago

anidbjs v2.4.4

Weekly downloads
13
License
MIT
Repository
github
Last release
4 years ago

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));
2.4.3

4 years ago

2.4.2

4 years ago

2.4.4

4 years ago

2.4.1

7 years ago

2.4.0

7 years ago

2.3.3

7 years ago

2.3.2

7 years ago

2.3.1

7 years ago

2.3.0

7 years ago

2.2.2

7 years ago

2.2.1

7 years ago

2.2.0

7 years ago

2.1.0

7 years ago

2.0.4

7 years ago

2.0.3

7 years ago

2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.1.0

7 years ago

1.0.1

7 years ago