manytoon.com
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

Manytoon.com

License NPM downloads NPM version

Simple parser for Manytoon.

Installation

$ npm install manytoon.com

Usage

Require a library and... just use

const Manytoon = require('manytoon.com')
const parser = new Manytoon.Parser() 

async function testParser() {
    const girlPage = await parser.search('Girl')
    console.log(girlPage) //Returns a 60 doujins on page

    const simplePage = await parser.getHomepage()
    console.log(simplePage)

    const firstDoujin = simplePage[0]
    console.log(firstDoujin)

    const doujin = await parser.getDoujin('https://manytoon.com/comic/gu-hos-escape-mnt0015/')
    console.log(doujin);
}
testParser()

Classes

Parser

constructor()

Parameter Type Description Required
None any None false

Methods

.getDoujin(url)

Getting a doujin from manytoon.com URL

Parameter Type Description Required
url string URL for getting a doujin true

Example:

const Manytoon = require('manytoon.com')
const parser = new Manytoon.Parser() 

async function logDoujin() {
    const doujin = await parser.getDoujin()
    console.log(doujin)
}
logDoujin()

Returns: Promise<Doujin>

.getHomepage()

Get the homepage

Parameter Type Description Required
None any None false

Example:

const Manytoon = require('manytoon.com')
const parser = new Manytoon.Parser() 

async function logHome() {
    const page = await parser.getHomepage()
    console.log(page)
}
logHome()

Returns: Promise<Page<Doujin>>

.search(target)

Do search doujins from name

Parameter Type Description Required
target string Name for searching true

Example:

const Manytoon = require('manytoon.com')
const parser = new Manytoon.Parser() 

async function logFound() {
    const page = await parser.search('girl')
    console.log(page)
}
logFound()

Returns: Promise<Page<Doujin>>


Page

constructor(options)

Parameter Type Description Required
options object Options for creating page true
options.html string HTML text true
options.isHome boolean Is homepage or not true
options.lastPage number Number of last page true
options.target string Search target false
options.doujins Array<Doujin> Doujins' Array true

Methods

.to(page)

Returns the page by its number

Parameter Type Description Required
page number Page number true

Example:

const Manytoon = require('manytoon.com')
const parser = new Manytoon.Parser() 

async function logPage() {
    const page = await parser.getHomepage()
    console.log(await page.to(4))
}
logPage()

Returns: Promise<Page<Doujin>>

.next()

Returns the next page

Parameter Type Description Required
None any None false

Example:

const Manytoon = require('manytoon.com')
const parser = new Manytoon.Parser() 

async function loSecondgPage() {
    const page = await parser.getHomepage()
    console.log(await page.next())
}
logSecondPage()

Returns: Promise<Page<Doujin>>

.prev()

Returns the previous page

Parameter Type Description Required
None any None false

Example:

const Manytoon = require('manytoon.com')
const parser = new Manytoon.Parser() 

async function loSecondgPage() {
    const page = await parser.getHomepage()
    const threerdPage = await page.to(3)
    console.log(threerdPage.prev())
}
logSecondPage()

Returns: Promise<Page<Doujin>>

.getCurrentPageNumber()

Returns the current page

Parameter Type Description Required
None any None false

Example:

const Manytoon = require('manytoon.com')
const parser = new Manytoon.Parser() 

async function logSecondgPage() {
    const page = await parser.getHomepage()
    const secondPage = await page.next()
    console.log(secondPage.getCurrentPageNumber())
}
logSecondPage()

Returns: number

.getLastPageNumber()

Returns the current page

Parameter Type Description Required
None any None false

Example:

const Manytoon = require('manytoon.com')
const parser = new Manytoon.Parser() 

async function logLastPageNumber() {
    const page = await parser.getHomepage()
    console.log(secondPage.getLastPage())
}
logLastPageNumber()

Returns: number


Doujin

constructor(html, url, statusCode)

Parameter Type Description Required
html string None true
url string None true
statusCode number None true

Properties

const statusCode: number;
const name: string;
const rating: string;
const totalVotes: string;
const rank: string;
const montlyViews: string;
const status: string;
const releaseYear: string;
const genres: string[];
const url: string;
const img: string;

Methods

.getAllChapters()

Returns all chapters

Parameter Type Description Required
None any None false

Example:

const Manytoon = require('manytoon.com')
const parser = new Manytoon.Parser() 

async function logAllChapters() {
    const page = await parser.getHomepage()
    console.log(await parser[0].getAllChapters())
}
logAllChapters()

Returns: Array<string>

.getLastChapter()

Getting a last chapter

Parameter Type Description Required
None any None false

Example:

const Manytoon = require('manytoon.com')
const parser = new Manytoon.Parser() 

async function logLastChapter() {
    const page = await parser.getHomepage()
    console.log(await parser[0].getLastChapter())
}
logLastChapter()

Returns: string

.getFirstChapter()

Getting a last chapter

Parameter Type Description Required
None any None false

Example:

const Manytoon = require('manytoon.com')
const parser = new Manytoon.Parser() 

async function logFirstChapter() {
    const page = await parser.getHomepage()
    console.log(await parser[0].getFirstChapter())
}
logFirstChapter()

Returns: string


Support

Discord Server


License

MIT License

Copyright © Crafting1i

Package Sidebar

Install

npm i manytoon.com

Weekly Downloads

5

Version

1.1.0

License

MIT

Unpacked Size

38.3 kB

Total Files

19

Last publish

Collaborators

  • crafting1i