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

maljs

v0.3.0

Published

Get anime and manga info from MyAnimeList

Downloads

26

Readme

maljs - MyAnimeList Scraper

maljs gets anime and manga information from MyAnimeList.net and neatly organizes it into classes.

Example

var mal = require('maljs');

// do a quick search
mal.quickSearch('lelouch').then(function(results) {
    // access and fetch the first character
    results.character[0].fetch().then(function(r) {
        // access and fetch the first anime
        r.animeography[0].fetch().then(function(r) {
            console.log(r);
        })
    });
});

outputs:

Title {
  mal: MyAnimeList { url: 'https://myanimelist.net' },
  type: 'anime',
  id: '1575',
  sn: 'Code_Geass__Hangyaku_no_Lelouch',
  path: '/anime/1575/Code_Geass__Hangyaku_no_Lelouch',
  fetched: true,
  title: 'Code Geass: Hangyaku no Lelouch',
  score: 8.83,
  ranked: 22,
  popularity: 6,
  members: 93,
  cover: 'https://myanimelist.cdn-dena.com/images/anime/5/50331.jpg',
  description: 'In the year 2010, the Holy Empire of Britannia is establishing itself as a dominant military nation, starting with the conquest of Japan. Renamed to Area 11 after its swift defeat, Japan has seen significant resistance against these tyrants in an attempt to regain independence.\r\n\r\nLelouch Lamperouge, exiled prince of Britannia, unfortunately finds himself caught in a crossfire between the two nations\' armed forces. He is able to escape, however, thanks to the timely appearance of a mysterious girl named C.C., who bestows upon him Geass, the "Power of Kings." Realizing the vast potential of his newfound "power of absolute obedience," Lelouch embarks upon a perilous journey as the masked vigilante known as Zero, leading a merciless onslaught against Britannia in order to get revenge once and for all.\r\n\r\n[Written by MAL Rewrite]',
  pictures:
   [ 'https://myanimelist.cdn-dena.com/images/anime/6/5856l.jpg',
     'https://myanimelist.cdn-dena.com/images/anime/10/18746l.jpg',
     'https://myanimelist.cdn-dena.com/images/anime/6/43639l.jpg',
     'https://myanimelist.cdn-dena.com/images/anime/5/49343l.jpg',
     'https://myanimelist.cdn-dena.com/images/anime/5/50331l.jpg',
     'https://myanimelist.cdn-dena.com/images/anime/13/63109l.jpg',
     'https://myanimelist.cdn-dena.com/images/anime/10/73246l.jpg' ],
  characters:
   [ Character {
       mal: [Object],
       id: '1111',
       sn: 'CC',
       path: '/character/1111/CC',
       fetched: false },
     Character {
       mal: [Object],
       id: '559',
       sn: 'Suzaku_Kururugi',
       path: '/character/559/Suzaku_Kururugi',
       fetched: false },
     Character {
       mal: [Object],
       id: '417',
       sn: 'Lelouch_Lamperouge',
       path: '/character/417/Lelouch_Lamperouge',
       fetched: false },
     ...
   ]
}

MyAnimeList

Promise(results) MyAnimeList.quickSearch(q [, type])

Searches and resolves with the results (unfetched):

{
    anime: [ Title, Title, ... ],
    manga: [ Title, Title, ... ],
    character: [ Character, Character, ... ]
}

type can be 'anime', 'manga', 'character' or 'all' (default)

Promise(results) MyAnimeList.getTopAnime()

Returns the top 50 anime (unfetched):

[ Title, Title, ... ]

Promise(results) MyAnimeList.getTopManga()

Returns the top 50 manga (unfetched):

[ Title, Title, ... ]

Character|Title MyAnimeList.getById(type, id)

Returns an object for the resource. Note: the resource is not validated! If it's invalid, .fetch will fail.

type should be one of "anime" || "manga" || "character"

You can, alternatively, use the helper functions:

MyAnimeList.getAnimeFromId(id);
MyAnimeList.getMangaFromId(id);
MyAnimeList.getCharacterFromId(id);

Title

Contains information about a manga or anime. The characters are unfetched. Once fetched, the object will be populated with the following information:

{
    type: 'anime' || 'manga',
    id: '1575',
    sn: 'Code_Geass__Hangyaku_no_Lelouch',
    path: '/anime/1575/Code_Geass__Hangyaku_no_Lelouch',
    fetched: true,
    fetched: true,
    title: 'Code Geass: Hangyaku no Lelouch',
    score: 8.83,
    ranked: 22,
    popularity: 6,
    members: 93,
    cover: 'https://myanimelist.cdn-dena.com/images/anime/5/50331.jpg',
    description: 'In the year 2010, the Holy Empire of Britannia...',
    pictures: [
        'https://myanimelist.cdn-dena.com/images/anime/6/5856l.jpg',
        ...
    ],
    characters: [ Character, Character, ... ]
}

Promise(self) Title.fetch()

Fetch all information about this title.

Character

Contains information about a character. Once fetched, the object will be populated with the following information:

{
    id: '417',
    sn: 'Lelouch_Lamperouge',
    path: '/character/417/Lelouch_Lamperouge',
    fetched: true,
    title: 'Lelouch "Lulu, Lelouch vi Britannia, Black Prince, Zero, King of Elevens" Lamperouge',
    cover: 'https://myanimelist.cdn-dena.com/images/characters/4/277146.jpg'
    description: 'Age: 17 (first season), 18 (second season) ...',
    animeography: [ Title, Title, ... ],
    mangaography: [ Title, Title, ... ],
    pictures: [
        'https://myanimelist.net/images/characters/16/80310.jpg',
        ...
    ]
}

Promise(self) Character.fetch()

Fetch all information about this character.