/jikanjs

A wrapper for the unofficial MAL API jikan.moe (v4)

Primary LanguageJavaScript

GitHub Workflow Status Known Vulnerabilities

JikanJS

this is a v4 version of zuritor's jikanjs

Installation

npm install @mateoaranda/jikanjs --save

wrapped jikan Features

wrapped MAL Features

Usage

const jikanjs = require('@mateoaranda/jikanjs');

Modify API URL

It is possible to change the API Base URL

jikanjs.settings.setBaseURL('apiurl'); // sets the API Base URL

API Methods

  • All API functions are promised Based
  • Information of all possible parameters are located at the documentation
jikanjs.loadAnime(id [, request [, parameters]])
jikanjs.loadCharacter(id [, request])
jikanjs.loadClub(id [, request [, page]])
jikanjs.loadGenres(type [, page [, limit [, filter]]])
jikanjs.loadMagazines([page])
jikanjs.loadManga(id [, request [, page]])
jikanjs.loadPerson(id [, request])
jikanjs.loadProducers([page])
jikanjs.loadRandom(type)
jikanjs.loadRecommendations(type [, page])
jikanjs.loadReviews(type [, page])
jikanjs.loadSchedule(day [, page [, limit]])
jikanjs.loadUser(username [, request [, page]])
jikanjs.loadAnimelist(username [, limit [, offset]])
jikanjs.loadMangalist(username [, limit [, offset]])
jikanjs.loadSeason(year, season [, page])
jikanjs.loadSeasonArchive()
jikanjs.loadCurrentSeason([page])
jikanjs.loadUpcomingSeason([page])
jikanjs.loadTop(type [, page [, subtype [, filter]]])
jikanjs.search(type, query [, limit [, parameters]])
jikanjs.raw(urlParts [, queryParameters [, mal]])

Examples

loadAnime(id [, request [, parameters]])

id: Anime ID
request: full, characters, staff, episodes, news, forum, videos, videosepisodes, pictures, statistics, moreinfo, recommendations, userupdates, reviews, relations, themes, external
parameters: query parameters, check the docs for more info

await jikanjs.loadAnime(31240); // Anime Information
await jikanjs.loadAnime(31240, 'episodes'); // All Episodes
await jikanjs.loadAnime(31240, 'episodes', 15); // Episode 15
await jikanjs.loadAnime(31240, 'forum', { filter: 'episode' });

loadCharacter(id [, request])

id: Character ID
request: full, anime, manga, voices, pictures

await jikanjs.loadCharacter(118737); // Character information
await jikanjs.loadCharacter(118737, 'pictures'); // Character pictures

loadClub(id [, request [, page]])

id: Club ID
request: members, staff, relations
page: Page number, available on members request, default: 1

await jikanjs.loadClub(73113); // Club information
await jikanjs.loadClub(73113, 'members', 10); // 10th Page of this club members

loadGenres(type [, filter])

type: either anime or manga
filter: genres, explicit_genres, themes, demographics

await jikanjs.loadGenres('anime'); // All anime genres
await jikanjs.loadGenres('manga', 'explicit_genres'); // Manga explicit genres

loadMagazines([page])

page: Page Number, default: 1

await jikanjs.loadMagazines(); // Magazines collection

loadManga(id [, request [, page]])

id: Manga ID
request: full, characters, news, forum, pictures, statistics, moreinfo, recommendations, userupdates, reviews, relations, external
page: Page Number, available on news userupdates reviews requests

await jikanjs.loadManga(74697); // Manga information
await jikanjs.loadManga(74697, 'reviews', 1); // First page of reviews

loadPerson(id [, request])

id: Person ID
request: full, anime, voices, manga, pictures

await jikanjs.loadPerson(34785); // Person information
await jikanjs.loadPerson(34785, 'voices'); // All Person's Voice Acting Roles

loadProducers([page])

page: Page Number, default: 1

await jikanjs.loadProducers(); // Producers collection

loadRandom(type)

type: anime, manga, characters, people, users

await jikanjs.loadRandom('anime'); // Some random anime

loadRecommendations(type [, page])

type: either anime or manga
page: Page Number, default: 1

await jikanjs.loadRecommendations('anime'); // First page of recent anime recommendations

loadReviews(type [, page])

type: either anime or manga
page: Page Number, default: 1
preliminary: Receive reviews tagged as preliminary? Default: false
spoiler: Receive reviews tagged as a spoiler? Default: false

await jikanjs.loadReviews('manga'); // First page of recent manga reviews

loadSchedule(day [, page [, limit]])

day: monday, tuesday, wednesday, thursday, friday, saturday, sunday, other, unknown
page: Page Number, default: 1
limit: Result limit number
kids: Filter entries with the Kids Genre, Default: false
sfw: Filter entries with the Hentai Genre, Default: false
unapproved: Include entries which are unapproved, Default: false

await jikanjs.loadSchedule('monday'); // Monday's anime schedule

loadUser(username [, request [, page]])

username: User's username
request: full, statistics, favorites, userupdates, about, history, friends, reviews, recommendations, clubs, external
page: Page number, available on friends reviews recommendations clubs requests

await jikanjs.loadUser('pepito'); // Profile information
await jikanjs.loadUser('pepito', 'friends', 6); // 6th page of pepito's friends

loadAnimelist(username [, limit [, offset]])

username: User's Username
limit: Amount of elements to receive, Default: 1000
offset: Offset, Default: 0

await jikanjs.loadAnimelist('pepito'); // pepito's animelist

loadMangalist(username [, limit [, offset]])

username: User's Username
limit: Amount of elements to receive, Default: 1000
offset: Offset, Default: 0

await jikanjs.loadMangalist('pepito'); /// pepito's mangalist

loadSeason(year, season [, page])

year: Season Year (1970-Now)
season: winter, spring, summer, fall
page: Page Number, default: 1

await jikanjs.loadSeason(2021, 'fall'); // First page of Fall 2021 animes

loadSeasonArchive()

await jikanjs.loadSeasonArchive(); // Seasons collection

loadCurrentSeason([page])

page: Page Number, default: 1

await jikanjs.loadCurrentSeason(); // First page of the current season's animes

loadUpcomingSeason([page])

page: Page Number, default: 1

await jikanjs.loadUpcomingSeason(3); // Third page of next season's animes

loadTop(type [, page [, subtype [, filter]]])

type: anime, manga, people, characters, reviews
page: Page Number, default: 1 (25 items per page)
subtype:
⠀⠀anime: tv, movie, ova, special, ona, music, cm, pv, tv_special
⠀⠀manga: manga, novel, lightnovel, oneshot, doujin, manhwa, manhua
filter:
⠀⠀anime: airing, upcoming, bypopularity, favorite
⠀⠀manga: publishing, upcoming, bypopularity, favorite

await jikanjs.loadTop('anime'); // Top 25 animes
await jikanjs.loadTop('anime', 1, 'movie'); // First page of top anime movies

search(type, query [, limit [, parameters]])

type: anime, manga, people, characters, clubs
query: search term
limit: results limit number
parameters: extra query parameters, see docs for more info on this

await jikanjs.search('characters', 'Emilia', 1); // Search for a character named "Emilia"

(EXTRA) raw(urlParts [, queryParameters [, mal]])

urlParts: Array with api endpoint path, e.g. [anime, 1] to load the anime with the id of 1
queryParameters: query parameters, needs to be a key value pair like { page: 1 }
mal: Request to MAL API? Default: false

await jikanjs.raw(['anime', 1]); // Same as loadAnime(1);