MyAnimeList
A simple wrapper for MyAnimeList api v2
Table of contents
Installation
# with npm
$ npm install myanimelist.net
# or with Yarn
$ yarn add myanimelist.net
Documentation
new MyAnimeList(token)
-
token
- token for authorization of requests (Required)
Anime
getAnime(search, resultLimit)
Search anime by name
-
search
- string that will be queried in the api (Required) -
resultLimit
- amout of results (Default value: 4)
getAnimeById(id, fields)
Get anime by id
-
id
- anime id (Required) -
fields
- an array that contains the returns fields (Optional)
getAnimeRanking(type, resultLimit)
Anime list by ranking
-
type
- anime type (Required)- types:
all | airing | upcoming | tv | ova | movie | special | bypopularity | favorite
- types:
-
resultLimit
- amout of results (Default value: 4)
getAnimeBySuggestion(resultLimit)
Suggest anime
-
resultLimit
- amout of results (Default value: 4)
getAnimeBySeason(year, season, resultLimit)
Get seasonal anime
-
year
- anime year (Required) -
season
- seasonal (Required)- seasons:
winter | spring | summer | fall
- seasons:
-
resultLimit
- amout of results (Default value: 4)
Manga
getManga(search)
Search manga by name
-
search
- string that will be queried in the api (Required)
getMangaById(id, fields)
Get manga by id
-
id
- manga id (Required) -
fields
- an array that contains the returns fields (Optional)
getMangaRanking(type, resultLimit)
Manga list by ranking
-
type
- manga type (Required)- types:
all | manga | oneshots | doujin | lightnovels | novels | manhwa | manhua | bypopularity | favorite
- types:
-
resultLimit
- amout of results (Default value: 4)
Example
const MyAnimeList = require('myanimelist.net')
const mal = new MyAnimeList('your-token')
mal.getMangaById(2)
.then(console.log)
.catch(console.error)
Returns
{
"id": 2,
"title": "Berserk",
"main_picture": {
"medium": "https:\/\/api-cdn.myanimelist.net\/images\/manga\/1\/157931.jpg",
"large": "https:\/\/api-cdn.myanimelist.net\/images\/manga\/1\/157931l.jpg"
}
}