New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

hakuneko

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hakuneko

Scraper for manga websites

0.1.12
Version published
Weekly downloads
29
61.11%
Maintainers
1
Weekly downloads
 
Created

General

HakuNeko provides parsers to access mangas/animes from some selected websites.

Include the module:

var hakuneko = require( 'hakuneko' );

Mangas and animes sharing the same structures, but are slightly different in their meanings. Chapters in a manga are equivalent to episodes in an anime. Some fields will be left blank, because they are not necessary for an anime episode. Pages in a chapter are equivalent to resolutions (qualities) for an anime episode.

Creating structures:

manga = hakuneko.base.createManga( 'Title', '/Manga/Mirai-Nikki', 'KissManga', [] );
chapter = hakuneko.base.createChapter( '[VOL]', '[NR]', 'Title', 'lang', 'scanlator', '/Manga/Mirai-Nikki/0?id=53068', [] );
page = hakuneko.base.createPage( '001', 'http://s.imgur.com/images/imgur-logo.svg' );
// add page to chapter
chapter.p.push( page );
// add chapter to manga
manga.c.push( chapter );
// dump manga
console.log( manga );

anime = hakuneko.base.createAnime( 'Title', '/Anime/Mirai-Nikki', 'KissAnime', [] );
episode = hakuneko.base.createEpisode( '', '[NR]', 'Title', 'lang', '', '/Anime/Mirai-Nikki/0?id=53068', [] );
quality = hakuneko.base.createResolution( '480p', 'http://s.imgur.com/images/imgur-logo.svg' );
// add quality to episode
episode.p.push( quality );
// add episode to anime
anime.c.push( episode );
// dump anime
console.log( anime );

Structures / members:

MemberMangaAnime
manga.mMedia type (always 'manga')Media type (always 'anime')
manga.oOrigin identifier (e.g. 'KissManga')Origin identifier (e.g. 'KissAnime')
manga.tTitleTitle
manga.uURL of originURL of origin
manga.cChapter list (array)Episode list (array)
chapter.vChapter volume-
chapter.nChapter numberEpisode number
chapter.tChapter titleEpisode title
chapter.gChapter Scanlator group-
chapter.lChapter language-
chapter.uURL of originURL of origin
chapter.pPage list (array)Resolution list (array)
page.nPage numberEpisode resolution identifier (e.g. '480p')
page.uURL to imageURL to video

Example (JSON representation):

{
  "m": "manga",
  "t": "Title",
  "u": "/Manga/Mirai-Nikki",
  "o": "KissManga",
  "c": [
    {
      "v": "[VOL]",
      "n": "[NR]",
      "t": "Title",
      "l": "lang",
      "g": "scanlator",
      "u": "/Manga/Mirai-Nikki/0?id=53068",
      "p": [
        {
          "n": "001",
          "u": "http://s.imgur.com/images/imgur-logo.svg"
        }
      ]
    }
  ]
}

KissManga

Get Mangas

Function to parse mangas from the website. Manga list is scattered over multiple website pages, where each page contains roughly 50 mangas.

  • Parameter is a callback function, that will be executed for each manga (error and manga object relayed as parameters).
  • Parameter is optional, the start page (website) that should be used [default=1].
  • Parameter is optional, the end page (website) that should be used [default=9999].
hakuneko.kissmanga.getMangas( function( error, manga ) {
    console.log( error, manga );
}, 1, 1 );

Get Chapters

Function to parse chapters from the website for the given manga. The manga could be a result from the getPages function.

  • Parameter is a callback function, that will be executed after all chapters have been acquired (error and chapters array relayed as parameters).
manga = hakuneko.base.createManga( 'Title', '/Manga/Mirai-Nikki', 'KissManga', [] );
hakuneko.kissmanga.getChapters( function( error, chapters ) {
    if( !error ) {
        manga.c = chapters; // assign chapters to manga
    }
    console.log( error, manga );
});

Get Pages

Function to parse pages from the website for the given chapter. The chapter could be a result from the getChapters function. NOTE: Aggressive download will trigger an re-captcha error, so add a delay between multiple calls!

  • Parameter is a callback function, that will be executed after all pages have been acquired (error and pages array relayed as parameters).
chapter = hakuneko.base.createChapter( '[VOL]', '[NR]', 'Title', 'lang', 'scanlator', '/Manga/Mirai-Nikki/0?id=53068', [] );
hakuneko.kissmanga.getPages( chapter, function( error, pages ){
    if( !error ) {
        chapter.p = pages; // assign pages to chapter
    }
    console.log( error, chapter );
});

KissAnime

NOTE: Website is region blocked, HakuNeko module will not work within blocked countries!

Get Animes

Function to parse animes from the website. Anime list is scattered over multiple website pages, where each page contains roughly 50 animes.

  • Parameter is a callback function, that will be executed for each anime (error and anime object relayed as parameters).
  • Parameter is optional, the start page (website) that should be used [default=1].
  • Parameter is optional, the end page (website) that should be used [default=9999].
hakuneko.kissanime.getAnimes( function( error, anime ) {
    console.log( error, anime );
}, 1, 1 );

FAQs

Package last updated on 13 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts