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

mal-api

v2.0.0

Published

A NodeJS wrapper for MyAnimeList API.

Downloads

13

Readme

mal-api

Build Status Coverage Status Dependency Status devDependency Status

A NodeJS wrapper for MyAnimeList API. For more more information you can check the API documentation of MyAnimeList.

Usage

Setup

npm install --save mal-api

Initialize

const MalApi = require('mal-api')

// Create a new instance of the module.
const mal = new MalApi({
  username, // The username of the user.
  password, // The password of the user.
})

Example usage

Account

verifyCredentials:

mal.account.verifyCredentials()
  .then(res => console.log(res))
  .catch(err => done(err))
Anime

searchAnime:

mal.manga.searchManga('naruto')
  .then(res => console.log(res))
  .catch(err => console.error(err))

[add,update,delete]Anime:

mal.anime.addAnime(1535, {
  score: 10
}).then(res => {
  console.log(res)
  return mal.anime.updateAnime(1535, {
    score: 10
  })
}).then(res => {
  console.log(res)
  return mal.anime.deleteAnime(1535)
}).then(res => console.log(res))
  .catch(err => console.error(err))
Manga

searchManga:

mal.manga.searchManga('naruto')
  .then(res => console.log(res))
  .catch(err => console.error(err))

[add,update,delete]Manga:

mal.manga.addManga(1535, {
  score: 10
}).then(res => {
  console.log(res)
  return mal.manga.updateManga(1535, {
    score: 10
  })
}).then(res => {
  console.log(res)
  return mal.manga.deleteManga(1535)
}).then(res => console.log(res))
  .catch(err => console.error(err))

Output

verifyCredentials:

{
  id: ['5928304'],
  username: ['ChrisAlderson']
}

searchAnime:

[{
  "id": "20",
  "title": "Naruto",
  "english": "Naruto",
  "synonyms": "NARUTO",
  "episodes": "220",
  "score": "7.81",
  "type": "TV",
  "status": "Finished Airing",
  "start_date": "2002-10-03",
  "end_date": "2007-02-08",
  "synopsis": "Moments prior to Naruto Uzumaki&#039s birth, a huge demon known as the Kyuubi, the Nine-Tailed Fox, attacked Konohagakure, the Hidden Leaf Village, and wreaked havoc. In order to put an end to the Kyuubi&#039s rampage, the leader of the village, the Fourth Hokage, sacrificed his life and sealed the monstrous beast inside the newborn Naruto.<br />\r\n<br />\r\nNow, Naruto is a hyperactive and knuckle-headed ninja still living in Konohagakure. Shunned because of the Kyuubi inside him, Naruto struggles to find his place in the village, while his burning desire to become the Hokage of Konohagakure leads him not only to some great new friends, but also some deadly foes.<br />\r\n<br />\r\n[Written by MAL Rewrite]",
  "image": "https://myanimelist.cdn-dena.com/images/anime/13/17405.jpg"
}]

searchManga:

[{
  "id": "11",
  "title": "Naruto",
  "english": "Naruto",
  "synonyms": "",
  "chapters": "700",
  "volumes": "72",
  "score": "8.13",
  "type": "Manga",
  "status": "Finished",
  "start_date": "1999-09-21",
  "end_date": "2014-11-10",
  "synopsis": "Before Naruto&#039s birth, a great demon fox had attacked the Hidden Leaf Village. A man known as the 4th Hokage sealed the demon inside the newly born Naruto, causing him to unknowingly grow up detested by his fellow villagers. Despite his lack of talent in many areas of ninjutsu, Naruto strives for only one goal: to gain the title of Hokage, the strongest ninja in his village. Desiring the respect he never received, Naruto works toward his dream with fellow friends Sasuke and Sakura and mentor Kakashi as they go through many trials and battles that come with being a ninja.",
  "image": "https://myanimelist.cdn-dena.com/images/manga/3/117681.jpg"
}]

add[Manga,Anime]:

Created

update[Manga,Anime]:

Updated

delete[Manga,Anime]:

Deleted

Testing

You can run tests with the following npm command:

 $ MAL_USER=[Your username] MAL_PASS=[Your password] npm test

License

MIT License

Copyright (c) 2017 - mal-api - Released under the MIT license.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.