Skip to content

Latest commit

 

History

History
60 lines (51 loc) · 1.79 KB

README.md

File metadata and controls

60 lines (51 loc) · 1.79 KB

MangaKakalotScrapper

NPM

A scrapper for MangaKakalot

Documentation


Installation

yarn add mangakakalot-scrapper

Usage Examples

import { searchManga } from 'mangakakalot-scrapper'
;(async () => {
    //searches for manga
    const { data } = await searchManga(
        'Fairy Tail' /** name of the manga to search */,
        1 /** Page number of the search*/
    )
    const manga = data[0]
    //gets the details of the manga
    const details = await manga.getInfo()
    const chapters = details.chapters
    console.log(`${details.name} has ${chapters.length} chapters.`)
    const chapter = chapters[0]
    //gets the pages of the chapter
    const pages = await chapter.getPages()
    console.log(pages)
    //downloads the chapter pages and saves it in a folder
    await pages.download('Fairy Tail Ch-1') 
})()
import { getManga } from 'mangakakalot-scrapper'

//id of the manga from mangakakalot --> https://ww3.mangakakalot.tv/manga/manga-kw951979
const id = 'kw951979'
getManga(id)
    .then((res) => console.log(res))
    .catch((err) => console.error(err))
import { getChapterPages } from 'mangakakalot-scrapper'

//id of the chapter --> https://ww3.mangakakalot.tv/chapter/manga-kw951979/chapter-228
const id = 'kw951979/chapter-228'
getChapterPages(id)
    .then(async (res) => {
        console.log(res)
        //builds a PDF of the chapter pages and saves it
        await res.PDF('Nisekoi-228.pdf') //it will return a Buffer if no filename is provided
    })
    .catch((err) => console.error(err))