mangadex-wrapper
v1.0.3
Published
Access to some Mangadex API endpoints. Supports mangadex api version 5.0.1
Downloads
13
Readme
Documentation for mangadex-wrapper (by @darkgoatie)
Information
This module supports the "GET" endpoints for mangadex.org api. It doesn't require authentication, and doesn't support authenticated features either. (yet.)
Getting Help/Reporting Bugs
Theoretically, you can report bugs in the github repository. However I am more active in discord. Join the discord support server instead. (I promise, no useless pings/notifications!)
Links
- Discord Server
- Github
- NPM
- Full Documentation
Examples
Get Manga by ID/Name
const md = new Mangadex();
let result = await md.fetchMangaByID("c52b2ce3-7f95-469c-96b0-479524fb7a1a");
console.log(result.title.en); // -> "Jujutsu Kaisen"
Get MangaID by name
const md = new Mangadex();
const mangaID = (
await md.fetchManga({
title: "Vagabond",
})
)[0].id;
console.log(mangaID); // -> "d1a9fdeb-f713-407f-960c-8326b586e6fd"
Get Chapters of Manga
const md = new Mangadex();
const manga = (
await md.fetchManga({
title: "Vagabond",
})
)[0]; // -> Manga
const chapters = await manga.getMangaFeed({
translatedLanguage: ["en"],
}); // -> Chapter[]
const chapterNames = chapters.map((ch) => {
return ch.title;
}); // -> Chapter Names: ["Sudden Storm", "Takezo", "Purple Haze"]
const chapterIDs = chapters.map((ch) => {
return ch.id;
}); // -> Chapter IDs: ["abcabc", "defdef", "ghighi"]
console.log(chapterNames); // -> ["Sudden Storm", "Takezo", "Purple Haze"]
Get Reader Pages of a chapter
/** Using same chapters object from previous example:
* chapters = Chapter[] */
const lowQualityPages = await chapters[0].getPages(true);
// -> returns array of low quality chapter page URLs (for data saving)
const standardPages = await chapters[0].getPages();
// -> returns array of standard quality chapter page URLs
Get Chapters by name
const md = new Mangadex();
let chapters = await md.fetchChapters({
title: "Shinjuku Showdown",
translatedLanguage: ["en"],
}); // -> Chapter[]
console.log(chapters[0].id); // -> ID of a chapter
I believe that these examples will be enough for you to grasp the general concept of the package. Feel free to check out the class members and properties to be informed about all features.