Skip to content

Commit

Permalink
publish source mangadex, update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
zcrossoverz committed Jul 25, 2023
1 parent 0b49d80 commit b5fd272
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 15 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ The manga-lib currently supports the following manga websites (updating):

- asurascans

- mangadex

## Contributing

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.
3 changes: 2 additions & 1 deletion dist/src/constants/manga.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ export declare enum MangaType {
NETTRUYEN = "nettruyen",
TOONILY = "toonily",
ASURASCANS = "asurascans",
BLOGTRUYEN = "blogtruyen"
BLOGTRUYEN = "blogtruyen",
MANGADEX = "mangadex"
}
1 change: 1 addition & 0 deletions dist/src/constants/manga.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ var MangaType;
MangaType["TOONILY"] = "toonily";
MangaType["ASURASCANS"] = "asurascans";
MangaType["BLOGTRUYEN"] = "blogtruyen";
MangaType["MANGADEX"] = "mangadex";
})(MangaType = exports.MangaType || (exports.MangaType = {}));
15 changes: 2 additions & 13 deletions dist/src/lib/blogtruyen.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,6 @@ class Blogtruyen {
url = url !== undefined ? url : '';
path = path !== undefined ? path : '';
const _page = yield (yield this.browser).newPage();
yield _page.setRequestInterception(true);
_page.on('request', (req) => {
if (req.resourceType() !== 'document')
req.abort();
else
req.continue();
});
yield _page.goto(url_chapter);
const content = yield _page.$('#readonline > section');
const title = (0, validate_1.not_null)(yield _page.$eval('#readonline > header > h1', (el) => el.textContent));
Expand Down Expand Up @@ -203,8 +196,6 @@ class Blogtruyen {
last_update: (0, validate_1.not_null)(last_update),
};
})));
const rate = 'N|A';
const rate_number = 'N|A';
const follows = (0, validate_1.not_null)(yield content.$eval('#LikeCount', (el) => el.textContent));
return {
title: (0, validate_1.not_null)(title).trim(),
Expand All @@ -214,8 +205,6 @@ class Blogtruyen {
status: (0, validate_1.not_null)(status).trim(),
genres,
views: (0, validate_1.not_null)(views),
rate,
rate_number,
follows,
chapters,
};
Expand All @@ -231,7 +220,7 @@ class Blogtruyen {
else
req.continue();
});
yield _page.goto(`${this.baseUrl}${page > 1 ? `/?page=${page}` : ``}`);
yield _page.goto(`${this.baseUrl}${page > 1 ? `/page-${page}` : ``}`);
const element = yield _page.$$('#wrapper > section.main-content > div > div:nth-child(1) > section.list-mainpage > div:nth-child(1) > div > div');
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]);
return {
Expand All @@ -251,7 +240,7 @@ class Blogtruyen {
return {
_id: i,
title: (0, validate_1.not_null)(link.title),
href: 'https://blogtruyen.vn' + (0, validate_1.not_null)(link.href),
href: this.baseUrl + (0, validate_1.not_null)(link.href),
image_thumbnail: image_thumbnail.startsWith('//')
? `https:${image_thumbnail}`
: image_thumbnail,
Expand Down
6 changes: 6 additions & 0 deletions dist/src/lib/manga.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const nettruyen_1 = require("../lib/nettruyen");
const asurascans_1 = require("./asurascans");
const blogtruyen_1 = require("./blogtruyen");
const toonily_1 = require("./toonily");
const mangadex_1 = require("./mangadex");
class Manga {
constructor() { }
build(type, params) {
Expand All @@ -30,6 +31,11 @@ class Manga {
? params.baseUrl
: 'https://blogtruyen.vn');
}
case manga_1.MangaType.MANGADEX: {
return new mangadex_1.Mangadex(params !== undefined && params.baseUrl !== undefined
? params.baseUrl
: 'https://mangadex.org');
}
default: {
return new nettruyen_1.Nettruyen('https://www.nettruyenmax.com');
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "manga-lib",
"author": "Nhan Nguyen",
"version": "1.0.52",
"version": "1.1.1",
"license": "MIT",
"description": "A library for scraping manga from various websites.",
"repository": "https://github.com/zcrossoverz/manga-lib",
Expand Down

0 comments on commit b5fd272

Please sign in to comment.