jikan-api
v0.1.6
Published
The unofficial Jikan API (v4) wrapper for the browser and node.js
Downloads
21
Maintainers
Readme
Jikan-api
Promise based Jikan API (v4) (unofficial MyAnimeList API) wrapper for the browser and node.js.
📋 Table of Contents
✏️ Todo
- Add data caching
- Add rate-limit
- Improve interfaces for Anime
- Add characters methods
- Add clubs methods
- Add genres methods
- Add magazines methods
- Add manga methods
- Add people methods
- Add producers methods
- Add random methods
- Add recommendations methods
- Add reviews methods
- Add schedules methods
- Add users methods
- Add seasons methods
- Add top methods
🗓 Features
- Uses Jikan API (v4)
- Supports TypeScript and JavaScript
- Supports Browser and Node.js (uses axios for requests)
🚀 Install
npm i jikan-api
yarn add jikan-api
🪄 Usage
Import
It depends on the type of your project.
ESModule import
import Jikan from 'jikan-api';
// or
import { Jikan } from 'jikan-api';
CommonJS require
const Jikan = require('jikan-api').default;
// or
const { Jikan } = require('jikan-api');
Modify API
It is possible to change API settings. (Documentation)
Jikan.settings.version = 4; // changes the API version
Jikan.settings.baseURL = 'https://api.jikan.moe'; // set the new API Base URL
API Methods
Information of all possible methods and their parameters are located in the package documentation.
All API functions are promised based
import Jikan from '@kny/jikan-api';
// Anime
Jikan.Anime.getAnime(1);
Jikan.Anime.getAnimeFull(1);
Jikan.Anime.getCharacters(1);
Jikan.Anime.getStaff(1);
Jikan.Anime.getEpisode(1);
Jikan.Anime.getEpisodes(1);
Jikan.Anime.getNews(1);
Jikan.Anime.getForum(1);
Jikan.Anime.getVideos(1);
Jikan.Anime.getVideoEpisodes(1);
Jikan.Anime.getPictures(1);
Jikan.Anime.getStatistics(1);
Jikan.Anime.getMoreInfo(1);
Jikan.Anime.getRecommendations(1);
Jikan.Anime.getUserUpdates(1);
Jikan.Anime.getReviews(1);
Jikan.Anime.getRelations(1);
Jikan.Anime.getThemes(1);
Jikan.Anime.getExternals(1);
Jikan.Anime.getStreaming(1);
Jikan.Anime.search('Cowboy Bebop');
More detailed information of all methods are located in the Jikan documentation.
Examples
To print details about "Hunter x Hunter" for example, you can do the following:
Async/Await
import Jikan from 'jikan-api';
const HUNTER_X_HUNTER_ID = 11061;
try {
const { data } = await Jikan.Anime.getAnime(HUNTER_X_HUNTER_ID);
console.log(data); // Hunter x Hunter details
} catch (err) {
console.error(err); // Error
}
Promise
import Jikan from 'jikan-api';
const HUNTER_X_HUNTER_ID = 11061;
Jikan.Anime.getAnime(HUNTER_X_HUNTER_ID)
.then(function ({ data }) {
console.log(data); // Hunter x Hunter details
})
.catch(function (err) {
console.error(err); // Error
});
⭐️ Maintainers
🛠 Contributing
Feel free to dive in! Open an issue or submit PRs.
Standard Readme follows the Contributor Covenant Code of Conduct.