1.1.0 • Published 7 years ago

mal-scrape v1.1.0

Weekly downloads
7
License
MIT
Repository
github
Last release
7 years ago

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

  • get top list
  • get details page
  • get images from anime and manga
  • 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

ParamTypeDescription
prefixstrignit uses this in front of the request, you could use this to prevent cors errors in browsers
urlstringthe 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

ParamTypeDescription
optionsobjectthe 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

ParamTypeDescription
optionsobjectthe 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

ParamTypeDefaultDescription
typestring"anime"the type of the top list: anime or manga
optionsobjectthe 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

ParamTypeDefaultDescription
idnumberthe id of the anime or manga
typestring"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

ParamTypeDefaultDescription
qnumberthe query/search terms
typestring"anime"the type of the thing you want to search: anime or manga
optionsstringthe GET options to give to the page

Posters : Object

Kind: global typedef Properties

NameTypeDescription
srcstringthe src to the item of the top page.
srcsetObjectthe srcset of the item (an object with 2 sizes).
idstringthe picture id of the img.
bigstringthe poster in an big size.
hugestringthe poster in an huge size.

TopInfo : Object

Kind: global typedef Properties

NameTypeDescription
runtimestringthe runtime of the item.
membersnumberthe members of the item.
episodesnumberthe amount of episodes of an item.
typenumberthe type of an item. this is different from the other type.

Top : Object

Kind: global typedef Properties

NameTypeDescription
idnumberthe id of the item.
rankingnumberthe ranking of the item the list.
titlestringthe title of the item.
hrefstringthe link to the item.
scorenumberthe score of the item.
postersPostersthe poster of the item in different sizes.
typestringthe type of the item.
infoTopInfothe basic info of the item.
getDetailsfunctionreturns a Promise with the details.
getPicturesfunctionreturns a Promise with the pictures.
getPicsfunctionreturns a Promise with the pictures.
getImagesfunctionreturns a Promise with the pictures.
getVideosfunctionreturns a Promise with the videos.

DetailsInformation : Object

Kind: global typedef Properties

NameTypeDescription
typestringthe type of an item. this is different from the other type.
episodesstringthe amount of episodes of an item. this will become an int.
statusstringthe status of an item: finished airing and that kind of stuff.
airedstringfrom when to when it aired.
premieredstringwhen it premiered.
broadcaststringwhat day and time it broadcasts.
producersstringthe producers. this will become an array.
licensorsstringthe licensors. this will become an array.
studiosstringthe studios. this will become an array.
sourcestringthe source.
durationstringthe duration. how long an episode is.
ratingstringthe rating, pg-13 or something.

DetailsStatistics : Object

Kind: global typedef Properties

NameTypeDescription
scorestringthe scrore of the item.
rankedstringthe rank of the item.
popularitystringthe popularity of the item.
membersstringthe amount of members of the item.
favoritesstringthe amount of favorites of the item.

Details : Object

Kind: global typedef Properties

NameTypeDescription
titlestringthe title of the item.
typestringthe type of the item.
scorenumberthe score of the item.
ranknumberthe rank of the item.
popularitynumberthe popularity of the item.
membersnumberthe members of the item.
synopsisstringthe synopsis of the item.
posterstringthe poster of the item.
videoObjectthe video on the details page of the item. contains the href to the embeded youtube thing and a youtube video id.
hrefstringthe link to the items page.
alternativeTitlesObjectthe alternative titles of the item.
informationDetailsInformationdetailed info of the item.
statisticsDetailsStatisticsstatistics of the item
getPicturesfunctionreturns a Promise with the pictures.
getPicsfunctionreturns a Promise with the pictures.
getImagesfunctionreturns a Promise with the pictures.
getVideosfunctionreturns a Promise with the videos.

SearchItem : Object

Kind: global typedef Properties

NameTypeDescription
titlestringthe title of the item.
hrefstringthe link to the items page.
idnumberthe score of the item.
typestringthe type of the item.
synopsisstringa short synopsis of the item.
postersPostersdifferent sizes of the poster.
getPicturesfunctionreturns a Promise with the pictures.
getPicsfunctionreturns a Promise with the pictures.
getImagesfunctionreturns a Promise with the pictures.
getVideosfunctionreturns a Promise with the videos.
getDetailsfunctionreturns a Promise with the details.
1.1.0

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago