Skip to content

Commit b5fd272

Browse files
committed
publish source mangadex, update readme
1 parent 0b49d80 commit b5fd272

6 files changed

Lines changed: 14 additions & 15 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ The manga-lib currently supports the following manga websites (updating):
6464

6565
- asurascans
6666

67+
- mangadex
68+
6769
## Contributing
6870

6971
Contributions are welcome! If you find any issues or would like to suggest enhancements, please submit a pull request or open an issue in the GitHub repository.

dist/src/constants/manga.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ export declare enum MangaType {
22
NETTRUYEN = "nettruyen",
33
TOONILY = "toonily",
44
ASURASCANS = "asurascans",
5-
BLOGTRUYEN = "blogtruyen"
5+
BLOGTRUYEN = "blogtruyen",
6+
MANGADEX = "mangadex"
67
}

dist/src/constants/manga.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ var MangaType;
77
MangaType["TOONILY"] = "toonily";
88
MangaType["ASURASCANS"] = "asurascans";
99
MangaType["BLOGTRUYEN"] = "blogtruyen";
10+
MangaType["MANGADEX"] = "mangadex";
1011
})(MangaType = exports.MangaType || (exports.MangaType = {}));

dist/src/lib/blogtruyen.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,6 @@ class Blogtruyen {
9696
url = url !== undefined ? url : '';
9797
path = path !== undefined ? path : '';
9898
const _page = yield (yield this.browser).newPage();
99-
yield _page.setRequestInterception(true);
100-
_page.on('request', (req) => {
101-
if (req.resourceType() !== 'document')
102-
req.abort();
103-
else
104-
req.continue();
105-
});
10699
yield _page.goto(url_chapter);
107100
const content = yield _page.$('#readonline > section');
108101
const title = (0, validate_1.not_null)(yield _page.$eval('#readonline > header > h1', (el) => el.textContent));
@@ -203,8 +196,6 @@ class Blogtruyen {
203196
last_update: (0, validate_1.not_null)(last_update),
204197
};
205198
})));
206-
const rate = 'N|A';
207-
const rate_number = 'N|A';
208199
const follows = (0, validate_1.not_null)(yield content.$eval('#LikeCount', (el) => el.textContent));
209200
return {
210201
title: (0, validate_1.not_null)(title).trim(),
@@ -214,8 +205,6 @@ class Blogtruyen {
214205
status: (0, validate_1.not_null)(status).trim(),
215206
genres,
216207
views: (0, validate_1.not_null)(views),
217-
rate,
218-
rate_number,
219208
follows,
220209
chapters,
221210
};
@@ -231,7 +220,7 @@ class Blogtruyen {
231220
else
232221
req.continue();
233222
});
234-
yield _page.goto(`${this.baseUrl}${page > 1 ? `/?page=${page}` : ``}`);
223+
yield _page.goto(`${this.baseUrl}${page > 1 ? `/page-${page}` : ``}`);
235224
const element = yield _page.$$('#wrapper > section.main-content > div > div:nth-child(1) > section.list-mainpage > div:nth-child(1) > div > div');
236225
const totalPage = parseInt((0, validate_1.not_null)(yield _page.$eval('#wrapper > section.main-content > div > div:nth-child(1) > section.list-mainpage > div:nth-child(2) > div > nav > ul > li:last-child > a', (el) => el.getAttribute('href'))).split('/page-')[1]);
237226
return {
@@ -251,7 +240,7 @@ class Blogtruyen {
251240
return {
252241
_id: i,
253242
title: (0, validate_1.not_null)(link.title),
254-
href: 'https://blogtruyen.vn' + (0, validate_1.not_null)(link.href),
243+
href: this.baseUrl + (0, validate_1.not_null)(link.href),
255244
image_thumbnail: image_thumbnail.startsWith('//')
256245
? `https:${image_thumbnail}`
257246
: image_thumbnail,

dist/src/lib/manga.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const nettruyen_1 = require("../lib/nettruyen");
66
const asurascans_1 = require("./asurascans");
77
const blogtruyen_1 = require("./blogtruyen");
88
const toonily_1 = require("./toonily");
9+
const mangadex_1 = require("./mangadex");
910
class Manga {
1011
constructor() { }
1112
build(type, params) {
@@ -30,6 +31,11 @@ class Manga {
3031
? params.baseUrl
3132
: 'https://blogtruyen.vn');
3233
}
34+
case manga_1.MangaType.MANGADEX: {
35+
return new mangadex_1.Mangadex(params !== undefined && params.baseUrl !== undefined
36+
? params.baseUrl
37+
: 'https://mangadex.org');
38+
}
3339
default: {
3440
return new nettruyen_1.Nettruyen('https://www.nettruyenmax.com');
3541
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "manga-lib",
33
"author": "Nhan Nguyen",
4-
"version": "1.0.52",
4+
"version": "1.1.1",
55
"license": "MIT",
66
"description": "A library for scraping manga from various websites.",
77
"repository": "https://github.com/zcrossoverz/manga-lib",

0 commit comments

Comments
 (0)