mal-scrape
v1.1.0
Published
scrapes info from myanimelist
Downloads
7
Maintainers
Readme
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 = require("mal-scrape");
const client = new MAL();
// get the top anime from rank 51-100
client.topAnime({limit: 50})
.then(output => console.log(output));
// get the top manga and get the details of the number 1 ranked
client.topManga()
.then(output => output[0].getDetails())
.then(details => console.log(details));
// search for boku no in anime and get the second page
client.search("boku no", "anime", {show:50})
.then(data => console.log(data));
// get the details from the anime with the id 5114
client.getDetails(5114, "anime")
.then(details => console.log(details));
// get videos from topAnime or topManga
client.topAnime()
.then(anime => anime[0].getVideos())
.then(videos => console.log(videos));
// get images from searches
client.search("boku no")
.then(data => data[0].getImages())
.then(images => console.log(images));
there are more examples in the examples folder
todo list
- [x] get top list
- [x] get details page
- [x] get images from anime and manga
- [x] get videos from anime and manga
docs
Classes
Typedefs
MAL
the class that has all the functionality stuff
Kind: global class
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 |
maL.topAnime(options) ⇒ Promise.<Top>
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 |
maL.topManga(options) ⇒ Promise.<Top>
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 |
maL.top(type, options) ⇒ Promise.<Top>
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 |
maL.getDetails(id, type) ⇒ Promise.<Details>
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 |
maL.search(q, type, options) ⇒ Promise.<Array.<SearchItem>>
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 |
Posters : Object
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. |
TopInfo : Object
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. |
Top : Object
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. |
DetailsInformation : Object
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. |
DetailsStatistics : Object
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. |
Details : Object
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. |
SearchItem : Object
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. |