Skip to content

Latest commit

 

History

History
124 lines (109 loc) · 4.11 KB

mangahost.md

File metadata and controls

124 lines (109 loc) · 4.11 KB

MangaHost 🇧🇷

const mangahost = new MANGA.MangaHost();

Methods

search

Note: This method is a subclass of the BaseParser class. meaning it is available across most categories.

Parameters

Parameter Type Description
query string query to search for. (In this case, We're searching for punpun)
mangahost.search("punpun").then(data => {
  console.log(data);
})

returns a promise which resolves into an array of manga. (Promise<ISearch<IMangaResult[]>>)
output:

{
  results: [
      {
        id: 'oyasumi-punpun-mh34076',
        title: 'Oyasumi Punpun',
        image: 'https://img-host.filestatic3.xyz/mangas_files/oyasumi-punpun/image_oyasumi-punpun_xmedium.jpg',
        headerForImage: { Referer: 'https://mangahosted.com' }
      }
    ]
}

fetchMangaInfo

Parameters

Parameter Type Description
mangaId string manga id.(manga id can be found in the manga search results)
mangahost.fetchMangaInfo("oyasumi-punpun-mh34076").then(data => {
  console.log(data);
})

returns a promise which resolves into an manga info object (including the chapters). (Promise<IMangaInfo>)
output:

{
      id: 'oyasumi-punpun-mh34076',
      title: 'Oyasumi Punpun',
      altTitles: 'おやすみプンプンCompleto',
      description: 'Punpun é uma criança como todas as outras. Alegre e hiperativo, ele passa por muitos conflitos em sua vida, assim como qualquer outro ser humano. Essa é a história sobre a vida de Punpun, superando seus obstáculos e as adversidades que o mundo lhe traz.',
      headerForImage: { Referer: 'https://mangahosted.com' },
      image: 'https://img-host.filestatic3.xyz/mangas_files/oyasumi-punpun/image_oyasumi-punpun_full.jpg',
      genres: [
        'adulto',
        'comedia',
        'drama',
        'escolar',
        'psicologico',
        'seinen',
        'slice of life'
      ],
      status: 'Completed',
      views: 55498,
      authors: [ 'Asano Inio' ],
      chapters: [
        {
          id: '147',
          title: 'Capítulo #147 - Oyasumi Punpun',
          views: null,
          releasedDate: ''
        },
        {...}
      ]
    }

Note: The headerForImage property might be useful when getting the image to display.

fetchChapterPages

Parameters

Parameter Type Description
mangaId string manga id.(chapter id is the same one from the fetchMangaInfo function)
chapterId string chapter id.(chapter id can be found in the manga info)
mangahost.fetchChapterPages("oyasumi-punpun-mh34076/1").then(data => {
  console.log(data);
})

returns an array of pages. (Promise<IMangaChapterPage[]>)
output:

[
  {
      img: 'https://img-host.filestatic3.xyz/mangas_files/oyasumi-punpun/1/00.png',
      page: 0,
      title: 'Page 1',
      headerForImage: { Referer: 'https://mangahosted.com' }
  },
  {
      img: 'https://img-host.filestatic3.xyz/mangas_files/oyasumi-punpun/1/01-02.jpg',
      page: 1,
      title: 'Page 2',
      headerForImage: { Referer: 'https://mangahosted.com' }
  },
  {...}
]

(back to manga providers list)