mal-scrape
scrapes info from myanimelist
installation
npm install --save mal-scrape
usage
when there is a function that takes options give it an Object with the uri GET params you want to give it, example:
client.topAnime({limit: 50})
will become:
https://myanimelist.net/topanime.php?limit=50
const MAL = ;const client = ; // get the top anime from rank 51-100client ; // get the top manga and get the details of the number 1 rankedclient ; // search for boku no in anime and get the second pageclient ; // get the details from the anime with the id 5114client ; // get videos from topAnime or topMangaclient ; // get images from searchesclient ;
there are more examples in the examples folder
todo list
- get top list
- get details page
- get images from anime and manga
- get videos from anime and manga
docs
Classes
- MAL
the class that has all the functionality stuff
Typedefs
- Posters :
Object
- TopInfo :
Object
- Top :
Object
- DetailsInformation :
Object
- DetailsStatistics :
Object
- Details :
Object
- SearchItem :
Object
MAL
the class that has all the functionality stuff
Kind: global class
- MAL
- new MAL(prefix, url)
- .topAnime(options) ⇒
Promise.<Top>
- .topManga(options) ⇒
Promise.<Top>
- .top(type, options) ⇒
Promise.<Top>
- .getDetails(id, type) ⇒
Promise.<Details>
- .search(q, type, options) ⇒
Promise.<Array.<SearchItem>>
new MAL(prefix, url)
constructor, instantiates the object
Param | Type | Description |
---|---|---|
prefix | strign |
it uses this in front of the request, you could use this to prevent cors errors in browsers |
url | string |
the base url to use, default: https://myanimelist.net |
Promise.<Top>
maL.topAnime(options) ⇒ get 50 of the top anime
Kind: instance method of MAL
Returns: Promise.<Top>
- - a promise with the data
Param | Type | Description |
---|---|---|
options | object |
the GET options to give to the page |
Promise.<Top>
maL.topManga(options) ⇒ get 50 of the top manga
Kind: instance method of MAL
Returns: Promise.<Top>
- - a promise with the data
Param | Type | Description |
---|---|---|
options | object |
the GET options to give to the page |
Promise.<Top>
maL.top(type, options) ⇒ get a top 50
Kind: instance method of MAL
Returns: Promise.<Top>
- - a promise with the data
Param | Type | Default | Description |
---|---|---|---|
type | string |
"anime" |
the type of the top list: anime or manga |
options | object |
the GET options to give to the page |
Promise.<Details>
maL.getDetails(id, type) ⇒ get the details of an anime or manga
Kind: instance method of MAL
Returns: Promise.<Details>
- - a promise with the data
Param | Type | Default | Description |
---|---|---|---|
id | number |
the id of the anime or manga | |
type | string |
"anime" |
the type of the thing you want the details from: anime or manga |
Promise.<Array.<SearchItem>>
maL.search(q, type, options) ⇒ search for anime or manga, might also work for other things but I didn't test that
Kind: instance method of MAL
Returns: Promise.<Array.<SearchItem>>
- - a promise with the data
Param | Type | Default | Description |
---|---|---|---|
q | number |
the query/search terms | |
type | string |
"anime" |
the type of the thing you want to search: anime or manga |
options | string |
the GET options to give to the page |
Object
Posters : Kind: global typedef Properties
Name | Type | Description |
---|---|---|
src | string |
the src to the item of the top page. |
srcset | Object |
the srcset of the item (an object with 2 sizes). |
id | string |
the picture id of the img. |
big | string |
the poster in an big size. |
huge | string |
the poster in an huge size. |
Object
TopInfo : Kind: global typedef Properties
Name | Type | Description |
---|---|---|
runtime | string |
the runtime of the item. |
members | number |
the members of the item. |
episodes | number |
the amount of episodes of an item. |
type | number |
the type of an item. this is different from the other type. |
Object
Top : Kind: global typedef Properties
Name | Type | Description |
---|---|---|
id | number |
the id of the item. |
ranking | number |
the ranking of the item the list. |
title | string |
the title of the item. |
href | string |
the link to the item. |
score | number |
the score of the item. |
posters | Posters |
the poster of the item in different sizes. |
type | string |
the type of the item. |
info | TopInfo |
the basic info of the item. |
getDetails | function |
returns a Promise with the details. |
getPictures | function |
returns a Promise with the pictures. |
getPics | function |
returns a Promise with the pictures. |
getImages | function |
returns a Promise with the pictures. |
getVideos | function |
returns a Promise with the videos. |
Object
DetailsInformation : Kind: global typedef Properties
Name | Type | Description |
---|---|---|
type | string |
the type of an item. this is different from the other type. |
episodes | string |
the amount of episodes of an item. this will become an int. |
status | string |
the status of an item: finished airing and that kind of stuff. |
aired | string |
from when to when it aired. |
premiered | string |
when it premiered. |
broadcast | string |
what day and time it broadcasts. |
producers | string |
the producers. this will become an array. |
licensors | string |
the licensors. this will become an array. |
studios | string |
the studios. this will become an array. |
source | string |
the source. |
duration | string |
the duration. how long an episode is. |
rating | string |
the rating, pg-13 or something. |
Object
DetailsStatistics : Kind: global typedef Properties
Name | Type | Description |
---|---|---|
score | string |
the scrore of the item. |
ranked | string |
the rank of the item. |
popularity | string |
the popularity of the item. |
members | string |
the amount of members of the item. |
favorites | string |
the amount of favorites of the item. |
Object
Details : Kind: global typedef Properties
Name | Type | Description |
---|---|---|
title | string |
the title of the item. |
type | string |
the type of the item. |
score | number |
the score of the item. |
rank | number |
the rank of the item. |
popularity | number |
the popularity of the item. |
members | number |
the members of the item. |
synopsis | string |
the synopsis of the item. |
poster | string |
the poster of the item. |
video | Object |
the video on the details page of the item. contains the href to the embeded youtube thing and a youtube video id. |
href | string |
the link to the items page. |
alternativeTitles | Object |
the alternative titles of the item. |
information | DetailsInformation |
detailed info of the item. |
statistics | DetailsStatistics |
statistics of the item |
getPictures | function |
returns a Promise with the pictures. |
getPics | function |
returns a Promise with the pictures. |
getImages | function |
returns a Promise with the pictures. |
getVideos | function |
returns a Promise with the videos. |
Object
SearchItem : Kind: global typedef Properties
Name | Type | Description |
---|---|---|
title | string |
the title of the item. |
href | string |
the link to the items page. |
id | number |
the score of the item. |
type | string |
the type of the item. |
synopsis | string |
a short synopsis of the item. |
posters | Posters |
different sizes of the poster. |
getPictures | function |
returns a Promise with the pictures. |
getPics | function |
returns a Promise with the pictures. |
getImages | function |
returns a Promise with the pictures. |
getVideos | function |
returns a Promise with the videos. |
getDetails | function |
returns a Promise with the details. |