npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-mal-scrape

v1.1.0

Published

scrapes info from myanimelist

Downloads

6

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. |