.com
ManytoonManytoon.
Simple parser for
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()
.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()
.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()
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()
.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()
.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()
.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()
.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
License
MIT License
Copyright © Crafting1i