remove this.cookieString attribute

This commit is contained in:
Nyagami
2024-01-14 22:26:34 +07:00
parent 8e3909c1d2
commit f4734f2dda
106 changed files with 11421 additions and 11695 deletions
-1
View File
@@ -62,7 +62,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
-1
View File
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
-1
View File
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
@@ -47,7 +47,6 @@ var WPmangaStreamPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
}
WPmangaStreamPlugin.prototype.popularNovels = function (page) {
-1
View File
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
-1
View File
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
-1
View File
@@ -62,7 +62,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
-13
View File
@@ -47,7 +47,6 @@ var KolNovel = /** @class */ (function () {
this.site = "https://kolnovel.lol/";
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.filters = {
order: {
label: "ترتيب حسب",
@@ -148,9 +147,6 @@ var KolNovel = /** @class */ (function () {
link += "&status=" + ((filters === null || filters === void 0 ? void 0 : filters.status) ? filters.status : "");
link += "&order=" + ((filters === null || filters === void 0 ? void 0 : filters.order) ? filters.order : "popular");
headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
return [4 /*yield*/, (0, fetch_1.fetchApi)(link, { headers: headers }).then(function (result) {
return result.text();
})];
@@ -185,9 +181,6 @@ var KolNovel = /** @class */ (function () {
case 0:
url = novelUrl;
headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
return [4 /*yield*/, fetch(url, { headers: headers })];
case 1:
result = _a.sent();
@@ -258,9 +251,6 @@ var KolNovel = /** @class */ (function () {
switch (_b.label) {
case 0:
headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
return [4 /*yield*/, fetch(chapterUrl, { headers: headers })];
case 1:
result = _b.sent();
@@ -286,9 +276,6 @@ var KolNovel = /** @class */ (function () {
case 0:
url = "".concat(this.site, "?s=").concat(searchTerm);
headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
return [4 /*yield*/, (0, fetch_1.fetchApi)(url, { headers: headers })];
case 1:
result = _a.sent();
-13
View File
@@ -48,7 +48,6 @@ var Linovelib = /** @class */ (function () {
this.site = "https://w.linovelib.com";
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.filters = {
sort: {
label: "Sort By",
@@ -83,9 +82,6 @@ var Linovelib = /** @class */ (function () {
link += filters.sort;
link += "/".concat(pageNo, ".html");
headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
return [4 /*yield*/, (0, fetch_1.fetchApi)(link, { headers: headers }).then(function (result) {
return result.text();
})];
@@ -124,9 +120,6 @@ var Linovelib = /** @class */ (function () {
case 0:
url = novelUrl;
headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
return [4 /*yield*/, (0, fetch_1.fetchApi)(url, { headers: headers })];
case 1:
result = _b.sent();
@@ -206,9 +199,6 @@ var Linovelib = /** @class */ (function () {
switch (_a.label) {
case 0:
headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
chapterText = "", pageText = "";
pageNumber = 1;
skillgg = {
@@ -416,9 +406,6 @@ var Linovelib = /** @class */ (function () {
searchUrl = "".concat(this.site, "/search/");
Term = encodeURI(searchTerm);
headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
pageNo = 1;
novels = [];
addPage = function (pageCheerio, redirect) { return __awaiter(_this, void 0, void 0, function () {
-1
View File
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
@@ -62,7 +62,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
@@ -62,7 +62,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
-1
View File
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
-1
View File
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
-1
View File
@@ -50,7 +50,6 @@ var ReadwnPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.filters = metadata.filters;
}
ReadwnPlugin.prototype.popularNovels = function (pageNo, _a) {
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
@@ -62,7 +62,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
-1
View File
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
-1
View File
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
@@ -62,7 +62,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
-1
View File
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
@@ -62,7 +62,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
-1
View File
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
-1
View File
@@ -62,7 +62,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
-1
View File
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
@@ -62,7 +62,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
-1
View File
@@ -50,7 +50,6 @@ var ReadwnPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.filters = metadata.filters;
}
ReadwnPlugin.prototype.popularNovels = function (pageNo, _a) {
-1
View File
@@ -50,7 +50,6 @@ var ReadwnPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.filters = metadata.filters;
}
ReadwnPlugin.prototype.popularNovels = function (pageNo, _a) {
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
-1
View File
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
-1
View File
@@ -48,7 +48,6 @@ var BLN = /** @class */ (function () {
this.site = "https://bestlightnovel.com/";
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
}
BLN.prototype.popularNovels = function (pageNo, options) {
return __awaiter(this, void 0, void 0, function () {
-1
View File
@@ -46,7 +46,6 @@ var FTest = /** @class */ (function () {
this.site = "https://noblemtl.com/";
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.filters = {
picker: {
type: filterInputs_1.FilterTypes.Picker,
-1
View File
@@ -46,7 +46,6 @@ var FreeWebNovel = /** @class */ (function () {
this.version = "1.0.0";
this.icon = "src/en/freewebnovel/icon.png";
this.userAgent = "";
this.cookieString = "";
this.fetchImage = fetch_1.fetchFile;
}
FreeWebNovel.prototype.popularNovels = function (page, _a) {
-13
View File
@@ -47,7 +47,6 @@ var NobleMTL = /** @class */ (function () {
this.site = "https://noblemtl.com/";
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.filters = {
order: {
label: "Sort By",
@@ -196,9 +195,6 @@ var NobleMTL = /** @class */ (function () {
link += "&status=" + filters.status.value;
link += "&order=" + filters.order.value;
headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
return [4 /*yield*/, (0, fetch_1.fetchApi)(link, { headers: headers }).then(function (result) {
return result.text();
})];
@@ -233,9 +229,6 @@ var NobleMTL = /** @class */ (function () {
case 0:
url = novelUrl;
headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
return [4 /*yield*/, (0, fetch_1.fetchApi)(url, { headers: headers })];
case 1:
result = _a.sent();
@@ -311,9 +304,6 @@ var NobleMTL = /** @class */ (function () {
switch (_a.label) {
case 0:
headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
return [4 /*yield*/, (0, fetch_1.fetchApi)(chapterUrl, { headers: headers })];
case 1:
result = _a.sent();
@@ -335,9 +325,6 @@ var NobleMTL = /** @class */ (function () {
case 0:
url = "".concat(this.site, "?s=").concat(searchTerm);
headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
return [4 /*yield*/, (0, fetch_1.fetchApi)(url, { headers: headers })];
case 1:
result = _a.sent();
-13
View File
@@ -47,7 +47,6 @@ var PandaMTL = /** @class */ (function () {
this.site = "https://pandamtl.com/";
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.filters = {
order: {
label: "Sort By",
@@ -126,9 +125,6 @@ var PandaMTL = /** @class */ (function () {
link += "&status=" + ((filters === null || filters === void 0 ? void 0 : filters.status) ? filters.status : "");
link += "&order=" + ((filters === null || filters === void 0 ? void 0 : filters.order) ? filters.order : "popular");
headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
return [4 /*yield*/, (0, fetch_1.fetchApi)(link, { headers: headers }).then(function (result) {
return result.text();
})];
@@ -163,9 +159,6 @@ var PandaMTL = /** @class */ (function () {
case 0:
url = novelUrl;
headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
return [4 /*yield*/, (0, fetch_1.fetchApi)(url, { headers: headers })];
case 1:
result = _a.sent();
@@ -234,9 +227,6 @@ var PandaMTL = /** @class */ (function () {
switch (_a.label) {
case 0:
headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
return [4 /*yield*/, (0, fetch_1.fetchApi)(chapterUrl, { headers: headers })];
case 1:
result = _a.sent();
@@ -258,9 +248,6 @@ var PandaMTL = /** @class */ (function () {
case 0:
url = "".concat(this.site, "?s=").concat(searchTerm);
headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
return [4 /*yield*/, (0, fetch_1.fetchApi)(url, { headers: headers })];
case 1:
result = _a.sent();
@@ -47,7 +47,6 @@ var WPmangaStreamPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
}
WPmangaStreamPlugin.prototype.popularNovels = function (page) {
-1
View File
@@ -46,7 +46,6 @@ var ChireadsPlugin = /** @class */ (function () {
this.site = "https://chireads.com";
this.version = "1.0.0";
this.userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36";
this.cookieString = "''";
}
ChireadsPlugin.prototype.parseNovels = function (loadedCheerio) {
return [];
-1
View File
@@ -47,7 +47,6 @@ var NovelDeGlacePlugin = /** @class */ (function () {
this.site = "https://noveldeglace.com/";
this.version = "1.0.0";
this.userAgent = "''";
this.cookieString = "''";
}
NovelDeGlacePlugin.prototype.popularNovels = function (page) {
return __awaiter(this, void 0, void 0, function () {
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
@@ -47,7 +47,6 @@ var LightNovelBrasil = /** @class */ (function () {
this.site = "https://lightnovelbrasil.com/";
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.filters = {
order: {
label: "Sort By",
@@ -196,9 +195,6 @@ var LightNovelBrasil = /** @class */ (function () {
link += "&status=" + ((filters === null || filters === void 0 ? void 0 : filters.status) ? filters.status : "");
link += "&order=" + ((filters === null || filters === void 0 ? void 0 : filters.order) ? filters.order : "popular");
headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
return [4 /*yield*/, (0, fetch_1.fetchApi)(link, { headers: headers }).then(function (result) {
return result.text();
})];
@@ -233,9 +229,6 @@ var LightNovelBrasil = /** @class */ (function () {
case 0:
url = novelUrl;
headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
return [4 /*yield*/, (0, fetch_1.fetchApi)(url, { headers: headers })];
case 1:
result = _a.sent();
@@ -312,9 +305,6 @@ var LightNovelBrasil = /** @class */ (function () {
switch (_a.label) {
case 0:
headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
return [4 /*yield*/, (0, fetch_1.fetchApi)(chapterUrl, { headers: headers })];
case 1:
result = _a.sent();
@@ -336,9 +326,6 @@ var LightNovelBrasil = /** @class */ (function () {
case 0:
url = "".concat(this.site, "?s=").concat(searchTerm);
headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
return [4 /*yield*/, (0, fetch_1.fetchApi)(url, { headers: headers })];
case 1:
result = _a.sent();
@@ -49,7 +49,6 @@ var IfreedomPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.filters = metadata.filters;
}
IfreedomPlugin.prototype.popularNovels = function (page, _a) {
-1
View File
@@ -50,7 +50,6 @@ var RulatePlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.filters = metadata.filters;
}
RulatePlugin.prototype.popularNovels = function (pageNo, _a) {
-1
View File
@@ -47,7 +47,6 @@ var freedlit = /** @class */ (function () {
this.version = "1.0.0";
this.icon = "src/ru/freedlit/icon.png";
this.userAgent = "";
this.cookieString = "";
this.fetchImage = fetch_1.fetchFile;
this.filters = {
sort: {
-1
View File
@@ -50,7 +50,6 @@ var RulatePlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.filters = metadata.filters;
}
RulatePlugin.prototype.popularNovels = function (pageNo, _a) {
-1
View File
@@ -55,7 +55,6 @@ var AuthorToday = /** @class */ (function () {
this.site = "https://author.today";
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.fetchImage = fetch_1.fetchFile;
this.filters = {
sort: {
-1
View File
@@ -52,7 +52,6 @@ var Bookriver = /** @class */ (function () {
this.version = "1.0.0";
this.icon = "src/ru/bookriver/icon.png";
this.userAgent = "";
this.cookieString = "";
this.fetchImage = fetch_1.fetchFile;
this.filters = {
sort: {
-1
View File
@@ -49,7 +49,6 @@ var ficbook = /** @class */ (function () {
this.version = "1.0.0";
this.icon = "src/ru/ficbook/icon.png";
this.userAgent = "";
this.cookieString = "";
this.fetchImage = fetch_1.fetchFile;
this.filters = {
sort: {
-1
View File
@@ -48,7 +48,6 @@ var Jaomix = /** @class */ (function () {
this.version = "1.0.0";
this.icon = "src/ru/jaomix/icon.png";
this.userAgent = "";
this.cookieString = "";
this.fetchImage = fetch_1.fetchFile;
this.filters = {
sortby: {
-1
View File
@@ -53,7 +53,6 @@ var TL = /** @class */ (function () {
this.version = "1.0.0";
this.icon = "src/ru/noveltl/icon.png";
this.userAgent = "";
this.cookieString = "";
this.fetchImage = fetch_1.fetchFile;
this.filters = {
tags: {
-1
View File
@@ -52,7 +52,6 @@ var RNBH = /** @class */ (function () {
this.site = "https://ranobehub.org/";
this.icon = "src/ru/ranobehub/icon.png";
this.userAgent = "";
this.cookieString = "";
this.fetchImage = fetch_1.fetchFile;
this.filters = {
sort: {
-1
View File
@@ -53,7 +53,6 @@ var RLIB = /** @class */ (function () {
this.icon = "src/ru/ranobelib/icon.png";
this.ui = undefined;
this.userAgent = "";
this.cookieString = "";
this.fetchImage = fetch_1.fetchFile;
this.filters = {
sort: {
-1
View File
@@ -53,7 +53,6 @@ var RNRF = /** @class */ (function () {
this.version = "1.0.0";
this.icon = "src/ru/ranoberf/icon.png";
this.userAgent = "";
this.cookieString = "";
this.fetchImage = fetch_1.fetchFile;
this.filters = {
sort: {
-1
View File
@@ -51,7 +51,6 @@ var ReN = /** @class */ (function () {
this.version = "1.0.0";
this.icon = "src/ru/renovels/icon.png";
this.userAgent = "";
this.cookieString = "";
this.fetchImage = fetch_1.fetchFile;
this.filters = {
sort: {
@@ -49,7 +49,6 @@ var IfreedomPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.filters = metadata.filters;
}
IfreedomPlugin.prototype.popularNovels = function (page, _a) {
-10
View File
@@ -50,7 +50,6 @@ var TuNovelaLigera = /** @class */ (function () {
this.site = "https://tunovelaligera.com/";
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.filters = {
order: {
value: "?m_orderby=rating",
@@ -137,9 +136,6 @@ var TuNovelaLigera = /** @class */ (function () {
link += "/page/".concat(pageNo);
link += filters.order;
headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
return [4 /*yield*/, (0, fetch_1.fetchApi)(link, { headers: headers })];
case 1:
result = _b.sent();
@@ -175,9 +171,6 @@ var TuNovelaLigera = /** @class */ (function () {
case 0:
url = novelUrl;
headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
return [4 /*yield*/, (0, fetch_1.fetchApi)(url, { headers: headers })];
case 1:
result = _c.sent();
@@ -353,9 +346,6 @@ var TuNovelaLigera = /** @class */ (function () {
switch (_a.label) {
case 0:
headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
return [4 /*yield*/, (0, fetch_1.fetchApi)(chapterUrl)];
case 1:
result = _a.sent();
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
@@ -63,7 +63,6 @@ var MadaraPlugin = /** @class */ (function () {
this.site = metadata.sourceSite;
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.options = metadata.options;
this.filters = metadata.filters;
}
-13
View File
@@ -47,7 +47,6 @@ var LSHNovel = /** @class */ (function () {
this.site = "https://lshnovel.com/";
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
this.filters = {
order: {
value: "popular",
@@ -144,9 +143,6 @@ var LSHNovel = /** @class */ (function () {
link += "&status=" + filters.status;
link += "&order=" + filters.order;
headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
return [4 /*yield*/, (0, fetch_1.fetchApi)(link, { headers: headers }).then(function (result) {
return result.text();
})];
@@ -181,9 +177,6 @@ var LSHNovel = /** @class */ (function () {
case 0:
url = novelUrl;
headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
return [4 /*yield*/, (0, fetch_1.fetchApi)(url, { headers: headers })];
case 1:
result = _a.sent();
@@ -259,9 +252,6 @@ var LSHNovel = /** @class */ (function () {
switch (_a.label) {
case 0:
headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
return [4 /*yield*/, (0, fetch_1.fetchApi)(chapterUrl, { headers: headers })];
case 1:
result = _a.sent();
@@ -283,9 +273,6 @@ var LSHNovel = /** @class */ (function () {
case 0:
url = "".concat(this.site, "?s=").concat(searchTerm);
headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
return [4 /*yield*/, (0, fetch_1.fetchApi)(url, { headers: headers })];
case 1:
result = _a.sent();
-1
View File
@@ -50,7 +50,6 @@ var Smakolykytl = /** @class */ (function () {
this.version = "1.0.0";
this.icon = "src/ua/smakolykytl/icon.png";
this.userAgent = "";
this.cookieString = "";
this.fetchImage = fetch_1.fetchFile;
}
Smakolykytl.prototype.popularNovels = function (pageNo, _a) {
-1
View File
@@ -47,7 +47,6 @@ var HakoPlugin = /** @class */ (function () {
this.site = "https://ln.hako.vn";
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
}
HakoPlugin.prototype.parseNovels = function (loadedCheerio) {
var _this = this;
+315 -328
View File
@@ -1,328 +1,315 @@
import { load as parseHTML } from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import { FilterTypes, Filters } from "@libs/filterInputs";
import { Plugin } from "@typings/plugin";
class KolNovel implements Plugin.PluginBase {
id = "kolnovel";
name = "KolNovel";
icon = "multisrc/wpmangastream/icons/kolnovel.png";
site = "https://kolnovel.lol/";
version = "1.0.0";
userAgent = "";
cookieString = "";
async popularNovels(
pageNo: number,
{ filters }: Plugin.PopularNovelsOptions<typeof this.filters>
): Promise<Plugin.NovelItem[]> {
let link = `${this.site}series/?page=${pageNo}`;
if (filters.genres.value.length)
link += filters.genres.value.map((i) => `&genre[]=${i}`).join("");
if (filters.type.value.length)
link += filters.type.value.map((i) => `&lang[]=${i}`).join("");
link += "&status=" + (filters?.status ? filters.status : "");
link += "&order=" + (filters?.order ? filters.order : "popular");
const headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
const body = await fetchApi(link, { headers }).then((result) =>
result.text()
);
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio("article.maindet").each(function () {
const novelName = loadedCheerio(this).find("h2").text();
let image = loadedCheerio(this).find("img");
const novelCover = image.attr("data-src") || image.attr("src");
const novelUrl = loadedCheerio(this).find("h2 a").attr("href");
if (!novelUrl) return;
const novel = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
}
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
const url = novelUrl;
const headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
const result = await fetch(url, { headers });
const body = await result.text();
let loadedCheerio = parseHTML(body);
const novel: Plugin.SourceNovel = {
url,
chapters: [],
};
novel.name = loadedCheerio("h1.entry-title").text();
novel.cover =
loadedCheerio("img.wp-post-image").attr("data-src") ||
loadedCheerio("img.wp-post-image").attr("src");
loadedCheerio("div.serl:nth-child(3) > span").each(function () {
const detailName = loadedCheerio(this).text().trim();
const detail = loadedCheerio(this).next().text().trim();
switch (detailName) {
case "الكاتب":
case "Author":
novel.author = detail;
break;
}
});
novel.status = loadedCheerio("div.sertostat > span").attr("class");
novel.genres = loadedCheerio(".sertogenre")
.children("a")
.map((i, el) => loadedCheerio(el).text())
.toArray()
.join(",");
novel.summary = loadedCheerio(".sersys")
.find("br")
.replaceWith("\n")
.end()
.text();
let chapter: Plugin.ChapterItem[] = [];
loadedCheerio(".eplister")
.find("li")
.each(function () {
const chapterName =
loadedCheerio(this).find(".epl-num").text() +
" - " +
loadedCheerio(this).find(".epl-title").text();
const releaseDate = loadedCheerio(this)
.find(".epl-date")
.text()
.trim();
const chapterUrl = loadedCheerio(this).find("a").attr("href");
if (!chapterUrl) return;
chapter.push({
name: chapterName,
releaseTime: releaseDate,
url: chapterUrl,
});
});
novel.chapters = chapter.reverse();
return novel;
}
async parseChapter(chapterUrl: string): Promise<string> {
const headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
const result = await fetch(chapterUrl, { headers });
const body = await result.text();
const loadedCheerio = parseHTML(body);
loadedCheerio(".epcontent > div, i").remove();
let ignore = loadedCheerio("article > style").text().trim().split(",");
ignore.push(...(ignore.pop()?.match(/^\.\w+/) || []));
ignore.map((tag) => loadedCheerio(`p${tag}`).remove());
let chapterText = loadedCheerio(".epcontent").html() || "";
return chapterText;
}
async searchNovels(
searchTerm: string,
pageNo?: number | undefined
): Promise<Plugin.NovelItem[]> {
const url = `${this.site}?s=${searchTerm}`;
const headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
const result = await fetchApi(url, { headers });
const body = await result.text();
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio("article.maindet").each(function () {
const novelName = loadedCheerio(this).find("h2").text();
let image = loadedCheerio(this).find("img");
const novelCover = image.attr("data-src") || image.attr("src");
const novelUrl = loadedCheerio(this).find("h2 a").attr("href");
if (!novelUrl) return;
novels.push({
name: novelName,
url: novelUrl,
cover: novelCover,
});
});
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
return await fetchFile(url);
}
filters = {
order: {
label: "ترتيب حسب",
options: [
{ label: "الإعداد الأولي", value: "" },
{ label: "A-Z", value: "title" },
{ label: "Z-A", value: "titlereverse" },
{ label: "أخر التحديثات", value: "update" },
{ label: "أخر ما تم إضافته", value: "latest" },
{ label: "الرائجة", value: "popular" },
],
value: "",
type: FilterTypes.Picker,
},
status: {
value: "",
label: "الحالة",
options: [
{ label: "All", value: "" },
{ label: "Ongoing", value: "ongoing" },
{ label: "Hiatus", value: "hiatus" },
{ label: "Completed", value: "completed" },
],
type: FilterTypes.Picker,
},
type: {
value: [],
label: "النوع",
options: [
{ label: "إنجليزية", value: "english" },
{ label: "روايةلايت", value: "light-novel" },
{ label: "روايةويب", value: "web-novel" },
{ label: "صينية", value: "chinese" },
{ label: "عربية", value: "arabic" },
{ label: "كورية", value: "korean" },
{ label: "يابانية", value: "japanese" },
],
type: FilterTypes.CheckboxGroup,
},
genres: {
value: [],
label: "تصنيف",
options: [
{ label: "Wuxia", value: "wuxia" },
{ label: "Xianxia", value: "xianxia" },
{ label: "XUANHUAN", value: "xuanhuan" },
{ label: "أكشن", value: "action" },
{ label: "إثارة", value: "excitement" },
{ label: "إنتقالالىعالمأخر", value: "isekai" },
{ label: "إيتشي", value: "etchi" },
{ label: "الخيالالعلمي", value: "sci-fi" },
{ label: "بوليسي", value: "policy" },
{ label: "تاريخي", value: "historical" },
{ label: "تحقيقات", value: "%d8%aa%d8%ad%d9%82%d9%8a%d9%82" },
{ label: "تقمصشخصيات", value: "rpg" },
{ label: "جريمة", value: "crime" },
{ label: "جوسى", value: "josei" },
{ label: "حريم", value: "harem" },
{ label: "حياةمدرسية", value: "school-life" },
{ label: "خيالي(فانتازيا)", value: "fantasy" },
{ label: "دراما", value: "drama" },
{ label: "رعب", value: "horror" },
{ label: "رومانسي", value: "romantic" },
{ label: "سحر", value: "magic" },
{ label: "سينن", value: "senen" },
{ label: "شريحةمنالحياة", value: "slice-of-life" },
{ label: "شوجو", value: "shojo" },
{ label: "شونين", value: "shonen" },
{ label: "طبي", value: "medical" },
{ label: "ظواهرخارقةللطبيعة", value: "supernatural" },
{ label: "غموض", value: "mysteries" },
{ label: "فنونالقتال", value: "martial-arts" },
{ label: "قوىخارقة", value: "superpower" },
{ label: "كوميدي", value: "comedy" },
{ label: "مأساوي", value: "tragedy" },
{ label: "مابعدالكارثة", value: "after-the-disaster" },
{ label: "مغامرة", value: "adventure" },
{ label: "ميكا", value: "mechanical" },
{ label: "ناضج", value: "mature" },
{ label: "نفسي", value: "psychological" },
],
type: FilterTypes.CheckboxGroup,
},
} satisfies Filters;
}
export default new KolNovel();
import { load as parseHTML } from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import { FilterTypes, Filters } from "@libs/filterInputs";
import { Plugin } from "@typings/plugin";
class KolNovel implements Plugin.PluginBase {
id = "kolnovel";
name = "KolNovel";
icon = "multisrc/wpmangastream/icons/kolnovel.png";
site = "https://kolnovel.lol/";
version = "1.0.0";
userAgent = "";
async popularNovels(
pageNo: number,
{ filters }: Plugin.PopularNovelsOptions<typeof this.filters>
): Promise<Plugin.NovelItem[]> {
let link = `${this.site}series/?page=${pageNo}`;
if (filters.genres.value.length)
link += filters.genres.value.map((i) => `&genre[]=${i}`).join("");
if (filters.type.value.length)
link += filters.type.value.map((i) => `&lang[]=${i}`).join("");
link += "&status=" + (filters?.status ? filters.status : "");
link += "&order=" + (filters?.order ? filters.order : "popular");
const headers = new Headers();
const body = await fetchApi(link, { headers }).then((result) =>
result.text()
);
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio("article.maindet").each(function () {
const novelName = loadedCheerio(this).find("h2").text();
let image = loadedCheerio(this).find("img");
const novelCover = image.attr("data-src") || image.attr("src");
const novelUrl = loadedCheerio(this).find("h2 a").attr("href");
if (!novelUrl) return;
const novel = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
}
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
const url = novelUrl;
const headers = new Headers();
const result = await fetch(url, { headers });
const body = await result.text();
let loadedCheerio = parseHTML(body);
const novel: Plugin.SourceNovel = {
url,
chapters: [],
};
novel.name = loadedCheerio("h1.entry-title").text();
novel.cover =
loadedCheerio("img.wp-post-image").attr("data-src") ||
loadedCheerio("img.wp-post-image").attr("src");
loadedCheerio("div.serl:nth-child(3) > span").each(function () {
const detailName = loadedCheerio(this).text().trim();
const detail = loadedCheerio(this).next().text().trim();
switch (detailName) {
case "الكاتب":
case "Author":
novel.author = detail;
break;
}
});
novel.status = loadedCheerio("div.sertostat > span").attr("class");
novel.genres = loadedCheerio(".sertogenre")
.children("a")
.map((i, el) => loadedCheerio(el).text())
.toArray()
.join(",");
novel.summary = loadedCheerio(".sersys")
.find("br")
.replaceWith("\n")
.end()
.text();
let chapter: Plugin.ChapterItem[] = [];
loadedCheerio(".eplister")
.find("li")
.each(function () {
const chapterName =
loadedCheerio(this).find(".epl-num").text() +
" - " +
loadedCheerio(this).find(".epl-title").text();
const releaseDate = loadedCheerio(this)
.find(".epl-date")
.text()
.trim();
const chapterUrl = loadedCheerio(this).find("a").attr("href");
if (!chapterUrl) return;
chapter.push({
name: chapterName,
releaseTime: releaseDate,
url: chapterUrl,
});
});
novel.chapters = chapter.reverse();
return novel;
}
async parseChapter(chapterUrl: string): Promise<string> {
const headers = new Headers();
const result = await fetch(chapterUrl, { headers });
const body = await result.text();
const loadedCheerio = parseHTML(body);
loadedCheerio(".epcontent > div, i").remove();
let ignore = loadedCheerio("article > style").text().trim().split(",");
ignore.push(...(ignore.pop()?.match(/^\.\w+/) || []));
ignore.map((tag) => loadedCheerio(`p${tag}`).remove());
let chapterText = loadedCheerio(".epcontent").html() || "";
return chapterText;
}
async searchNovels(
searchTerm: string,
pageNo?: number | undefined
): Promise<Plugin.NovelItem[]> {
const url = `${this.site}?s=${searchTerm}`;
const headers = new Headers();
const result = await fetchApi(url, { headers });
const body = await result.text();
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio("article.maindet").each(function () {
const novelName = loadedCheerio(this).find("h2").text();
let image = loadedCheerio(this).find("img");
const novelCover = image.attr("data-src") || image.attr("src");
const novelUrl = loadedCheerio(this).find("h2 a").attr("href");
if (!novelUrl) return;
novels.push({
name: novelName,
url: novelUrl,
cover: novelCover,
});
});
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
return await fetchFile(url);
}
filters = {
order: {
label: "ترتيب حسب",
options: [
{ label: "الإعداد الأولي", value: "" },
{ label: "A-Z", value: "title" },
{ label: "Z-A", value: "titlereverse" },
{ label: "أخر التحديثات", value: "update" },
{ label: "أخر ما تم إضافته", value: "latest" },
{ label: "الرائجة", value: "popular" },
],
value: "",
type: FilterTypes.Picker,
},
status: {
value: "",
label: "الحالة",
options: [
{ label: "All", value: "" },
{ label: "Ongoing", value: "ongoing" },
{ label: "Hiatus", value: "hiatus" },
{ label: "Completed", value: "completed" },
],
type: FilterTypes.Picker,
},
type: {
value: [],
label: "النوع",
options: [
{ label: "إنجليزية", value: "english" },
{ label: "روايةلايت", value: "light-novel" },
{ label: "روايةويب", value: "web-novel" },
{ label: "صينية", value: "chinese" },
{ label: "عربية", value: "arabic" },
{ label: "كورية", value: "korean" },
{ label: "يابانية", value: "japanese" },
],
type: FilterTypes.CheckboxGroup,
},
genres: {
value: [],
label: "تصنيف",
options: [
{ label: "Wuxia", value: "wuxia" },
{ label: "Xianxia", value: "xianxia" },
{ label: "XUANHUAN", value: "xuanhuan" },
{ label: "أكشن", value: "action" },
{ label: "إثارة", value: "excitement" },
{ label: "إنتقالالىعالمأخر", value: "isekai" },
{ label: "إيتشي", value: "etchi" },
{ label: "الخيالالعلمي", value: "sci-fi" },
{ label: "بوليسي", value: "policy" },
{ label: "تاريخي", value: "historical" },
{ label: "تحقيقات", value: "%d8%aa%d8%ad%d9%82%d9%8a%d9%82" },
{ label: "تقمصشخصيات", value: "rpg" },
{ label: "جريمة", value: "crime" },
{ label: "جوسى", value: "josei" },
{ label: "حريم", value: "harem" },
{ label: "حياةمدرسية", value: "school-life" },
{ label: "خيالي(فانتازيا)", value: "fantasy" },
{ label: "دراما", value: "drama" },
{ label: "رعب", value: "horror" },
{ label: "رومانسي", value: "romantic" },
{ label: "سحر", value: "magic" },
{ label: "سينن", value: "senen" },
{ label: "شريحةمنالحياة", value: "slice-of-life" },
{ label: "شوجو", value: "shojo" },
{ label: "شونين", value: "shonen" },
{ label: "طبي", value: "medical" },
{ label: "ظواهرخارقةللطبيعة", value: "supernatural" },
{ label: "غموض", value: "mysteries" },
{ label: "فنونالقتال", value: "martial-arts" },
{ label: "قوىخارقة", value: "superpower" },
{ label: "كوميدي", value: "comedy" },
{ label: "مأساوي", value: "tragedy" },
{ label: "مابعدالكارثة", value: "after-the-disaster" },
{ label: "مغامرة", value: "adventure" },
{ label: "ميكا", value: "mechanical" },
{ label: "ناضج", value: "mature" },
{ label: "نفسي", value: "psychological" },
],
type: FilterTypes.CheckboxGroup,
},
} satisfies Filters;
}
export default new KolNovel();
File diff suppressed because it is too large Load Diff
+180 -181
View File
@@ -1,181 +1,180 @@
import { load as cheerioload } from "cheerio";
import { Plugin } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { fetchFile } from "@libs/fetch";
import { NovelStatus } from "@libs/novelStatus";
class BLN implements Plugin.PluginBase {
id = "BLN.com";
name = "BestLightNovel";
icon = "src/en/bestlightnovel/icon.png";
site = "https://bestlightnovel.com/";
filter?: undefined;
version = "1.0.0";
userAgent = "";
cookieString = "";
async popularNovels(
pageNo: number,
options: Plugin.PopularNovelsOptions
): Promise<Plugin.NovelItem[]> {
const url =
this.site +
"novel_list?type=topview&category=all&state=all&page=1" +
pageNo;
const result = await fetch(url);
if (!result.ok) {
console.error(await result.text());
// TODO: Cloudflare protection or other error
return [];
}
const body = await result.text();
const loadedCheerio = cheerioload(body);
let novels: Plugin.NovelItem[] = [];
loadedCheerio(".update_item.list_category").each(function () {
const novelName = loadedCheerio(this).find("h3 > a").text();
const novelCover = loadedCheerio(this).find("img").attr("src");
const novelUrl = loadedCheerio(this).find("h3 > a").attr("href");
if (!novelUrl) {
// TODO: Handle error
console.error("No novel url!");
return;
}
const novel = {
name: novelName,
url: novelUrl,
cover: novelCover,
};
novels.push(novel);
});
return novels;
}
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
const url = novelUrl;
const result = await fetch(url);
if (!result.ok) {
console.error(await result.text());
// TODO: Cloudflare protection
return { url, chapters: [] };
}
const body = await result.text();
let loadedCheerio = cheerioload(body);
let novel: Plugin.SourceNovel = {
url,
name: "",
cover: "",
author: "",
status: NovelStatus.Unknown,
genres: "",
summary: "",
chapters: [],
};
novel.name = loadedCheerio(".truyen_info_right h1").text().trim();
novel.cover =
loadedCheerio(".info_image img").attr("src") || defaultCover;
novel.summary = loadedCheerio("#noidungm").text()?.trim();
novel.author = loadedCheerio(
"#main_body > div.cotgiua > div.truyen_info_wrapper > div.truyen_info > div.entry-header > div.truyen_if_wrap > ul > li:nth-child(2) > a"
)
.text()
?.trim();
let status = loadedCheerio(
"#main_body > div.cotgiua > div.truyen_info_wrapper > div.truyen_info > div.entry-header > div.truyen_if_wrap > ul > li:nth-child(4) > a"
)
.text()
?.trim();
novel.status =
status === "ONGOING"
? NovelStatus.Ongoing
: status === "COMPLETED"
? NovelStatus.Completed
: NovelStatus.Unknown;
let novelChapters: Plugin.ChapterItem[] = [];
loadedCheerio(".chapter-list div.row").each(function () {
const chapterName = loadedCheerio(this).find("a").text().trim();
const releaseDate = loadedCheerio(this)
.find("span:nth-child(2)")
.text()
.trim();
const chapterUrl = loadedCheerio(this).find("a").attr("href");
if (!chapterUrl) {
// TODO: Handle error
console.error("No chapter url!");
return;
}
novelChapters.push({
name: chapterName,
releaseTime: releaseDate,
url: chapterUrl,
});
});
novel.chapters = novelChapters.reverse();
return novel;
}
async parseChapter(chapterUrl: string): Promise<string> {
const url = chapterUrl;
const result = await fetch(url);
const body = await result.text();
let loadedCheerio = cheerioload(body);
const chapterText = loadedCheerio("#vung_doc").html() || "";
return chapterText;
}
async searchNovels(
searchTerm: string,
pageNo?: number | undefined
): Promise<Plugin.NovelItem[]> {
const url = `${this.site}search_novels/${searchTerm}`;
const result = await fetch(url);
const body = await result.text();
let loadedCheerio = cheerioload(body);
let novels: Plugin.NovelItem[] = [];
loadedCheerio(".update_item.list_category").each(function () {
const novelName = loadedCheerio(this).find("h3 > a").text();
const novelCover = loadedCheerio(this).find("img").attr("src");
const novelUrl = loadedCheerio(this).find("h3 > a").attr("href");
if (!novelUrl) {
// TODO: Handle error
console.error("No novel url!");
return;
}
const novel = { name: novelName, cover: novelCover, url: novelUrl };
novels.push(novel);
});
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
return await fetchFile(url);
}
}
export default new BLN();
import { load as cheerioload } from "cheerio";
import { Plugin } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { fetchFile } from "@libs/fetch";
import { NovelStatus } from "@libs/novelStatus";
class BLN implements Plugin.PluginBase {
id = "BLN.com";
name = "BestLightNovel";
icon = "src/en/bestlightnovel/icon.png";
site = "https://bestlightnovel.com/";
filter?: undefined;
version = "1.0.0";
userAgent = "";
async popularNovels(
pageNo: number,
options: Plugin.PopularNovelsOptions
): Promise<Plugin.NovelItem[]> {
const url =
this.site +
"novel_list?type=topview&category=all&state=all&page=1" +
pageNo;
const result = await fetch(url);
if (!result.ok) {
console.error(await result.text());
// TODO: Cloudflare protection or other error
return [];
}
const body = await result.text();
const loadedCheerio = cheerioload(body);
let novels: Plugin.NovelItem[] = [];
loadedCheerio(".update_item.list_category").each(function () {
const novelName = loadedCheerio(this).find("h3 > a").text();
const novelCover = loadedCheerio(this).find("img").attr("src");
const novelUrl = loadedCheerio(this).find("h3 > a").attr("href");
if (!novelUrl) {
// TODO: Handle error
console.error("No novel url!");
return;
}
const novel = {
name: novelName,
url: novelUrl,
cover: novelCover,
};
novels.push(novel);
});
return novels;
}
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
const url = novelUrl;
const result = await fetch(url);
if (!result.ok) {
console.error(await result.text());
// TODO: Cloudflare protection
return { url, chapters: [] };
}
const body = await result.text();
let loadedCheerio = cheerioload(body);
let novel: Plugin.SourceNovel = {
url,
name: "",
cover: "",
author: "",
status: NovelStatus.Unknown,
genres: "",
summary: "",
chapters: [],
};
novel.name = loadedCheerio(".truyen_info_right h1").text().trim();
novel.cover =
loadedCheerio(".info_image img").attr("src") || defaultCover;
novel.summary = loadedCheerio("#noidungm").text()?.trim();
novel.author = loadedCheerio(
"#main_body > div.cotgiua > div.truyen_info_wrapper > div.truyen_info > div.entry-header > div.truyen_if_wrap > ul > li:nth-child(2) > a"
)
.text()
?.trim();
let status = loadedCheerio(
"#main_body > div.cotgiua > div.truyen_info_wrapper > div.truyen_info > div.entry-header > div.truyen_if_wrap > ul > li:nth-child(4) > a"
)
.text()
?.trim();
novel.status =
status === "ONGOING"
? NovelStatus.Ongoing
: status === "COMPLETED"
? NovelStatus.Completed
: NovelStatus.Unknown;
let novelChapters: Plugin.ChapterItem[] = [];
loadedCheerio(".chapter-list div.row").each(function () {
const chapterName = loadedCheerio(this).find("a").text().trim();
const releaseDate = loadedCheerio(this)
.find("span:nth-child(2)")
.text()
.trim();
const chapterUrl = loadedCheerio(this).find("a").attr("href");
if (!chapterUrl) {
// TODO: Handle error
console.error("No chapter url!");
return;
}
novelChapters.push({
name: chapterName,
releaseTime: releaseDate,
url: chapterUrl,
});
});
novel.chapters = novelChapters.reverse();
return novel;
}
async parseChapter(chapterUrl: string): Promise<string> {
const url = chapterUrl;
const result = await fetch(url);
const body = await result.text();
let loadedCheerio = cheerioload(body);
const chapterText = loadedCheerio("#vung_doc").html() || "";
return chapterText;
}
async searchNovels(
searchTerm: string,
pageNo?: number | undefined
): Promise<Plugin.NovelItem[]> {
const url = `${this.site}search_novels/${searchTerm}`;
const result = await fetch(url);
const body = await result.text();
let loadedCheerio = cheerioload(body);
let novels: Plugin.NovelItem[] = [];
loadedCheerio(".update_item.list_category").each(function () {
const novelName = loadedCheerio(this).find("h3 > a").text();
const novelCover = loadedCheerio(this).find("img").attr("src");
const novelUrl = loadedCheerio(this).find("h3 > a").attr("href");
if (!novelUrl) {
// TODO: Handle error
console.error("No novel url!");
return;
}
const novel = { name: novelName, cover: novelCover, url: novelUrl };
novels.push(novel);
});
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
return await fetchFile(url);
}
}
export default new BLN();
+1 -2
View File
@@ -9,8 +9,7 @@ class FTest implements Plugin.PluginBase {
icon = "src/en/noblemtl/icon.png";
site = "https://noblemtl.com/";
version = "1.0.0";
userAgent = "";
cookieString = "";
userAgent = "";
async popularNovels(
pageNo: number,
{ filters }: Plugin.PopularNovelsOptions<typeof this.filters>
+103 -104
View File
@@ -1,104 +1,103 @@
import { Plugin } from "@typings/plugin";
import { fetchApi, fetchFile } from "@libs/fetch";
import { NovelStatus } from "@libs/novelStatus";
import { load as parseHTML } from "cheerio";
class FreeWebNovel implements Plugin.PluginBase {
id = "FWN.com";
name = "Web NOVEL";
site = "https://freewebnovel.com";
version = "1.0.0";
icon = "src/en/freewebnovel/icon.png";
userAgent = "";
cookieString = "";
async popularNovels(
page: number,
{ showLatestNovels }: Plugin.PopularNovelsOptions,
): Promise<Plugin.NovelItem[]> {
const sort = showLatestNovels
? "/latest-release-novels/"
: "/completed-novels/";
const body = await fetchApi(this.site + sort + page).then((res) => res.text());
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = loadedCheerio(".li-row")
.map((index, element) => ({
name: loadedCheerio(element).find(".tit").text(),
cover: loadedCheerio(element).find("img").attr("src"),
url: this.site + loadedCheerio(element).find("h3 > a").attr("href"),
}))
.get();
return novels;
}
async parseNovelAndChapters(url: string): Promise<Plugin.SourceNovel> {
const body = await fetchApi(url).then((res) => res.text());
const loadedCheerio = parseHTML(body);
const novel: Plugin.SourceNovel = { url };
novel.name = loadedCheerio("h1.tit").text();
novel.cover = loadedCheerio(".pic > img").attr("src");
novel.genres = loadedCheerio("[title=Genre]")
.next()
.text()
.replace(/[\t\n]/g, "");
novel.author = loadedCheerio("[title=Author]")
.next()
.text()
.replace(/[\t\n]/g, "");
novel.status = loadedCheerio("[title=Status]")
.next()
.text()
.replace(/[\t\n]/g, "");
novel.summary = loadedCheerio(".inner").text().trim();
const chapters: Plugin.ChapterItem[] = loadedCheerio("#idData > li > a")
.map((index, element) => ({
name: loadedCheerio(element).attr("title") || "Chapter " + index,
releaseTime: null,
url: this.site + loadedCheerio(element).attr("href"),
}))
.get();
novel.chapters = chapters;
return novel;
}
async parseChapter(chapterUrl: string): Promise<string> {
const body = await fetchApi(chapterUrl).then((res) => res.text());
const loadedCheerio = parseHTML(body);
const chapterText = loadedCheerio("div.txt").html() || "";
return chapterText;
}
async searchNovels(
searchkey: string,
): Promise<Plugin.NovelItem[]> {
const body = await fetchApi(this.site + "/search/", {
method: "POST",
body: JSON.stringify({ searchkey }),
}).then((res) => res.text());
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = loadedCheerio(".li-row > .li > .con")
.map((index, element) => ({
name: loadedCheerio(element).find(".tit").text(),
cover: loadedCheerio(element).find(".pic > a > img").attr("data-cfsrc"),
url: this.site + loadedCheerio(element).find("h3 > a").attr("href"),
}))
.get();
return novels;
}
fetchImage = fetchFile;
}
export default new FreeWebNovel();
import { Plugin } from "@typings/plugin";
import { fetchApi, fetchFile } from "@libs/fetch";
import { NovelStatus } from "@libs/novelStatus";
import { load as parseHTML } from "cheerio";
class FreeWebNovel implements Plugin.PluginBase {
id = "FWN.com";
name = "Web NOVEL";
site = "https://freewebnovel.com";
version = "1.0.0";
icon = "src/en/freewebnovel/icon.png";
userAgent = "";
async popularNovels(
page: number,
{ showLatestNovels }: Plugin.PopularNovelsOptions,
): Promise<Plugin.NovelItem[]> {
const sort = showLatestNovels
? "/latest-release-novels/"
: "/completed-novels/";
const body = await fetchApi(this.site + sort + page).then((res) => res.text());
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = loadedCheerio(".li-row")
.map((index, element) => ({
name: loadedCheerio(element).find(".tit").text(),
cover: loadedCheerio(element).find("img").attr("src"),
url: this.site + loadedCheerio(element).find("h3 > a").attr("href"),
}))
.get();
return novels;
}
async parseNovelAndChapters(url: string): Promise<Plugin.SourceNovel> {
const body = await fetchApi(url).then((res) => res.text());
const loadedCheerio = parseHTML(body);
const novel: Plugin.SourceNovel = { url };
novel.name = loadedCheerio("h1.tit").text();
novel.cover = loadedCheerio(".pic > img").attr("src");
novel.genres = loadedCheerio("[title=Genre]")
.next()
.text()
.replace(/[\t\n]/g, "");
novel.author = loadedCheerio("[title=Author]")
.next()
.text()
.replace(/[\t\n]/g, "");
novel.status = loadedCheerio("[title=Status]")
.next()
.text()
.replace(/[\t\n]/g, "");
novel.summary = loadedCheerio(".inner").text().trim();
const chapters: Plugin.ChapterItem[] = loadedCheerio("#idData > li > a")
.map((index, element) => ({
name: loadedCheerio(element).attr("title") || "Chapter " + index,
releaseTime: null,
url: this.site + loadedCheerio(element).attr("href"),
}))
.get();
novel.chapters = chapters;
return novel;
}
async parseChapter(chapterUrl: string): Promise<string> {
const body = await fetchApi(chapterUrl).then((res) => res.text());
const loadedCheerio = parseHTML(body);
const chapterText = loadedCheerio("div.txt").html() || "";
return chapterText;
}
async searchNovels(
searchkey: string,
): Promise<Plugin.NovelItem[]> {
const body = await fetchApi(this.site + "/search/", {
method: "POST",
body: JSON.stringify({ searchkey }),
}).then((res) => res.text());
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = loadedCheerio(".li-row > .li > .con")
.map((index, element) => ({
name: loadedCheerio(element).find(".tit").text(),
cover: loadedCheerio(element).find(".pic > a > img").attr("data-cfsrc"),
url: this.site + loadedCheerio(element).find("h3 > a").attr("href"),
}))
.get();
return novels;
}
fetchImage = fetchFile;
}
export default new FreeWebNovel();
+415 -428
View File
@@ -1,428 +1,415 @@
import { load as parseHTML } from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import { FilterTypes, Filters } from "@libs/filterInputs";
import { Plugin } from "@typings/plugin";
class NobleMTL implements Plugin.PluginBase {
id = "noblemtl";
name = "NobleMTL";
icon = "src/en/noblemtl/icon.png";
site = "https://noblemtl.com/";
version = "1.0.0";
userAgent = "";
cookieString = "";
async popularNovels(
pageNo: number,
{ filters }: Plugin.PopularNovelsOptions<typeof this.filters>
): Promise<Plugin.NovelItem[]> {
let link = `${this.site}series/?page=${pageNo}`;
if (filters.genres.value.length)
link += filters.genres.value.map((i) => `&genre[]=${i}`).join("");
if (filters.type.value.length)
link += filters.type.value.map((i) => `&lang[]=${i}`).join("");
link += "&status=" + filters.status.value;
link += "&order=" + filters.order.value;
const headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
const body = await fetchApi(link, { headers }).then((result) =>
result.text()
);
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio("article.bs").each(function () {
const novelName = loadedCheerio(this).find(".ntitle").text().trim();
let image = loadedCheerio(this).find("img");
const novelCover = image.attr("data-src") || image.attr("src");
const novelUrl = loadedCheerio(this).find("a").attr("href");
if (!novelUrl) return;
const novel = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
}
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
const url = novelUrl;
const headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
const result = await fetchApi(url, { headers });
const body = await result.text();
let loadedCheerio = parseHTML(body);
const novel: Plugin.SourceNovel = {
url,
chapters: [],
};
novel.name = loadedCheerio(".entry-title").text();
novel.cover =
loadedCheerio("img.wp-post-image").attr("data-src") ||
loadedCheerio("img.wp-post-image").attr("src");
loadedCheerio("div.spe > span").each(function () {
const detailName = loadedCheerio(this).find("b").text().trim();
const detail = loadedCheerio(this)
.find("b")
.remove()
.end()
.text()
.trim();
switch (detailName) {
case "Author:":
novel.author = detail;
break;
case "Status:":
novel.status = detail;
break;
}
});
novel.genres = loadedCheerio(".genxed")
.text()
.trim()
.replace(/\s/g, ",");
loadedCheerio('div[itemprop="description"] h3,p.a,strong').remove();
novel.summary = loadedCheerio('div[itemprop="description"]')
.find("br")
.replaceWith("\n")
.end()
.text();
let chapter: Plugin.ChapterItem[] = [];
loadedCheerio(".eplister")
.find("li")
.each(function () {
const chapterName =
loadedCheerio(this).find(".epl-num").text() +
" - " +
loadedCheerio(this).find(".epl-title").text();
const releaseDate = loadedCheerio(this)
.find(".epl-date")
.text()
.trim();
const chapterUrl = loadedCheerio(this).find("a").attr("href");
if (!chapterUrl) return;
chapter.push({
name: chapterName,
releaseTime: releaseDate,
url: chapterUrl,
});
});
novel.chapters = chapter.reverse();
return novel;
}
async parseChapter(chapterUrl: string): Promise<string> {
const headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
const result = await fetchApi(chapterUrl, { headers });
const body = await result.text();
const loadedCheerio = parseHTML(body);
let chapterText = loadedCheerio(".epcontent").html() || "";
return chapterText;
}
async searchNovels(
searchTerm: string,
pageNo?: number | undefined
): Promise<Plugin.NovelItem[]> {
const url = `${this.site}?s=${searchTerm}`;
const headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
const result = await fetchApi(url, { headers });
const body = await result.text();
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio("article.bs").each(function () {
const novelName = loadedCheerio(this).find(".ntitle").text().trim();
const novelCover = loadedCheerio(this).find("img").attr("src");
const novelUrl = loadedCheerio(this).find("a").attr("href");
if (!novelUrl) return;
novels.push({
name: novelName,
url: novelUrl,
cover: novelCover,
});
});
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
return await fetchFile(url);
}
filters = {
order: {
label: "Sort By",
type: FilterTypes.Picker,
options: [
{ label: "Default", value: "" },
{ label: "A-Z", value: "title" },
{ label: "Z-A", value: "titlereverse" },
{ label: "Latest Update", value: "update" },
{ label: "Latest Added", value: "latest" },
{ label: "Popular", value: "popular" },
],
value: "",
},
status: {
label: "Status",
options: [
{ label: "All", value: "" },
{ label: "Ongoing", value: "ongoing" },
{ label: "Hiatus", value: "hiatus" },
{ label: "Completed", value: "completed" },
],
type: FilterTypes.Picker,
value: "",
},
type: {
label: "Type",
options: [
{ label: "Chinese novel", value: "chinese-novel" },
{ label: "habyeol", value: "habyeol" },
{ label: "korean novel", value: "korean-novel" },
{ label: "Web Novel", value: "web-novel" },
{ label: "삼심", value: "%ec%82%bc%ec%8b%ac" },
{ label: "호곡", value: "%ed%98%b8%ea%b3%a1" },
],
type: FilterTypes.CheckboxGroup,
value: [],
},
genres: {
label: "Genres",
value: [],
options: [
{ label: "A.I", value: "a.i" },
{ label: "Academy", value: "academy" },
{ label: "Action", value: "action" },
{ label: "Adult", value: "adult" },
{ label: "Adventure", value: "adventure" },
{ label: "Alternative History", value: "alternative-history" },
{ label: "Another World", value: "another-world" },
{ label: "Apocalypse", value: "apocalypse" },
{ label: "Bromance", value: "bromance" },
{ label: "Comedy", value: "comedy" },
{ label: "Dark fantasy", value: "dark-fantasy" },
{ label: "Demons", value: "demons" },
{ label: "Drama", value: "drama" },
{ label: "Dystopia", value: "dystopia" },
{ label: "Ecchi", value: "ecchi" },
{ label: "Entertainment", value: "entertainment" },
{ label: "Exhaustion", value: "exhaustion" },
{ label: "Fanfiction", value: "fanfiction" },
{ label: "fantasy", value: "fantasy" },
{ label: "finance", value: "finance" },
{ label: "Full color", value: "full-color" },
{ label: "Game", value: "game" },
{ label: "Gender Bender", value: "gender-bender" },
{ label: "Genius", value: "genius" },
{ label: "Harem", value: "harem" },
{ label: "Hero", value: "hero" },
{ label: "Historical", value: "historical" },
{ label: "Hunter", value: "hunter" },
{ label: "korean novel", value: "korean-novel" },
{ label: "Light Novel", value: "light-novel" },
{
label: "List Adventure Manga Genres",
value: "list-adventure-manga-genres",
},
{ label: "Long Strip", value: "long-strip" },
{ label: "Love comedy", value: "love-comedy" },
{ label: "magic", value: "magic" },
{ label: "Manhua", value: "manhua" },
{ label: "Martial Arts", value: "martial-arts" },
{ label: "Mature", value: "mature" },
{ label: "Medieval", value: "medieval" },
{ label: "Misunderstanding", value: "misunderstanding" },
{ label: "Modern", value: "modern" },
{ label: "modern fantasy", value: "modern-fantasy" },
{ label: "music", value: "music" },
{ label: "Mystery", value: "mystery" },
{ label: "Necromancy", value: "necromancy" },
{ label: "No Romance", value: "no-romance" },
{ label: "NTL", value: "ntl" },
{ label: "o", value: "o" },
{ label: "Obsession", value: "obsession" },
{ label: "Politics", value: "politics" },
{ label: "Possession", value: "possession" },
{ label: "Programming", value: "programming" },
{ label: "Psychological", value: "psychological" },
{ label: "Pure Love", value: "pure-love" },
{ label: "Redemption", value: "redemption" },
{ label: "Regression", value: "regression" },
{ label: "Regret", value: "regret" },
{ label: "Reincarnation", value: "reincarnation" },
{ label: "Revenge", value: "revenge" },
{ label: "Romance", value: "romance" },
{ label: "Romance Fanrasy", value: "romance-fanrasy" },
{ label: "Salvation", value: "salvation" },
{ label: "School Life", value: "school-life" },
{ label: "Sci-fi", value: "sci-fi" },
{ label: "Science fiction", value: "science-fiction" },
{ label: "Seinen", value: "seinen" },
{ label: "Shounen", value: "shounen" },
{ label: "Slice of Life", value: "slice-of-life" },
{ label: "Soft yandere", value: "soft-yandere" },
{ label: "Sports", value: "sports" },
{ label: "Supernatural", value: "supernatural" },
{ label: "Survival", value: "survival" },
{ label: "system", value: "system" },
{ label: "Time limit", value: "time-limit" },
{ label: "Tragedy", value: "tragedy" },
{ label: "Transmigration", value: "transmigration" },
{ label: "TS", value: "ts" },
{ label: "Tsundere", value: "tsundere" },
{ label: "Unique", value: "unique" },
{ label: "Wholesome", value: "wholesome" },
{ label: "Wuxia", value: "wuxia" },
{ label: "Xuanhuan", value: "xuanhuan" },
{ label: "Yandere", value: "yandere" },
{ label: "Yuri", value: "yuri" },
],
type: FilterTypes.CheckboxGroup,
},
} satisfies Filters;
}
const Noble = new NobleMTL();
export default new NobleMTL();
import { load as parseHTML } from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import { FilterTypes, Filters } from "@libs/filterInputs";
import { Plugin } from "@typings/plugin";
class NobleMTL implements Plugin.PluginBase {
id = "noblemtl";
name = "NobleMTL";
icon = "src/en/noblemtl/icon.png";
site = "https://noblemtl.com/";
version = "1.0.0";
userAgent = "";
async popularNovels(
pageNo: number,
{ filters }: Plugin.PopularNovelsOptions<typeof this.filters>
): Promise<Plugin.NovelItem[]> {
let link = `${this.site}series/?page=${pageNo}`;
if (filters.genres.value.length)
link += filters.genres.value.map((i) => `&genre[]=${i}`).join("");
if (filters.type.value.length)
link += filters.type.value.map((i) => `&lang[]=${i}`).join("");
link += "&status=" + filters.status.value;
link += "&order=" + filters.order.value;
const headers = new Headers();
const body = await fetchApi(link, { headers }).then((result) =>
result.text()
);
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio("article.bs").each(function () {
const novelName = loadedCheerio(this).find(".ntitle").text().trim();
let image = loadedCheerio(this).find("img");
const novelCover = image.attr("data-src") || image.attr("src");
const novelUrl = loadedCheerio(this).find("a").attr("href");
if (!novelUrl) return;
const novel = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
}
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
const url = novelUrl;
const headers = new Headers();
const result = await fetchApi(url, { headers });
const body = await result.text();
let loadedCheerio = parseHTML(body);
const novel: Plugin.SourceNovel = {
url,
chapters: [],
};
novel.name = loadedCheerio(".entry-title").text();
novel.cover =
loadedCheerio("img.wp-post-image").attr("data-src") ||
loadedCheerio("img.wp-post-image").attr("src");
loadedCheerio("div.spe > span").each(function () {
const detailName = loadedCheerio(this).find("b").text().trim();
const detail = loadedCheerio(this)
.find("b")
.remove()
.end()
.text()
.trim();
switch (detailName) {
case "Author:":
novel.author = detail;
break;
case "Status:":
novel.status = detail;
break;
}
});
novel.genres = loadedCheerio(".genxed")
.text()
.trim()
.replace(/\s/g, ",");
loadedCheerio('div[itemprop="description"] h3,p.a,strong').remove();
novel.summary = loadedCheerio('div[itemprop="description"]')
.find("br")
.replaceWith("\n")
.end()
.text();
let chapter: Plugin.ChapterItem[] = [];
loadedCheerio(".eplister")
.find("li")
.each(function () {
const chapterName =
loadedCheerio(this).find(".epl-num").text() +
" - " +
loadedCheerio(this).find(".epl-title").text();
const releaseDate = loadedCheerio(this)
.find(".epl-date")
.text()
.trim();
const chapterUrl = loadedCheerio(this).find("a").attr("href");
if (!chapterUrl) return;
chapter.push({
name: chapterName,
releaseTime: releaseDate,
url: chapterUrl,
});
});
novel.chapters = chapter.reverse();
return novel;
}
async parseChapter(chapterUrl: string): Promise<string> {
const headers = new Headers();
const result = await fetchApi(chapterUrl, { headers });
const body = await result.text();
const loadedCheerio = parseHTML(body);
let chapterText = loadedCheerio(".epcontent").html() || "";
return chapterText;
}
async searchNovels(
searchTerm: string,
pageNo?: number | undefined
): Promise<Plugin.NovelItem[]> {
const url = `${this.site}?s=${searchTerm}`;
const headers = new Headers();
const result = await fetchApi(url, { headers });
const body = await result.text();
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio("article.bs").each(function () {
const novelName = loadedCheerio(this).find(".ntitle").text().trim();
const novelCover = loadedCheerio(this).find("img").attr("src");
const novelUrl = loadedCheerio(this).find("a").attr("href");
if (!novelUrl) return;
novels.push({
name: novelName,
url: novelUrl,
cover: novelCover,
});
});
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
return await fetchFile(url);
}
filters = {
order: {
label: "Sort By",
type: FilterTypes.Picker,
options: [
{ label: "Default", value: "" },
{ label: "A-Z", value: "title" },
{ label: "Z-A", value: "titlereverse" },
{ label: "Latest Update", value: "update" },
{ label: "Latest Added", value: "latest" },
{ label: "Popular", value: "popular" },
],
value: "",
},
status: {
label: "Status",
options: [
{ label: "All", value: "" },
{ label: "Ongoing", value: "ongoing" },
{ label: "Hiatus", value: "hiatus" },
{ label: "Completed", value: "completed" },
],
type: FilterTypes.Picker,
value: "",
},
type: {
label: "Type",
options: [
{ label: "Chinese novel", value: "chinese-novel" },
{ label: "habyeol", value: "habyeol" },
{ label: "korean novel", value: "korean-novel" },
{ label: "Web Novel", value: "web-novel" },
{ label: "삼심", value: "%ec%82%bc%ec%8b%ac" },
{ label: "호곡", value: "%ed%98%b8%ea%b3%a1" },
],
type: FilterTypes.CheckboxGroup,
value: [],
},
genres: {
label: "Genres",
value: [],
options: [
{ label: "A.I", value: "a.i" },
{ label: "Academy", value: "academy" },
{ label: "Action", value: "action" },
{ label: "Adult", value: "adult" },
{ label: "Adventure", value: "adventure" },
{ label: "Alternative History", value: "alternative-history" },
{ label: "Another World", value: "another-world" },
{ label: "Apocalypse", value: "apocalypse" },
{ label: "Bromance", value: "bromance" },
{ label: "Comedy", value: "comedy" },
{ label: "Dark fantasy", value: "dark-fantasy" },
{ label: "Demons", value: "demons" },
{ label: "Drama", value: "drama" },
{ label: "Dystopia", value: "dystopia" },
{ label: "Ecchi", value: "ecchi" },
{ label: "Entertainment", value: "entertainment" },
{ label: "Exhaustion", value: "exhaustion" },
{ label: "Fanfiction", value: "fanfiction" },
{ label: "fantasy", value: "fantasy" },
{ label: "finance", value: "finance" },
{ label: "Full color", value: "full-color" },
{ label: "Game", value: "game" },
{ label: "Gender Bender", value: "gender-bender" },
{ label: "Genius", value: "genius" },
{ label: "Harem", value: "harem" },
{ label: "Hero", value: "hero" },
{ label: "Historical", value: "historical" },
{ label: "Hunter", value: "hunter" },
{ label: "korean novel", value: "korean-novel" },
{ label: "Light Novel", value: "light-novel" },
{
label: "List Adventure Manga Genres",
value: "list-adventure-manga-genres",
},
{ label: "Long Strip", value: "long-strip" },
{ label: "Love comedy", value: "love-comedy" },
{ label: "magic", value: "magic" },
{ label: "Manhua", value: "manhua" },
{ label: "Martial Arts", value: "martial-arts" },
{ label: "Mature", value: "mature" },
{ label: "Medieval", value: "medieval" },
{ label: "Misunderstanding", value: "misunderstanding" },
{ label: "Modern", value: "modern" },
{ label: "modern fantasy", value: "modern-fantasy" },
{ label: "music", value: "music" },
{ label: "Mystery", value: "mystery" },
{ label: "Necromancy", value: "necromancy" },
{ label: "No Romance", value: "no-romance" },
{ label: "NTL", value: "ntl" },
{ label: "o", value: "o" },
{ label: "Obsession", value: "obsession" },
{ label: "Politics", value: "politics" },
{ label: "Possession", value: "possession" },
{ label: "Programming", value: "programming" },
{ label: "Psychological", value: "psychological" },
{ label: "Pure Love", value: "pure-love" },
{ label: "Redemption", value: "redemption" },
{ label: "Regression", value: "regression" },
{ label: "Regret", value: "regret" },
{ label: "Reincarnation", value: "reincarnation" },
{ label: "Revenge", value: "revenge" },
{ label: "Romance", value: "romance" },
{ label: "Romance Fanrasy", value: "romance-fanrasy" },
{ label: "Salvation", value: "salvation" },
{ label: "School Life", value: "school-life" },
{ label: "Sci-fi", value: "sci-fi" },
{ label: "Science fiction", value: "science-fiction" },
{ label: "Seinen", value: "seinen" },
{ label: "Shounen", value: "shounen" },
{ label: "Slice of Life", value: "slice-of-life" },
{ label: "Soft yandere", value: "soft-yandere" },
{ label: "Sports", value: "sports" },
{ label: "Supernatural", value: "supernatural" },
{ label: "Survival", value: "survival" },
{ label: "system", value: "system" },
{ label: "Time limit", value: "time-limit" },
{ label: "Tragedy", value: "tragedy" },
{ label: "Transmigration", value: "transmigration" },
{ label: "TS", value: "ts" },
{ label: "Tsundere", value: "tsundere" },
{ label: "Unique", value: "unique" },
{ label: "Wholesome", value: "wholesome" },
{ label: "Wuxia", value: "wuxia" },
{ label: "Xuanhuan", value: "xuanhuan" },
{ label: "Yandere", value: "yandere" },
{ label: "Yuri", value: "yuri" },
],
type: FilterTypes.CheckboxGroup,
},
} satisfies Filters;
}
const Noble = new NobleMTL();
export default new NobleMTL();
+267 -280
View File
@@ -1,280 +1,267 @@
import { load as parseHTML } from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import { FilterTypes, Filters } from "@libs/filterInputs";
import { Plugin } from "@typings/plugin";
class PandaMTL implements Plugin.PluginBase {
id = "pandamtl";
name = "PandaMTL";
icon = "src/en/wordpress/icon.png";
site = "https://pandamtl.com/";
version = "1.0.0";
userAgent = "";
cookieString = "";
async popularNovels(
pageNo: number,
{ filters }: Plugin.PopularNovelsOptions<typeof this.filters>
): Promise<Plugin.NovelItem[]> {
let link = `${this.site}series/?page=${pageNo}`;
if (filters.genres.value.length) {
link += filters.genres.value.map((i) => `&genre[]=${i}`).join("");
}
if (filters.type.value.length)
link += filters.type.value.map((i) => `&lang[]=${i}`).join("");
link += "&status=" + (filters?.status ? filters.status : "");
link += "&order=" + (filters?.order ? filters.order : "popular");
const headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
const body = await fetchApi(link, { headers }).then((result) =>
result.text()
);
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio("article.maindet").each(function () {
const novelName = loadedCheerio(this).find("h2").text();
let image = loadedCheerio(this).find("img");
const novelCover = image.attr("data-src") || image.attr("src");
const novelUrl = loadedCheerio(this).find("h2 a").attr("href");
if (!novelUrl) return;
const novel = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
}
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
const url = novelUrl;
const headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
const result = await fetchApi(url, { headers });
const body = await result.text();
let loadedCheerio = parseHTML(body);
const novel: Plugin.SourceNovel = {
url,
chapters: [],
};
novel.name = loadedCheerio("h1.entry-title").text();
novel.cover =
loadedCheerio("img.wp-post-image").attr("data-src") ||
loadedCheerio("img.wp-post-image").attr("src");
loadedCheerio(".serl:nth-child(3) > span").each(function () {
const detailName = loadedCheerio(this).text().trim();
const detail = loadedCheerio(this).next().text().trim();
switch (detailName) {
case "Author":
novel.author = detail;
break;
}
});
novel.status = loadedCheerio(".sertostat > span").attr("class");
novel.genres = loadedCheerio(".sertogenre")
.children("a")
.map((i, el) => loadedCheerio(el).text())
.toArray()
.join(",");
novel.summary = loadedCheerio(".sersys")
.find("br")
.replaceWith("\n")
.end()
.text();
let chapter: Plugin.ChapterItem[] = [];
loadedCheerio(".eplister")
.find("li")
.each(function () {
const chapterName =
loadedCheerio(this).find(".epl-num").text() +
" - " +
loadedCheerio(this).find(".epl-title").text();
const releaseDate = loadedCheerio(this)
.find(".epl-date")
.text()
.trim();
const chapterUrl = loadedCheerio(this).find("a").attr("href");
if (!chapterUrl) return;
chapter.push({
name: chapterName,
releaseTime: releaseDate,
url: chapterUrl,
});
});
novel.chapters = chapter.reverse();
return novel;
}
async parseChapter(chapterUrl: string): Promise<string> {
const headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
const result = await fetchApi(chapterUrl, { headers });
const body = await result.text();
const loadedCheerio = parseHTML(body);
let chapterText = loadedCheerio(".epcontent").html() || "";
return chapterText;
}
async searchNovels(
searchTerm: string,
pageNo?: number | undefined
): Promise<Plugin.NovelItem[]> {
const url = `${this.site}?s=${searchTerm}`;
const headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
const result = await fetchApi(url, { headers });
const body = await result.text();
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio("article.maindet").each(function () {
const novelName = loadedCheerio(this).find("h2").text();
let image = loadedCheerio(this).find("img");
const novelCover = image.attr("data-src") || image.attr("src");
const novelUrl = loadedCheerio(this).find("h2 a").attr("href");
if (!novelUrl) return;
novels.push({
name: novelName,
url: novelUrl,
cover: novelCover,
});
});
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
return await fetchFile(url);
}
filters = {
order: {
label: "Sort By",
value: "",
options: [
{ label: "Default", value: "" },
{ label: "A-Z", value: "title" },
{ label: "Z-A", value: "titlereverse" },
{ label: "Latest Update", value: "update" },
{ label: "Latest Added", value: "latest" },
{ label: "Popular", value: "popular" },
],
type: FilterTypes.Picker,
},
status: {
label: "Status",
value: "",
options: [
{ label: "All", value: "" },
{ label: "Ongoing", value: "ongoing" },
{ label: "Hiatus", value: "hiatus" },
{ label: "Completed", value: "completed" },
],
type: FilterTypes.Picker,
},
type: {
value: [],
label: "Type",
options: [
{ label: "Light Novel (KR)", value: "light-novel-kr" },
{ label: "Web Novel", value: "web-novel" },
],
type: FilterTypes.CheckboxGroup,
},
genres: {
label: "Genres",
value: [],
options: [
{ label: "Action", value: "action" },
{ label: "Adult", value: "adult" },
{ label: "Adventure", value: "adventure" },
{ label: "Comedy", value: "comedy" },
{ label: "Ecchi", value: "ecchi" },
{ label: "Fantasy", value: "fantasy" },
{ label: "Harem", value: "harem" },
{ label: "Josei", value: "josei" },
{ label: "Martial Arts", value: "martial-arts" },
{ label: "Mature", value: "mature" },
{ label: "Romance", value: "romance" },
{ label: "School Life", value: "school-life" },
{ label: "Sci-fi", value: "sci-fi" },
{ label: "Seinen", value: "seinen" },
{ label: "Slice of Life", value: "slice-of-life" },
{ label: "Smut", value: "smut" },
{ label: "Sports", value: "sports" },
{ label: "Supernatural", value: "supernatural" },
{ label: "Tragedy", value: "tragedy" },
],
type: FilterTypes.CheckboxGroup,
},
} satisfies Filters;
}
export default new PandaMTL();
import { load as parseHTML } from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import { FilterTypes, Filters } from "@libs/filterInputs";
import { Plugin } from "@typings/plugin";
class PandaMTL implements Plugin.PluginBase {
id = "pandamtl";
name = "PandaMTL";
icon = "src/en/wordpress/icon.png";
site = "https://pandamtl.com/";
version = "1.0.0";
userAgent = "";
async popularNovels(
pageNo: number,
{ filters }: Plugin.PopularNovelsOptions<typeof this.filters>
): Promise<Plugin.NovelItem[]> {
let link = `${this.site}series/?page=${pageNo}`;
if (filters.genres.value.length) {
link += filters.genres.value.map((i) => `&genre[]=${i}`).join("");
}
if (filters.type.value.length)
link += filters.type.value.map((i) => `&lang[]=${i}`).join("");
link += "&status=" + (filters?.status ? filters.status : "");
link += "&order=" + (filters?.order ? filters.order : "popular");
const headers = new Headers();
const body = await fetchApi(link, { headers }).then((result) =>
result.text()
);
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio("article.maindet").each(function () {
const novelName = loadedCheerio(this).find("h2").text();
let image = loadedCheerio(this).find("img");
const novelCover = image.attr("data-src") || image.attr("src");
const novelUrl = loadedCheerio(this).find("h2 a").attr("href");
if (!novelUrl) return;
const novel = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
}
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
const url = novelUrl;
const headers = new Headers();
const result = await fetchApi(url, { headers });
const body = await result.text();
let loadedCheerio = parseHTML(body);
const novel: Plugin.SourceNovel = {
url,
chapters: [],
};
novel.name = loadedCheerio("h1.entry-title").text();
novel.cover =
loadedCheerio("img.wp-post-image").attr("data-src") ||
loadedCheerio("img.wp-post-image").attr("src");
loadedCheerio(".serl:nth-child(3) > span").each(function () {
const detailName = loadedCheerio(this).text().trim();
const detail = loadedCheerio(this).next().text().trim();
switch (detailName) {
case "Author":
novel.author = detail;
break;
}
});
novel.status = loadedCheerio(".sertostat > span").attr("class");
novel.genres = loadedCheerio(".sertogenre")
.children("a")
.map((i, el) => loadedCheerio(el).text())
.toArray()
.join(",");
novel.summary = loadedCheerio(".sersys")
.find("br")
.replaceWith("\n")
.end()
.text();
let chapter: Plugin.ChapterItem[] = [];
loadedCheerio(".eplister")
.find("li")
.each(function () {
const chapterName =
loadedCheerio(this).find(".epl-num").text() +
" - " +
loadedCheerio(this).find(".epl-title").text();
const releaseDate = loadedCheerio(this)
.find(".epl-date")
.text()
.trim();
const chapterUrl = loadedCheerio(this).find("a").attr("href");
if (!chapterUrl) return;
chapter.push({
name: chapterName,
releaseTime: releaseDate,
url: chapterUrl,
});
});
novel.chapters = chapter.reverse();
return novel;
}
async parseChapter(chapterUrl: string): Promise<string> {
const headers = new Headers();
const result = await fetchApi(chapterUrl, { headers });
const body = await result.text();
const loadedCheerio = parseHTML(body);
let chapterText = loadedCheerio(".epcontent").html() || "";
return chapterText;
}
async searchNovels(
searchTerm: string,
pageNo?: number | undefined
): Promise<Plugin.NovelItem[]> {
const url = `${this.site}?s=${searchTerm}`;
const headers = new Headers();
const result = await fetchApi(url, { headers });
const body = await result.text();
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio("article.maindet").each(function () {
const novelName = loadedCheerio(this).find("h2").text();
let image = loadedCheerio(this).find("img");
const novelCover = image.attr("data-src") || image.attr("src");
const novelUrl = loadedCheerio(this).find("h2 a").attr("href");
if (!novelUrl) return;
novels.push({
name: novelName,
url: novelUrl,
cover: novelCover,
});
});
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
return await fetchFile(url);
}
filters = {
order: {
label: "Sort By",
value: "",
options: [
{ label: "Default", value: "" },
{ label: "A-Z", value: "title" },
{ label: "Z-A", value: "titlereverse" },
{ label: "Latest Update", value: "update" },
{ label: "Latest Added", value: "latest" },
{ label: "Popular", value: "popular" },
],
type: FilterTypes.Picker,
},
status: {
label: "Status",
value: "",
options: [
{ label: "All", value: "" },
{ label: "Ongoing", value: "ongoing" },
{ label: "Hiatus", value: "hiatus" },
{ label: "Completed", value: "completed" },
],
type: FilterTypes.Picker,
},
type: {
value: [],
label: "Type",
options: [
{ label: "Light Novel (KR)", value: "light-novel-kr" },
{ label: "Web Novel", value: "web-novel" },
],
type: FilterTypes.CheckboxGroup,
},
genres: {
label: "Genres",
value: [],
options: [
{ label: "Action", value: "action" },
{ label: "Adult", value: "adult" },
{ label: "Adventure", value: "adventure" },
{ label: "Comedy", value: "comedy" },
{ label: "Ecchi", value: "ecchi" },
{ label: "Fantasy", value: "fantasy" },
{ label: "Harem", value: "harem" },
{ label: "Josei", value: "josei" },
{ label: "Martial Arts", value: "martial-arts" },
{ label: "Mature", value: "mature" },
{ label: "Romance", value: "romance" },
{ label: "School Life", value: "school-life" },
{ label: "Sci-fi", value: "sci-fi" },
{ label: "Seinen", value: "seinen" },
{ label: "Slice of Life", value: "slice-of-life" },
{ label: "Smut", value: "smut" },
{ label: "Sports", value: "sports" },
{ label: "Supernatural", value: "supernatural" },
{ label: "Tragedy", value: "tragedy" },
],
type: FilterTypes.CheckboxGroup,
},
} satisfies Filters;
}
export default new PandaMTL();
+1 -2
View File
@@ -9,7 +9,7 @@ class ChireadsPlugin implements Plugin.PluginBase {
site: string;
version: string;
userAgent: string;
cookieString: string;
constructor() {
this.id = "chireads.com";
this.name = "Chireads";
@@ -17,7 +17,6 @@ class ChireadsPlugin implements Plugin.PluginBase {
this.site = "https://chireads.com";
this.version = "1.0.0";
this.userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36";
this.cookieString = "''";
}
parseNovels(loadedCheerio: CheerioAPI) {
return [];
+1 -2
View File
@@ -10,7 +10,7 @@ class NovelDeGlacePlugin implements Plugin.PluginBase{
site: string;
version: string;
userAgent: string;
cookieString: string;
constructor() {
this.id = "NDG.com";
this.name = "NovelDeGlace";
@@ -18,7 +18,6 @@ class NovelDeGlacePlugin implements Plugin.PluginBase{
this.site = "https://noveldeglace.com/";
this.version = "1.0.0";
this.userAgent = "''";
this.cookieString = "''";
}
async popularNovels(page: number): Promise<Plugin.NovelItem[]> {
+413 -426
View File
@@ -1,426 +1,413 @@
import { load as parseHTML } from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import { FilterTypes, Filters } from "@libs/filterInputs";
import { Plugin } from "@typings/plugin";
class LightNovelBrasil implements Plugin.PluginBase {
id = "lightnovelbrasil";
name = "Light Novel Brasil";
icon = "multisrc/wpmangastream/icons/lightnovelbrasil.png";
site = "https://lightnovelbrasil.com/";
version = "1.0.0";
userAgent = "";
cookieString = "";
async popularNovels(
pageNo: number,
{ filters }: Plugin.PopularNovelsOptions<typeof this.filters>
): Promise<Plugin.NovelItem[]> {
let link = `${this.site}series/?page=${pageNo}`;
if (filters.genres.value.length)
link += filters.genres.value.map((i) => `&genre[]=${i}`).join("");
if (filters.type.value.length)
link += filters.type.value.map((i) => `&lang[]=${i}`).join("");
link += "&status=" + (filters?.status ? filters.status : "");
link += "&order=" + (filters?.order ? filters.order : "popular");
const headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
const body = await fetchApi(link, { headers }).then((result) =>
result.text()
);
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio("article.bs").each(function () {
const novelName = loadedCheerio(this).find(".ntitle").text().trim();
let image = loadedCheerio(this).find("img");
const novelCover = image.attr("data-src") || image.attr("src");
const novelUrl = loadedCheerio(this).find("a").attr("href");
if (!novelUrl) return;
const novel = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
}
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
const url = novelUrl;
const headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
const result = await fetchApi(url, { headers });
const body = await result.text();
let loadedCheerio = parseHTML(body);
const novel: Plugin.SourceNovel = {
url,
chapters: [],
};
novel.name = loadedCheerio(".entry-title").text();
novel.cover =
loadedCheerio("img.wp-post-image").attr("data-src") ||
loadedCheerio("img.wp-post-image").attr("src");
loadedCheerio("div.spe > span").each(function () {
const detailName = loadedCheerio(this).find("b").text().trim();
const detail = loadedCheerio(this)
.find("b")
.remove()
.end()
.text()
.trim();
switch (detailName) {
case "Autor:":
case "Author:":
novel.author = detail;
break;
case "Status:":
novel.status = detail;
break;
}
});
novel.genres = loadedCheerio(".genxed")
.text()
.trim()
.replace(/\s/g, ",");
loadedCheerio('div[itemprop="description"] h3,p.a,strong').remove();
novel.summary = loadedCheerio('div[itemprop="description"]')
.find("br")
.replaceWith("\n")
.end()
.text();
let chapter: Plugin.ChapterItem[] = [];
loadedCheerio(".eplister")
.find("li")
.each(function () {
const chapterName =
loadedCheerio(this).find(".epl-num").text() +
" - " +
loadedCheerio(this).find(".epl-title").text();
const releaseDate = loadedCheerio(this)
.find(".epl-date")
.text()
.trim();
const chapterUrl = loadedCheerio(this).find("a").attr("href");
if (!chapterUrl) return;
chapter.push({
name: chapterName,
releaseTime: releaseDate,
url: chapterUrl,
});
});
novel.chapters = chapter.reverse();
return novel;
}
async parseChapter(chapterUrl: string): Promise<string> {
const headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
const result = await fetchApi(chapterUrl, { headers });
const body = await result.text();
const loadedCheerio = parseHTML(body);
let chapterText = loadedCheerio(".epcontent").html() || "";
return chapterText;
}
async searchNovels(
searchTerm: string,
pageNo?: number | undefined
): Promise<Plugin.NovelItem[]> {
const url = `${this.site}?s=${searchTerm}`;
const headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
const result = await fetchApi(url, { headers });
const body = await result.text();
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio("article.bs").each(function () {
const novelName = loadedCheerio(this).find(".ntitle").text().trim();
const novelCover = loadedCheerio(this).find("img").attr("src");
const novelUrl = loadedCheerio(this).find("a").attr("href");
if (!novelUrl) return;
novels.push({
name: novelName,
url: novelUrl,
cover: novelCover,
});
});
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
return await fetchFile(url);
}
filters = {
order: {
label: "Sort By",
value: "",
options: [
{ label: "Default", value: "" },
{ label: "A-Z", value: "title" },
{ label: "Z-A", value: "titlereverse" },
{ label: "Latest Update", value: "update" },
{ label: "Latest Added", value: "latest" },
{ label: "Popular", value: "popular" },
],
type: FilterTypes.Picker,
},
status: {
label: "Status",
value: "",
options: [
{ label: "All", value: "" },
{ label: "Ongoing", value: "ongoing" },
{ label: "Hiatus", value: "hiatus" },
{ label: "Completed", value: "completed" },
],
type: FilterTypes.Picker,
},
type: {
label: "Type",
value: [],
options: [
{ label: "Chinese novel", value: "chinese-novel" },
{ label: "habyeol", value: "habyeol" },
{ label: "korean novel", value: "korean-novel" },
{ label: "Web Novel", value: "web-novel" },
{ label: "삼심", value: "%ec%82%bc%ec%8b%ac" },
{ label: "호곡", value: "%ed%98%b8%ea%b3%a1" },
],
type: FilterTypes.CheckboxGroup,
},
genres: {
value: [],
label: "Genres",
options: [
{ label: "A.I", value: "a.i" },
{ label: "Academy", value: "academy" },
{ label: "Action", value: "action" },
{ label: "Adult", value: "adult" },
{ label: "Adventure", value: "adventure" },
{ label: "Alternative History", value: "alternative-history" },
{ label: "Another World", value: "another-world" },
{ label: "Apocalypse", value: "apocalypse" },
{ label: "Bromance", value: "bromance" },
{ label: "Comedy", value: "comedy" },
{ label: "Dark fantasy", value: "dark-fantasy" },
{ label: "Demons", value: "demons" },
{ label: "Drama", value: "drama" },
{ label: "Dystopia", value: "dystopia" },
{ label: "Ecchi", value: "ecchi" },
{ label: "Entertainment", value: "entertainment" },
{ label: "Exhaustion", value: "exhaustion" },
{ label: "Fanfiction", value: "fanfiction" },
{ label: "fantasy", value: "fantasy" },
{ label: "finance", value: "finance" },
{ label: "Full color", value: "full-color" },
{ label: "Game", value: "game" },
{ label: "Gender Bender", value: "gender-bender" },
{ label: "Genius", value: "genius" },
{ label: "Harem", value: "harem" },
{ label: "Hero", value: "hero" },
{ label: "Historical", value: "historical" },
{ label: "Hunter", value: "hunter" },
{ label: "korean novel", value: "korean-novel" },
{ label: "Light Novel", value: "light-novel" },
{
label: "List Adventure Manga Genres",
value: "list-adventure-manga-genres",
},
{ label: "Long Strip", value: "long-strip" },
{ label: "Love comedy", value: "love-comedy" },
{ label: "magic", value: "magic" },
{ label: "Manhua", value: "manhua" },
{ label: "Martial Arts", value: "martial-arts" },
{ label: "Mature", value: "mature" },
{ label: "Medieval", value: "medieval" },
{ label: "Misunderstanding", value: "misunderstanding" },
{ label: "Modern", value: "modern" },
{ label: "modern fantasy", value: "modern-fantasy" },
{ label: "music", value: "music" },
{ label: "Mystery", value: "mystery" },
{ label: "Necromancy", value: "necromancy" },
{ label: "No Romance", value: "no-romance" },
{ label: "NTL", value: "ntl" },
{ label: "o", value: "o" },
{ label: "Obsession", value: "obsession" },
{ label: "Politics", value: "politics" },
{ label: "Possession", value: "possession" },
{ label: "Programming", value: "programming" },
{ label: "Psychological", value: "psychological" },
{ label: "Pure Love", value: "pure-love" },
{ label: "Redemption", value: "redemption" },
{ label: "Regression", value: "regression" },
{ label: "Regret", value: "regret" },
{ label: "Reincarnation", value: "reincarnation" },
{ label: "Revenge", value: "revenge" },
{ label: "Romance", value: "romance" },
{ label: "Romance Fanrasy", value: "romance-fanrasy" },
{ label: "Salvation", value: "salvation" },
{ label: "School Life", value: "school-life" },
{ label: "Sci-fi", value: "sci-fi" },
{ label: "Science fiction", value: "science-fiction" },
{ label: "Seinen", value: "seinen" },
{ label: "Shounen", value: "shounen" },
{ label: "Slice of Life", value: "slice-of-life" },
{ label: "Soft yandere", value: "soft-yandere" },
{ label: "Sports", value: "sports" },
{ label: "Supernatural", value: "supernatural" },
{ label: "Survival", value: "survival" },
{ label: "system", value: "system" },
{ label: "Time limit", value: "time-limit" },
{ label: "Tragedy", value: "tragedy" },
{ label: "Transmigration", value: "transmigration" },
{ label: "TS", value: "ts" },
{ label: "Tsundere", value: "tsundere" },
{ label: "Unique", value: "unique" },
{ label: "Wholesome", value: "wholesome" },
{ label: "Wuxia", value: "wuxia" },
{ label: "Xuanhuan", value: "xuanhuan" },
{ label: "Yandere", value: "yandere" },
{ label: "Yuri", value: "yuri" },
],
type: FilterTypes.CheckboxGroup,
},
} satisfies Filters;
}
export default new LightNovelBrasil();
import { load as parseHTML } from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import { FilterTypes, Filters } from "@libs/filterInputs";
import { Plugin } from "@typings/plugin";
class LightNovelBrasil implements Plugin.PluginBase {
id = "lightnovelbrasil";
name = "Light Novel Brasil";
icon = "multisrc/wpmangastream/icons/lightnovelbrasil.png";
site = "https://lightnovelbrasil.com/";
version = "1.0.0";
userAgent = "";
async popularNovels(
pageNo: number,
{ filters }: Plugin.PopularNovelsOptions<typeof this.filters>
): Promise<Plugin.NovelItem[]> {
let link = `${this.site}series/?page=${pageNo}`;
if (filters.genres.value.length)
link += filters.genres.value.map((i) => `&genre[]=${i}`).join("");
if (filters.type.value.length)
link += filters.type.value.map((i) => `&lang[]=${i}`).join("");
link += "&status=" + (filters?.status ? filters.status : "");
link += "&order=" + (filters?.order ? filters.order : "popular");
const headers = new Headers();
const body = await fetchApi(link, { headers }).then((result) =>
result.text()
);
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio("article.bs").each(function () {
const novelName = loadedCheerio(this).find(".ntitle").text().trim();
let image = loadedCheerio(this).find("img");
const novelCover = image.attr("data-src") || image.attr("src");
const novelUrl = loadedCheerio(this).find("a").attr("href");
if (!novelUrl) return;
const novel = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
}
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
const url = novelUrl;
const headers = new Headers();
const result = await fetchApi(url, { headers });
const body = await result.text();
let loadedCheerio = parseHTML(body);
const novel: Plugin.SourceNovel = {
url,
chapters: [],
};
novel.name = loadedCheerio(".entry-title").text();
novel.cover =
loadedCheerio("img.wp-post-image").attr("data-src") ||
loadedCheerio("img.wp-post-image").attr("src");
loadedCheerio("div.spe > span").each(function () {
const detailName = loadedCheerio(this).find("b").text().trim();
const detail = loadedCheerio(this)
.find("b")
.remove()
.end()
.text()
.trim();
switch (detailName) {
case "Autor:":
case "Author:":
novel.author = detail;
break;
case "Status:":
novel.status = detail;
break;
}
});
novel.genres = loadedCheerio(".genxed")
.text()
.trim()
.replace(/\s/g, ",");
loadedCheerio('div[itemprop="description"] h3,p.a,strong').remove();
novel.summary = loadedCheerio('div[itemprop="description"]')
.find("br")
.replaceWith("\n")
.end()
.text();
let chapter: Plugin.ChapterItem[] = [];
loadedCheerio(".eplister")
.find("li")
.each(function () {
const chapterName =
loadedCheerio(this).find(".epl-num").text() +
" - " +
loadedCheerio(this).find(".epl-title").text();
const releaseDate = loadedCheerio(this)
.find(".epl-date")
.text()
.trim();
const chapterUrl = loadedCheerio(this).find("a").attr("href");
if (!chapterUrl) return;
chapter.push({
name: chapterName,
releaseTime: releaseDate,
url: chapterUrl,
});
});
novel.chapters = chapter.reverse();
return novel;
}
async parseChapter(chapterUrl: string): Promise<string> {
const headers = new Headers();
const result = await fetchApi(chapterUrl, { headers });
const body = await result.text();
const loadedCheerio = parseHTML(body);
let chapterText = loadedCheerio(".epcontent").html() || "";
return chapterText;
}
async searchNovels(
searchTerm: string,
pageNo?: number | undefined
): Promise<Plugin.NovelItem[]> {
const url = `${this.site}?s=${searchTerm}`;
const headers = new Headers();
const result = await fetchApi(url, { headers });
const body = await result.text();
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio("article.bs").each(function () {
const novelName = loadedCheerio(this).find(".ntitle").text().trim();
const novelCover = loadedCheerio(this).find("img").attr("src");
const novelUrl = loadedCheerio(this).find("a").attr("href");
if (!novelUrl) return;
novels.push({
name: novelName,
url: novelUrl,
cover: novelCover,
});
});
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
return await fetchFile(url);
}
filters = {
order: {
label: "Sort By",
value: "",
options: [
{ label: "Default", value: "" },
{ label: "A-Z", value: "title" },
{ label: "Z-A", value: "titlereverse" },
{ label: "Latest Update", value: "update" },
{ label: "Latest Added", value: "latest" },
{ label: "Popular", value: "popular" },
],
type: FilterTypes.Picker,
},
status: {
label: "Status",
value: "",
options: [
{ label: "All", value: "" },
{ label: "Ongoing", value: "ongoing" },
{ label: "Hiatus", value: "hiatus" },
{ label: "Completed", value: "completed" },
],
type: FilterTypes.Picker,
},
type: {
label: "Type",
value: [],
options: [
{ label: "Chinese novel", value: "chinese-novel" },
{ label: "habyeol", value: "habyeol" },
{ label: "korean novel", value: "korean-novel" },
{ label: "Web Novel", value: "web-novel" },
{ label: "삼심", value: "%ec%82%bc%ec%8b%ac" },
{ label: "호곡", value: "%ed%98%b8%ea%b3%a1" },
],
type: FilterTypes.CheckboxGroup,
},
genres: {
value: [],
label: "Genres",
options: [
{ label: "A.I", value: "a.i" },
{ label: "Academy", value: "academy" },
{ label: "Action", value: "action" },
{ label: "Adult", value: "adult" },
{ label: "Adventure", value: "adventure" },
{ label: "Alternative History", value: "alternative-history" },
{ label: "Another World", value: "another-world" },
{ label: "Apocalypse", value: "apocalypse" },
{ label: "Bromance", value: "bromance" },
{ label: "Comedy", value: "comedy" },
{ label: "Dark fantasy", value: "dark-fantasy" },
{ label: "Demons", value: "demons" },
{ label: "Drama", value: "drama" },
{ label: "Dystopia", value: "dystopia" },
{ label: "Ecchi", value: "ecchi" },
{ label: "Entertainment", value: "entertainment" },
{ label: "Exhaustion", value: "exhaustion" },
{ label: "Fanfiction", value: "fanfiction" },
{ label: "fantasy", value: "fantasy" },
{ label: "finance", value: "finance" },
{ label: "Full color", value: "full-color" },
{ label: "Game", value: "game" },
{ label: "Gender Bender", value: "gender-bender" },
{ label: "Genius", value: "genius" },
{ label: "Harem", value: "harem" },
{ label: "Hero", value: "hero" },
{ label: "Historical", value: "historical" },
{ label: "Hunter", value: "hunter" },
{ label: "korean novel", value: "korean-novel" },
{ label: "Light Novel", value: "light-novel" },
{
label: "List Adventure Manga Genres",
value: "list-adventure-manga-genres",
},
{ label: "Long Strip", value: "long-strip" },
{ label: "Love comedy", value: "love-comedy" },
{ label: "magic", value: "magic" },
{ label: "Manhua", value: "manhua" },
{ label: "Martial Arts", value: "martial-arts" },
{ label: "Mature", value: "mature" },
{ label: "Medieval", value: "medieval" },
{ label: "Misunderstanding", value: "misunderstanding" },
{ label: "Modern", value: "modern" },
{ label: "modern fantasy", value: "modern-fantasy" },
{ label: "music", value: "music" },
{ label: "Mystery", value: "mystery" },
{ label: "Necromancy", value: "necromancy" },
{ label: "No Romance", value: "no-romance" },
{ label: "NTL", value: "ntl" },
{ label: "o", value: "o" },
{ label: "Obsession", value: "obsession" },
{ label: "Politics", value: "politics" },
{ label: "Possession", value: "possession" },
{ label: "Programming", value: "programming" },
{ label: "Psychological", value: "psychological" },
{ label: "Pure Love", value: "pure-love" },
{ label: "Redemption", value: "redemption" },
{ label: "Regression", value: "regression" },
{ label: "Regret", value: "regret" },
{ label: "Reincarnation", value: "reincarnation" },
{ label: "Revenge", value: "revenge" },
{ label: "Romance", value: "romance" },
{ label: "Romance Fanrasy", value: "romance-fanrasy" },
{ label: "Salvation", value: "salvation" },
{ label: "School Life", value: "school-life" },
{ label: "Sci-fi", value: "sci-fi" },
{ label: "Science fiction", value: "science-fiction" },
{ label: "Seinen", value: "seinen" },
{ label: "Shounen", value: "shounen" },
{ label: "Slice of Life", value: "slice-of-life" },
{ label: "Soft yandere", value: "soft-yandere" },
{ label: "Sports", value: "sports" },
{ label: "Supernatural", value: "supernatural" },
{ label: "Survival", value: "survival" },
{ label: "system", value: "system" },
{ label: "Time limit", value: "time-limit" },
{ label: "Tragedy", value: "tragedy" },
{ label: "Transmigration", value: "transmigration" },
{ label: "TS", value: "ts" },
{ label: "Tsundere", value: "tsundere" },
{ label: "Unique", value: "unique" },
{ label: "Wholesome", value: "wholesome" },
{ label: "Wuxia", value: "wuxia" },
{ label: "Xuanhuan", value: "xuanhuan" },
{ label: "Yandere", value: "yandere" },
{ label: "Yuri", value: "yuri" },
],
type: FilterTypes.CheckboxGroup,
},
} satisfies Filters;
}
export default new LightNovelBrasil();
+241 -242
View File
@@ -1,242 +1,241 @@
import { Plugin } from "@typings/plugin";
import { FilterTypes, Filters } from "@libs/filterInputs";
import { fetchApi, fetchFile } from "@libs/fetch";
import { NovelStatus } from "@libs/novelStatus";
import { load as parseHTML } from "cheerio";
class freedlit implements Plugin.PluginBase {
id = "freedlit.space";
name = "LitSpace";
site = "https://freedlit.space";
version = "1.0.0";
icon = "src/ru/freedlit/icon.png";
userAgent = "";
cookieString = "";
async popularNovels(
page: number,
{ showLatestNovels, filters }: Plugin.PopularNovelsOptions<typeof this.filters>,
): Promise<Plugin.NovelItem[]> {
let url = this.site + "/get-books/all/list/" + page + "?sort=";
url += showLatestNovels ? "recent" : filters?.sort?.value || "popular";
url += "&status=" + (filters?.status?.value || "all");
url += "&access=" + (filters?.access?.value || "all");
url += "&adult=" + (filters?.adult?.value || "hide");
if (filters?.genre?.value?.include?.length) {
url += filters.genre.value.include
.map(id => '&genres_included[]=' + id).join("");
}
if (filters?.genre?.value?.exclude?.length) {
url += filters.genre.value.exclude
.map(id => '&genres_excluded[]=' + id).join("");
}
const body = await fetchApi(url).then((res) => res.text());
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio("#bookListBlock > div > div").each(function () {
const name = loadedCheerio(this).find("div > h4 > a").text()?.trim();
const cover = loadedCheerio(this)
.find("div > a > img")
.attr("src")
?.trim();
const url = loadedCheerio(this).find("div > h4 > a").attr("href")?.trim();
if (!name || !url) return;
novels.push({ name, cover, url });
});
return novels;
}
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
const body = await fetchApi(novelUrl).then((res) => res.text());
const loadedCheerio = parseHTML(body);
const novel: Plugin.SourceNovel = {
url: novelUrl,
name: loadedCheerio(".book-info h4").text(),
cover: loadedCheerio(".book-cover > div > img").attr("src")?.trim(),
summary: loadedCheerio("#nav-home").text()?.trim(),
author: loadedCheerio(".book-info h5 > a").text(),
genres: loadedCheerio(".genre-list > a")
.map((index, element) => loadedCheerio(element).text())
.get()
.join(","),
};
const chapters: Plugin.ChapterItem[] = [];
loadedCheerio("a.chapter-line").each(function () {
const name = loadedCheerio(this).find("h6").text();
const releaseTime = loadedCheerio(this).find('span[class="date"]').text();
const url = loadedCheerio(this).attr("href");
if (!name || !url) return;
chapters.push({ name, releaseTime, url });
});
novel.chapters = chapters;
return novel;
}
async parseChapter(chapterUrl: string): Promise<string> {
const body = await fetchApi(chapterUrl).then((res) => res.text());
const loadedCheerio = parseHTML(body);
loadedCheerio("div.mobile-block").remove();
loadedCheerio("div.standart-block").remove();
const chapterText = loadedCheerio('div[class="chapter"]').html() || "";
return chapterText;
}
async searchNovels(searchTerm: string): Promise<Plugin.NovelItem[]> {
const url = `${this.site}/search?query=${searchTerm}&type=all`;
const body = await fetchApi(url).then((res) => res.text());
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio("#bookListBlock > div").each(function () {
const name = loadedCheerio(this).find("h4 > a").text()?.trim();
const cover = loadedCheerio(this).find("a > img").attr("src")?.trim();
const url = loadedCheerio(this).find("h4 > a").attr("href")?.trim();
if (!name || !url) return;
novels.push({ name, cover, url });
});
return novels;
}
fetchImage = fetchFile;
filters = {
sort: {
label: "Сортировка:",
value: "",
options: [
{ label: "По популярности", value: "popular" },
{ label: "По количеству комментариев", value: "comments" },
{ label: "По количеству лайков", value: "likes" },
{ label: "По новизне", value: "recent" },
{ label: "По просмотрам", value: "views" },
],
type: FilterTypes.Picker,
},
genre: {
label: "Жанры:",
value: { include: [], exclude: [] },
options: [
{ label: "Любой жанр", value: "all" },
{ label: "Альтернативная история", value: "alternative-history" },
{ label: "Антиутопия", value: "dystopia" },
{ label: "Бизнес-литература", value: "business-literature" },
{ label: "Боевая фантастика", value: "combat-fiction" },
{ label: "Боевик", value: "action" },
{ label: "Боевое фэнтези", value: "combat-fantasy" },
{ label: "Бояръ-Аниме", value: "boyar-anime" },
{ label: "Героическая фантастика", value: "heroic-fiction" },
{ label: "Героическое фэнтези", value: "heroic-fantasy" },
{ label: "Городское фэнтези", value: "urban-fantasy" },
{ label: "Гримдарк", value: "grimdark" },
{ label: "Детектив", value: "mystery" },
{ label: "Детская литература", value: "kids-literature" },
{ label: "Документальная проза", value: "biography" },
{ label: "Историческая проза", value: "historical-fiction" },
{ label: "Исторический детектив", value: "historical-mystery" },
{ label: "Исторический любовный роман", value: "historical-romantic-novel" },
{ label: "Историческое фэнтези", value: "historical-fantasy" },
{ label: "Киберпанк", value: "cyberpunk" },
{ label: "Космическая фантастика", value: "cosmic-fiction" },
{ label: "ЛитРПГ", value: "litrpg" },
{ label: "Лоу / Низкое фэнтези", value: "low-fantasy" },
{ label: "Любовное фэнтези", value: "romantic-fantasy" },
{ label: "Любовный роман", value: "romantic-novel" },
{ label: "Мистика", value: "mystic" },
{ label: "Мистический детектив", value: "mystic-detective" },
{ label: "Научная фантастика", value: "science-fiction" },
{ label: "Подростковая проза", value: "young-adult" },
{ label: "Политический роман", value: "political-romance" },
{ label: "Попаданцы", value: "accidental-travel" },
{ label: "Попаданцы в магические миры", value: "magic-worlds-travel" },
{ label: "Попаданцы во времени", value: "time-travel" },
{ label: "Порнотика", value: "pornotica" },
{ label: "Постапокалипсис", value: "post-apocalypse" },
{ label: "Поэзия", value: "poetry" },
{ label: "Приключения", value: "adventure" },
{ label: "Публицистика", value: "journalism" },
{ label: "Пьеса", value: "play" },
{ label: "Развитие личности", value: "how-to-book" },
{ label: "Разное", value: "other" },
{ label: "Реализм", value: "Realism" },
{ label: "РеалРПГ", value: "realrpg" },
{ label: "Репликация", value: "replication" },
{ label: "Романтическая эротика", value: "romantic-erotic-fiction" },
{ label: "Сказка", value: "fairy-tale" },
{ label: "Слэш", value: "slash" },
{ label: "Современная проза", value: "modern-prose" },
{ label: "Современный любовный роман", value: "modern-romantic-novel" },
{ label: "Социальная фантастика", value: "social-fiction" },
{ label: "Стимпанк", value: "steampunk" },
{ label: "Сценарий", value: "scenario" },
{ label: "Сюаньхуань", value: "xuanhuan" },
{ label: "Сянься", value: "xianxia" },
{ label: "Тёмное фэнтези", value: "dark-fantasy" },
{ label: "Триллер", value: "thriller" },
{ label: "Уся", value: "wuxia" },
{ label: "Фантастика", value: "fiction" },
{ label: "Фантастический детектив", value: "mystery-fiction" },
{ label: "Фанфик", value: "fan-fiction" },
{ label: "Фемслэш", value: "femslash" },
{ label: "Фэнтези", value: "fantasy" },
{ label: "Хоррор", value: "horror" },
{ label: "Шпионский детектив", value: "spy-crime" },
{ label: "Эпическое фэнтези", value: "epic-fantasy" },
{ label: "Эротика", value: "erotic-fiction" },
{ label: "Эротическая фантастика", value: "erotic-fiction" },
{ label: "Эротический фанфик", value: "erotic-fan-fiction" },
{ label: "Эротическое фэнтези", value: "erotic-fantasy" },
{ label: "Этническое фэнтези", value: "ethnic-fantasy" },
{ label: "Юмор", value: "humor" },
{ label: "Юмористическая фантастика", value: "humor-fiction" },
{ label: "Юмористическое фэнтези", value: "humor-fantasy" },
{ label: "RPS", value: "rps" },
],
type: FilterTypes.ExcludableCheckboxGroup,
},
status: {
label: "Статус:",
value: "",
options: [
{ label: "Любой статус", value: "all" },
{ label: "В процессе", value: "in-process" },
{ label: "Завершено", value: "finished" },
],
type: FilterTypes.Picker,
},
access: {
label: "Доступ:",
value: "",
options: [
{ label: "Любой доступ", value: "all" },
{ label: "Бесплатные", value: "free" },
{ label: "Платные", value: "paid" },
],
type: FilterTypes.Picker,
},
adult: {
label: "Возрастные ограничения:",
value: "",
options: [
{ label: "Скрыть 18+", value: "hide" },
{ label: "Показать +18", value: "show" },
],
type: FilterTypes.Picker,
},
} satisfies Filters;
}
export default new freedlit();
import { Plugin } from "@typings/plugin";
import { FilterTypes, Filters } from "@libs/filterInputs";
import { fetchApi, fetchFile } from "@libs/fetch";
import { NovelStatus } from "@libs/novelStatus";
import { load as parseHTML } from "cheerio";
class freedlit implements Plugin.PluginBase {
id = "freedlit.space";
name = "LitSpace";
site = "https://freedlit.space";
version = "1.0.0";
icon = "src/ru/freedlit/icon.png";
userAgent = "";
async popularNovels(
page: number,
{ showLatestNovels, filters }: Plugin.PopularNovelsOptions<typeof this.filters>,
): Promise<Plugin.NovelItem[]> {
let url = this.site + "/get-books/all/list/" + page + "?sort=";
url += showLatestNovels ? "recent" : filters?.sort?.value || "popular";
url += "&status=" + (filters?.status?.value || "all");
url += "&access=" + (filters?.access?.value || "all");
url += "&adult=" + (filters?.adult?.value || "hide");
if (filters?.genre?.value?.include?.length) {
url += filters.genre.value.include
.map(id => '&genres_included[]=' + id).join("");
}
if (filters?.genre?.value?.exclude?.length) {
url += filters.genre.value.exclude
.map(id => '&genres_excluded[]=' + id).join("");
}
const body = await fetchApi(url).then((res) => res.text());
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio("#bookListBlock > div > div").each(function () {
const name = loadedCheerio(this).find("div > h4 > a").text()?.trim();
const cover = loadedCheerio(this)
.find("div > a > img")
.attr("src")
?.trim();
const url = loadedCheerio(this).find("div > h4 > a").attr("href")?.trim();
if (!name || !url) return;
novels.push({ name, cover, url });
});
return novels;
}
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
const body = await fetchApi(novelUrl).then((res) => res.text());
const loadedCheerio = parseHTML(body);
const novel: Plugin.SourceNovel = {
url: novelUrl,
name: loadedCheerio(".book-info h4").text(),
cover: loadedCheerio(".book-cover > div > img").attr("src")?.trim(),
summary: loadedCheerio("#nav-home").text()?.trim(),
author: loadedCheerio(".book-info h5 > a").text(),
genres: loadedCheerio(".genre-list > a")
.map((index, element) => loadedCheerio(element).text())
.get()
.join(","),
};
const chapters: Plugin.ChapterItem[] = [];
loadedCheerio("a.chapter-line").each(function () {
const name = loadedCheerio(this).find("h6").text();
const releaseTime = loadedCheerio(this).find('span[class="date"]').text();
const url = loadedCheerio(this).attr("href");
if (!name || !url) return;
chapters.push({ name, releaseTime, url });
});
novel.chapters = chapters;
return novel;
}
async parseChapter(chapterUrl: string): Promise<string> {
const body = await fetchApi(chapterUrl).then((res) => res.text());
const loadedCheerio = parseHTML(body);
loadedCheerio("div.mobile-block").remove();
loadedCheerio("div.standart-block").remove();
const chapterText = loadedCheerio('div[class="chapter"]').html() || "";
return chapterText;
}
async searchNovels(searchTerm: string): Promise<Plugin.NovelItem[]> {
const url = `${this.site}/search?query=${searchTerm}&type=all`;
const body = await fetchApi(url).then((res) => res.text());
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio("#bookListBlock > div").each(function () {
const name = loadedCheerio(this).find("h4 > a").text()?.trim();
const cover = loadedCheerio(this).find("a > img").attr("src")?.trim();
const url = loadedCheerio(this).find("h4 > a").attr("href")?.trim();
if (!name || !url) return;
novels.push({ name, cover, url });
});
return novels;
}
fetchImage = fetchFile;
filters = {
sort: {
label: "Сортировка:",
value: "",
options: [
{ label: "По популярности", value: "popular" },
{ label: "По количеству комментариев", value: "comments" },
{ label: "По количеству лайков", value: "likes" },
{ label: "По новизне", value: "recent" },
{ label: "По просмотрам", value: "views" },
],
type: FilterTypes.Picker,
},
genre: {
label: "Жанры:",
value: { include: [], exclude: [] },
options: [
{ label: "Любой жанр", value: "all" },
{ label: "Альтернативная история", value: "alternative-history" },
{ label: "Антиутопия", value: "dystopia" },
{ label: "Бизнес-литература", value: "business-literature" },
{ label: "Боевая фантастика", value: "combat-fiction" },
{ label: "Боевик", value: "action" },
{ label: "Боевое фэнтези", value: "combat-fantasy" },
{ label: "Бояръ-Аниме", value: "boyar-anime" },
{ label: "Героическая фантастика", value: "heroic-fiction" },
{ label: "Героическое фэнтези", value: "heroic-fantasy" },
{ label: "Городское фэнтези", value: "urban-fantasy" },
{ label: "Гримдарк", value: "grimdark" },
{ label: "Детектив", value: "mystery" },
{ label: "Детская литература", value: "kids-literature" },
{ label: "Документальная проза", value: "biography" },
{ label: "Историческая проза", value: "historical-fiction" },
{ label: "Исторический детектив", value: "historical-mystery" },
{ label: "Исторический любовный роман", value: "historical-romantic-novel" },
{ label: "Историческое фэнтези", value: "historical-fantasy" },
{ label: "Киберпанк", value: "cyberpunk" },
{ label: "Космическая фантастика", value: "cosmic-fiction" },
{ label: "ЛитРПГ", value: "litrpg" },
{ label: "Лоу / Низкое фэнтези", value: "low-fantasy" },
{ label: "Любовное фэнтези", value: "romantic-fantasy" },
{ label: "Любовный роман", value: "romantic-novel" },
{ label: "Мистика", value: "mystic" },
{ label: "Мистический детектив", value: "mystic-detective" },
{ label: "Научная фантастика", value: "science-fiction" },
{ label: "Подростковая проза", value: "young-adult" },
{ label: "Политический роман", value: "political-romance" },
{ label: "Попаданцы", value: "accidental-travel" },
{ label: "Попаданцы в магические миры", value: "magic-worlds-travel" },
{ label: "Попаданцы во времени", value: "time-travel" },
{ label: "Порнотика", value: "pornotica" },
{ label: "Постапокалипсис", value: "post-apocalypse" },
{ label: "Поэзия", value: "poetry" },
{ label: "Приключения", value: "adventure" },
{ label: "Публицистика", value: "journalism" },
{ label: "Пьеса", value: "play" },
{ label: "Развитие личности", value: "how-to-book" },
{ label: "Разное", value: "other" },
{ label: "Реализм", value: "Realism" },
{ label: "РеалРПГ", value: "realrpg" },
{ label: "Репликация", value: "replication" },
{ label: "Романтическая эротика", value: "romantic-erotic-fiction" },
{ label: "Сказка", value: "fairy-tale" },
{ label: "Слэш", value: "slash" },
{ label: "Современная проза", value: "modern-prose" },
{ label: "Современный любовный роман", value: "modern-romantic-novel" },
{ label: "Социальная фантастика", value: "social-fiction" },
{ label: "Стимпанк", value: "steampunk" },
{ label: "Сценарий", value: "scenario" },
{ label: "Сюаньхуань", value: "xuanhuan" },
{ label: "Сянься", value: "xianxia" },
{ label: "Тёмное фэнтези", value: "dark-fantasy" },
{ label: "Триллер", value: "thriller" },
{ label: "Уся", value: "wuxia" },
{ label: "Фантастика", value: "fiction" },
{ label: "Фантастический детектив", value: "mystery-fiction" },
{ label: "Фанфик", value: "fan-fiction" },
{ label: "Фемслэш", value: "femslash" },
{ label: "Фэнтези", value: "fantasy" },
{ label: "Хоррор", value: "horror" },
{ label: "Шпионский детектив", value: "spy-crime" },
{ label: "Эпическое фэнтези", value: "epic-fantasy" },
{ label: "Эротика", value: "erotic-fiction" },
{ label: "Эротическая фантастика", value: "erotic-fiction" },
{ label: "Эротический фанфик", value: "erotic-fan-fiction" },
{ label: "Эротическое фэнтези", value: "erotic-fantasy" },
{ label: "Этническое фэнтези", value: "ethnic-fantasy" },
{ label: "Юмор", value: "humor" },
{ label: "Юмористическая фантастика", value: "humor-fiction" },
{ label: "Юмористическое фэнтези", value: "humor-fantasy" },
{ label: "RPS", value: "rps" },
],
type: FilterTypes.ExcludableCheckboxGroup,
},
status: {
label: "Статус:",
value: "",
options: [
{ label: "Любой статус", value: "all" },
{ label: "В процессе", value: "in-process" },
{ label: "Завершено", value: "finished" },
],
type: FilterTypes.Picker,
},
access: {
label: "Доступ:",
value: "",
options: [
{ label: "Любой доступ", value: "all" },
{ label: "Бесплатные", value: "free" },
{ label: "Платные", value: "paid" },
],
type: FilterTypes.Picker,
},
adult: {
label: "Возрастные ограничения:",
value: "",
options: [
{ label: "Скрыть 18+", value: "hide" },
{ label: "Показать +18", value: "show" },
],
type: FilterTypes.Picker,
},
} satisfies Filters;
}
export default new freedlit();
File diff suppressed because it is too large Load Diff
+258 -259
View File
@@ -1,259 +1,258 @@
import { Plugin } from "@typings/plugin";
import { FilterTypes, Filters } from "@libs/filterInputs";
import { fetchApi, fetchFile } from "@libs/fetch";
import { NovelStatus } from "@libs/novelStatus";
import { load as parseHTML } from "cheerio";
import dayjs from "dayjs";
class Bookriver implements Plugin.PluginBase {
id = "bookriver";
name = "Bookriver";
site = "https://bookriver.ru";
version = "1.0.0";
icon = "src/ru/bookriver/icon.png";
userAgent = "";
cookieString = "";
async popularNovels(
pageNo: number,
{ showLatestNovels, filters }: Plugin.PopularNovelsOptions,
): Promise<Plugin.NovelItem[]> {
let url = this.site + `/genre?page=${pageNo}&perPage=24&sortingType=`;
url += showLatestNovels
? "last-update"
: filters?.sort?.value || "bestseller";
if (filters?.genres?.value instanceof Array && filters?.genres?.value.length) {
url += "&g=" + filters.genres.value.join(",");
}
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
const jsonRaw = loadedCheerio("#__NEXT_DATA__").html();
if (jsonRaw) {
const json: response = JSON.parse(jsonRaw);
json.props.pageProps.state.pagesFilter?.genre?.books?.forEach((novel) =>
novels.push({
name: novel.name,
cover: novel.coverImages[0].url,
url: this.site + "/book/" + novel.slug,
}),
);
}
return novels;
}
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
const result = await fetchApi(novelUrl);
const body = await result.text();
const loadedCheerio = parseHTML(body);
const jsonRaw = loadedCheerio("#__NEXT_DATA__").html();
const json: response = JSON.parse(jsonRaw || "{}");
const book = json.props.pageProps.state.book?.bookPage;
const novel: Plugin.SourceNovel = {
url: novelUrl,
name: book?.name,
cover: book?.coverImages[0].url,
summary: book?.annotation,
author: book?.author?.name,
genres: book?.tags?.map((item) => item.name).join(", "),
status:
book?.statusComplete === "writing"
? NovelStatus.Ongoing
: NovelStatus.Completed,
};
const chapters: Plugin.ChapterItem[] = [];
book?.ebook?.chapters?.forEach((chapter) => {
if (chapter.available) {
chapters.push({
name: chapter.name,
releaseTime: dayjs(
chapter?.firstPublishedAt || chapter.createdAt,
).format("LLL"),
url: this.site + "/reader/" + book?.slug + "/" + chapter.chapterId,
});
}
});
novel.chapters = chapters;
return novel;
}
async parseChapter(chapterUrl: string): Promise<string> {
const url = "https://api.bookriver.ru/api/v1/books/chapter/text/";
const result = await fetchApi(url + chapterUrl.split("/").pop());
const json = (await result.json()) as responseChapter;
let chapterText = json.data.content || "Конец произведения";
if (json.data?.audio?.available) {
chapterText += "\n" + json.data.audio.url;
}
return chapterText;
}
async searchNovels(
searchTerm: string,
pageNo: number | undefined = 1,
): Promise<Plugin.NovelItem[]> {
const url = `https://api.bookriver.ru/api/v1/search/autocomplete?keyword=${searchTerm}&page=${pageNo}&perPage=10`;
const result = await fetchApi(url);
const json = (await result.json()) as responseSearch;
const novels: Plugin.NovelItem[] = [];
json?.data?.books?.forEach((novel) =>
novels.push({
name: novel.name,
cover: novel.coverImages[0].url,
url: this.site + "/book/" + novel.slug,
}),
);
return novels;
}
fetchImage = fetchFile;
filters = {
sort: {
label: "Сортировка",
value: "",
options: [
{ label: "Бестселлеры", value: "bestseller" },
{ label: "Дате добавления", value: "newest" },
{ label: "Дате обновления", value: "last-update" },
],
type: FilterTypes.Picker,
},
genres: {
label: "жанры",
value: [],
options: [
{ label: "Альтернативная история", value: "alternativnaya-istoriya" },
{ label: "Боевая фантастика", value: "boevaya-fantastika" },
{ label: "Боевое фэнтези", value: "boevoe-fentezi" },
{ label: "Бытовое фэнтези", value: "bytovoe-fentezi" },
{ label: "Героическая фантастика", value: "geroicheskaya-fantastika" },
{ label: "Героическое фэнтези", value: "geroicheskoe-fentezi" },
{ label: "Городское фэнтези", value: "gorodskoe-fentezi" },
{ label: "Детектив", value: "detektiv" },
{ label: "Детективная фантастика", value: "detektivnaya-fantastika" },
{ label: "Жёсткая эротика", value: "zhyostkaya-erotika" },
{ label: "Исторический детектив", value: "istoricheskii-detektiv" },
{ label: "Исторический любовный роман", value: "istoricheskii-lyubovnyi-roman" },
{ label: "Историческое фэнтези", value: "istoricheskoe-fentezi" },
{ label: "Киберпанк", value: "kiberpank" },
{ label: "Классический детектив", value: "klassicheskii-detektiv" },
{ label: "Короткий любовный роман", value: "korotkii-lyubovnyi-roman" },
{ label: "Космическая фантастика", value: "kosmicheskaya-fantastika" },
{ label: "Криминальный детектив", value: "kriminalnyi-detektiv" },
{ label: "ЛитРПГ", value: "litrpg" },
{ label: "Любовная фантастика", value: "lyubovnaya-fantastika" },
{ label: "Любовное фэнтези", value: "lyubovnoe-fentezi" },
{ label: "Любовный роман", value: "lyubovnyi-roman" },
{ label: "Мистика", value: "mistika" },
{ label: "Молодежная проза", value: "molodezhnaya-proza" },
{ label: "Научная фантастика", value: "nauchnaya-fantastika" },
{ label: "Остросюжетный любовный роман", value: "ostrosyuzhetnyi-lyubovnyi-roman" },
{ label: "Политический детектив", value: "politicheskii-detektiv" },
{ label: "Попаданцы", value: "popadantsy" },
{ label: "Постапокалипсис", value: "postapokalipsis" },
{ label: "Приключенческое фэнтези", value: "priklyuchencheskoe-fentezi" },
{ label: "Романтическая эротика", value: "romanticheskaya-erotika" },
{ label: "С элементами эротики", value: "s-elementami-erotiki" },
{ label: "Славянское фэнтези", value: "slavyanskoe-fentezi" },
{ label: "Современный любовный роман", value: "sovremennyi-lyubovnyi-roman" },
{ label: "Социальная фантастика", value: "sotsialnaya-fantastika" },
{ label: "Тёмное фэнтези", value: "temnoe-fentezi" },
{ label: "Фантастика", value: "fantastika" },
{ label: "Фэнтези", value: "fentezi" },
{ label: "Шпионский детектив", value: "shpionskii-detektiv" },
{ label: "Эпическое фэнтези", value: "epicheskoe-fentezi" },
{ label: "Эротика", value: "erotika" },
{ label: "Эротическая фантастика", value: "eroticheskaya-fantastika" },
{ label: "Эротический фанфик", value: "eroticheskii-fanfik" },
{ label: "Эротическое фэнтези", value: "eroticheskoe-fentezi" },
{ label: "Юмористический детектив", value: "yumoristicheskii-detektiv" },
{ label: "Юмористическое фэнтези", value: "yumoristicheskoe-fentezi" },
],
type: FilterTypes.CheckboxGroup,
},
} satisfies Filters;
}
export default new Bookriver();
interface response {
props: {
pageProps: {
state: {
book?: {
bookPage: BooksEntity;
};
pagesFilter?: {
genre: {
books: BooksEntity[];
};
};
};
};
};
}
interface BooksEntity {
name: string;
coverImages: { url: string }[];
slug: string;
annotation?: string;
author?: {
name: string;
};
tags?: { name: string }[];
ebook?: {
chapters: Chapter[];
};
statusComplete: string;
}
interface Chapter {
name: string;
available: boolean;
firstPublishedAt?: Date | null;
createdAt?: Date | null;
chapterId: number | string;
}
interface responseChapter {
data: {
id: number;
bookId: number;
name: string;
content: string;
symbols: number;
number: number;
authorPages: number;
createdAt: string;
updatedAt: string;
firstPublishedAt: string;
status: string;
protected: boolean;
free: boolean;
audio?: {
available: boolean;
url: string;
duration: number;
};
publicationScheduledFor?: null;
};
}
interface responseSearch {
data: Data;
total: number;
}
interface Data {
books?: BooksEntity[] | null;
}
import { Plugin } from "@typings/plugin";
import { FilterTypes, Filters } from "@libs/filterInputs";
import { fetchApi, fetchFile } from "@libs/fetch";
import { NovelStatus } from "@libs/novelStatus";
import { load as parseHTML } from "cheerio";
import dayjs from "dayjs";
class Bookriver implements Plugin.PluginBase {
id = "bookriver";
name = "Bookriver";
site = "https://bookriver.ru";
version = "1.0.0";
icon = "src/ru/bookriver/icon.png";
userAgent = "";
async popularNovels(
pageNo: number,
{ showLatestNovels, filters }: Plugin.PopularNovelsOptions,
): Promise<Plugin.NovelItem[]> {
let url = this.site + `/genre?page=${pageNo}&perPage=24&sortingType=`;
url += showLatestNovels
? "last-update"
: filters?.sort?.value || "bestseller";
if (filters?.genres?.value instanceof Array && filters?.genres?.value.length) {
url += "&g=" + filters.genres.value.join(",");
}
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
const jsonRaw = loadedCheerio("#__NEXT_DATA__").html();
if (jsonRaw) {
const json: response = JSON.parse(jsonRaw);
json.props.pageProps.state.pagesFilter?.genre?.books?.forEach((novel) =>
novels.push({
name: novel.name,
cover: novel.coverImages[0].url,
url: this.site + "/book/" + novel.slug,
}),
);
}
return novels;
}
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
const result = await fetchApi(novelUrl);
const body = await result.text();
const loadedCheerio = parseHTML(body);
const jsonRaw = loadedCheerio("#__NEXT_DATA__").html();
const json: response = JSON.parse(jsonRaw || "{}");
const book = json.props.pageProps.state.book?.bookPage;
const novel: Plugin.SourceNovel = {
url: novelUrl,
name: book?.name,
cover: book?.coverImages[0].url,
summary: book?.annotation,
author: book?.author?.name,
genres: book?.tags?.map((item) => item.name).join(", "),
status:
book?.statusComplete === "writing"
? NovelStatus.Ongoing
: NovelStatus.Completed,
};
const chapters: Plugin.ChapterItem[] = [];
book?.ebook?.chapters?.forEach((chapter) => {
if (chapter.available) {
chapters.push({
name: chapter.name,
releaseTime: dayjs(
chapter?.firstPublishedAt || chapter.createdAt,
).format("LLL"),
url: this.site + "/reader/" + book?.slug + "/" + chapter.chapterId,
});
}
});
novel.chapters = chapters;
return novel;
}
async parseChapter(chapterUrl: string): Promise<string> {
const url = "https://api.bookriver.ru/api/v1/books/chapter/text/";
const result = await fetchApi(url + chapterUrl.split("/").pop());
const json = (await result.json()) as responseChapter;
let chapterText = json.data.content || "Конец произведения";
if (json.data?.audio?.available) {
chapterText += "\n" + json.data.audio.url;
}
return chapterText;
}
async searchNovels(
searchTerm: string,
pageNo: number | undefined = 1,
): Promise<Plugin.NovelItem[]> {
const url = `https://api.bookriver.ru/api/v1/search/autocomplete?keyword=${searchTerm}&page=${pageNo}&perPage=10`;
const result = await fetchApi(url);
const json = (await result.json()) as responseSearch;
const novels: Plugin.NovelItem[] = [];
json?.data?.books?.forEach((novel) =>
novels.push({
name: novel.name,
cover: novel.coverImages[0].url,
url: this.site + "/book/" + novel.slug,
}),
);
return novels;
}
fetchImage = fetchFile;
filters = {
sort: {
label: "Сортировка",
value: "",
options: [
{ label: "Бестселлеры", value: "bestseller" },
{ label: "Дате добавления", value: "newest" },
{ label: "Дате обновления", value: "last-update" },
],
type: FilterTypes.Picker,
},
genres: {
label: "жанры",
value: [],
options: [
{ label: "Альтернативная история", value: "alternativnaya-istoriya" },
{ label: "Боевая фантастика", value: "boevaya-fantastika" },
{ label: "Боевое фэнтези", value: "boevoe-fentezi" },
{ label: "Бытовое фэнтези", value: "bytovoe-fentezi" },
{ label: "Героическая фантастика", value: "geroicheskaya-fantastika" },
{ label: "Героическое фэнтези", value: "geroicheskoe-fentezi" },
{ label: "Городское фэнтези", value: "gorodskoe-fentezi" },
{ label: "Детектив", value: "detektiv" },
{ label: "Детективная фантастика", value: "detektivnaya-fantastika" },
{ label: "Жёсткая эротика", value: "zhyostkaya-erotika" },
{ label: "Исторический детектив", value: "istoricheskii-detektiv" },
{ label: "Исторический любовный роман", value: "istoricheskii-lyubovnyi-roman" },
{ label: "Историческое фэнтези", value: "istoricheskoe-fentezi" },
{ label: "Киберпанк", value: "kiberpank" },
{ label: "Классический детектив", value: "klassicheskii-detektiv" },
{ label: "Короткий любовный роман", value: "korotkii-lyubovnyi-roman" },
{ label: "Космическая фантастика", value: "kosmicheskaya-fantastika" },
{ label: "Криминальный детектив", value: "kriminalnyi-detektiv" },
{ label: "ЛитРПГ", value: "litrpg" },
{ label: "Любовная фантастика", value: "lyubovnaya-fantastika" },
{ label: "Любовное фэнтези", value: "lyubovnoe-fentezi" },
{ label: "Любовный роман", value: "lyubovnyi-roman" },
{ label: "Мистика", value: "mistika" },
{ label: "Молодежная проза", value: "molodezhnaya-proza" },
{ label: "Научная фантастика", value: "nauchnaya-fantastika" },
{ label: "Остросюжетный любовный роман", value: "ostrosyuzhetnyi-lyubovnyi-roman" },
{ label: "Политический детектив", value: "politicheskii-detektiv" },
{ label: "Попаданцы", value: "popadantsy" },
{ label: "Постапокалипсис", value: "postapokalipsis" },
{ label: "Приключенческое фэнтези", value: "priklyuchencheskoe-fentezi" },
{ label: "Романтическая эротика", value: "romanticheskaya-erotika" },
{ label: "С элементами эротики", value: "s-elementami-erotiki" },
{ label: "Славянское фэнтези", value: "slavyanskoe-fentezi" },
{ label: "Современный любовный роман", value: "sovremennyi-lyubovnyi-roman" },
{ label: "Социальная фантастика", value: "sotsialnaya-fantastika" },
{ label: "Тёмное фэнтези", value: "temnoe-fentezi" },
{ label: "Фантастика", value: "fantastika" },
{ label: "Фэнтези", value: "fentezi" },
{ label: "Шпионский детектив", value: "shpionskii-detektiv" },
{ label: "Эпическое фэнтези", value: "epicheskoe-fentezi" },
{ label: "Эротика", value: "erotika" },
{ label: "Эротическая фантастика", value: "eroticheskaya-fantastika" },
{ label: "Эротический фанфик", value: "eroticheskii-fanfik" },
{ label: "Эротическое фэнтези", value: "eroticheskoe-fentezi" },
{ label: "Юмористический детектив", value: "yumoristicheskii-detektiv" },
{ label: "Юмористическое фэнтези", value: "yumoristicheskoe-fentezi" },
],
type: FilterTypes.CheckboxGroup,
},
} satisfies Filters;
}
export default new Bookriver();
interface response {
props: {
pageProps: {
state: {
book?: {
bookPage: BooksEntity;
};
pagesFilter?: {
genre: {
books: BooksEntity[];
};
};
};
};
};
}
interface BooksEntity {
name: string;
coverImages: { url: string }[];
slug: string;
annotation?: string;
author?: {
name: string;
};
tags?: { name: string }[];
ebook?: {
chapters: Chapter[];
};
statusComplete: string;
}
interface Chapter {
name: string;
available: boolean;
firstPublishedAt?: Date | null;
createdAt?: Date | null;
chapterId: number | string;
}
interface responseChapter {
data: {
id: number;
bookId: number;
name: string;
content: string;
symbols: number;
number: number;
authorPages: number;
createdAt: string;
updatedAt: string;
firstPublishedAt: string;
status: string;
protected: boolean;
free: boolean;
audio?: {
available: boolean;
url: string;
duration: number;
};
publicationScheduledFor?: null;
};
}
interface responseSearch {
data: Data;
total: number;
}
interface Data {
books?: BooksEntity[] | null;
}
+2643 -2644
View File
File diff suppressed because it is too large Load Diff
+264 -265
View File
@@ -1,265 +1,264 @@
import { Plugin } from "@typings/plugin";
import { FilterTypes, Filters } from "@libs/filterInputs";
import { fetchApi, fetchFile } from "@libs/fetch";
import { NovelStatus } from "@libs/novelStatus";
import { load as parseHTML } from "cheerio";
class Jaomix implements Plugin.PluginBase {
id = "jaomix.ru";
name = "Jaomix";
site = "https://jaomix.ru";
version = "1.0.0";
icon = "src/ru/jaomix/icon.png";
userAgent = "";
cookieString = "";
async popularNovels(
pageNo: number,
{
showLatestNovels,
filters,
}: Plugin.PopularNovelsOptions<typeof this.filters>,
): Promise<Plugin.NovelItem[]> {
let url = this.site + "/?searchrn";
if (filters?.lang?.value?.length) {
url += filters.lang.value
.map((lang, idx) => `&lang[${idx}]=${lang}`).join("");
}
if (filters?.genre?.value?.include?.length) {
url += filters.genre.value.include
.map((genre, idx) => `&genre[${idx}]=${genre}`).join("");
}
if (filters?.genre?.value?.exclude?.length) {
url += filters.genre.value.exclude
.map((genre, idx) => `&delgenre[${idx}]=del ${genre}`).join("");
}
url += "&sortcountchapt=" + (filters?.sortcountchapt?.value || "1");
url += "&sortdaycreate=" + (filters?.sortdaycreate?.value || "1");
url +=
"&sortby=" + (showLatestNovels ? "upd" : filters?.sortby?.value || "topweek");
url += "&gpage=" + pageNo;
const body = await fetchApi(url).then((res) => res.text());
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio('div[class="block-home"] > div[class="one"]').each(
function () {
const name = loadedCheerio(this)
.find('div[class="img-home"] > a')
.attr("title");
const cover = loadedCheerio(this)
.find('div[class="img-home"] > a > img')
.attr("src")
?.replace("-150x150", "");
const url = loadedCheerio(this)
.find('div[class="img-home"] > a')
.attr("href");
if (!name || !url) return;
novels.push({ name, cover, url });
},
);
return novels;
}
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
const body = await fetchApi(novelUrl).then((res) => res.text());
const loadedCheerio = parseHTML(body);
const novel: Plugin.SourceNovel = {
url: novelUrl,
name: loadedCheerio('div[class="desc-book"] > h1').text().trim(),
cover: loadedCheerio('div[class="img-book"] > img').attr("src"),
summary: loadedCheerio('div[id="desc-tab"]').text().trim()
};
loadedCheerio("#info-book > p").each(function () {
let text = loadedCheerio(this).text().replace(/,/g, "").split(" ");
if (text[0] === "Автор:") {
novel.author = text.splice(1).join(" ");
} else if (text[0] === "Жанры:") {
novel.genres = text.splice(1).join(",");
} else if (text[0] === "Статус:") {
novel.status = text.includes("продолжается")
? NovelStatus.Ongoing
: NovelStatus.Completed;
}
});
const chapters: Plugin.ChapterItem[] = [];
loadedCheerio(".download-chapter div.title").each(function () {
const name = loadedCheerio(this).find("a").attr("title");
const releaseTime = loadedCheerio(this).find("time").text();
const url = loadedCheerio(this).find("a").attr("href");
if (!name || !url) return;
chapters.push({ name, releaseTime, url });
});
novel.chapters = chapters.reverse();
return novel;
}
async parseChapter(chapterUrl: string): Promise<string> {
const body = await fetchApi(chapterUrl).then((res) => res.text());
const loadedCheerio = parseHTML(body);
loadedCheerio('div[class="adblock-service"]').remove();
const chapterText = loadedCheerio('div[class="entry-content"]').html();
return chapterText || "";
}
async searchNovels(
searchTerm: string,
pageNo: number | undefined = 1,
): Promise<Plugin.NovelItem[]> {
const url = `${this.site}/?searchrn=${searchTerm}&but=Поиск по названию&sortby=upd&gpage=${pageNo}`;
const body = await fetchApi(url).then((res) => res.text());
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio('div[class="block-home"] > div[class="one"]').each(
function () {
const name = loadedCheerio(this)
.find('div[class="img-home"] > a')
.attr("title");
const cover = loadedCheerio(this)
.find('div[class="img-home"] > a > img')
.attr("src")
?.replace("-150x150", "");
const url = loadedCheerio(this)
.find('div[class="img-home"] > a')
.attr("href");
if (!name || !url) return;
novels.push({ name, cover, url });
},
);
return novels;
}
fetchImage = fetchFile;
filters = {
sortby: {
label: "Сортировка:",
value: "topweek",
options: [
{ label: "Топ недели", value: "topweek" },
{ label: "По алфавиту", value: "alphabet" },
{ label: "По дате обновления", value: "upd" },
{ label: "По дате создания", value: "new" },
{ label: "По просмотрам", value: "count" },
{ label: "Топ года", value: "topyear" },
{ label: "Топ дня", value: "topday" },
{ label: "Топ за все время", value: "alltime" },
{ label: "Топ месяца", value: "topmonth" },
],
type: FilterTypes.Picker,
},
sortdaycreate: {
label: "Дата добавления:",
value: "1",
options: [
{ label: "Любое", value: "1" },
{ label: "От 120 до 180 дней", value: "1218" },
{ label: "От 180 до 365 дней", value: "1836" },
{ label: "От 30 до 60 дней", value: "3060" },
{ label: "От 365 дней", value: "365" },
{ label: "От 60 до 90 дней", value: "6090" },
{ label: "От 90 до 120 дней", value: "9012" },
{ label: "Послед. 30 дней", value: "30" },
],
type: FilterTypes.Picker,
},
sortcountchapt: {
label: "Количество глав:",
value: "1",
options: [
{ label: "Любое кол-во глав", value: "1" },
{ label: "До 500", value: "500" },
{ label: "От 1000 до 2000", value: "1020" },
{ label: "От 2000 до 3000", value: "2030" },
{ label: "От 3000 до 4000", value: "3040" },
{ label: "От 4000", value: "400" },
{ label: "От 500 до 1000", value: "510" },
],
type: FilterTypes.Picker,
},
genre: {
label: "Жанры:",
value: { include: [], exclude: [] },
options: [
{ label: "Боевые Искусства", value: "Боевые Искусства" },
{ label: "Виртуальный Мир", value: "Виртуальный Мир" },
{ label: "Гарем", value: "Гарем" },
{ label: "Детектив", value: "Детектив" },
{ label: "Драма", value: "Драма" },
{ label: "Игра", value: "Игра" },
{ label: "Истории из жизни", value: "Истории из жизни" },
{ label: "Исторический", value: "Исторический" },
{ label: "История", value: "История" },
{ label: "Исэкай", value: "Исэкай" },
{ label: "Комедия", value: "Комедия" },
{ label: "Меха", value: "Меха" },
{ label: "Мистика", value: "Мистика" },
{ label: "Научная Фантастика", value: "Научная Фантастика" },
{ label: "Повседневность", value: "Повседневность" },
{ label: "Постапокалипсис", value: "Постапокалипсис" },
{ label: "Приключения", value: "Приключения" },
{ label: "Психология", value: "Психология" },
{ label: "Романтика", value: "Романтика" },
{ label: "Сверхъестественное", value: "Сверхъестественное" },
{ label: "Сёнэн", value: "Сёнэн" },
{ label: "Сёнэн-ай", value: "Сёнэн-ай" },
{ label: "Спорт", value: "Спорт" },
{ label: "Сэйнэн", value: "Сэйнэн" },
{ label: "Сюаньхуа", value: "Сюаньхуа" },
{ label: "Трагедия", value: "Трагедия" },
{ label: "Триллер", value: "Триллер" },
{ label: "Фантастика", value: "Фантастика" },
{ label: "Фэнтези", value: "Фэнтези" },
{ label: "Хоррор", value: "Хоррор" },
{ label: "Школьная жизнь", value: "Школьная жизнь" },
{ label: "Шоунен", value: "Шоунен" },
{ label: "Экшн", value: "Экшн" },
{ label: "Этти", value: "Этти" },
{ label: "Юри", value: "Юри" },
{ label: "Adult", value: "Adult" },
{ label: "Ecchi", value: "Ecchi" },
{ label: "Josei", value: "Josei" },
{ label: "Lolicon", value: "Lolicon" },
{ label: "Mature", value: "Mature" },
{ label: "Shoujo", value: "Shoujo" },
{ label: "Wuxia", value: "Wuxia" },
{ label: "Xianxia", value: "Xianxia" },
{ label: "Xuanhuan", value: "Xuanhuan" },
{ label: "Yaoi", value: "Yaoi" },
],
type: FilterTypes.ExcludableCheckboxGroup,
},
lang: {
label: "Выбрать языки:",
value: [],
options: [
{ label: "Английский", value: "Английский" },
{ label: "Китайский", value: "Китайский" },
{ label: "Корейский", value: "Корейский" },
{ label: "Японский", value: "Японский" },
],
type: FilterTypes.CheckboxGroup,
},
} satisfies Filters;
}
export default new Jaomix();
import { Plugin } from "@typings/plugin";
import { FilterTypes, Filters } from "@libs/filterInputs";
import { fetchApi, fetchFile } from "@libs/fetch";
import { NovelStatus } from "@libs/novelStatus";
import { load as parseHTML } from "cheerio";
class Jaomix implements Plugin.PluginBase {
id = "jaomix.ru";
name = "Jaomix";
site = "https://jaomix.ru";
version = "1.0.0";
icon = "src/ru/jaomix/icon.png";
userAgent = "";
async popularNovels(
pageNo: number,
{
showLatestNovels,
filters,
}: Plugin.PopularNovelsOptions<typeof this.filters>,
): Promise<Plugin.NovelItem[]> {
let url = this.site + "/?searchrn";
if (filters?.lang?.value?.length) {
url += filters.lang.value
.map((lang, idx) => `&lang[${idx}]=${lang}`).join("");
}
if (filters?.genre?.value?.include?.length) {
url += filters.genre.value.include
.map((genre, idx) => `&genre[${idx}]=${genre}`).join("");
}
if (filters?.genre?.value?.exclude?.length) {
url += filters.genre.value.exclude
.map((genre, idx) => `&delgenre[${idx}]=del ${genre}`).join("");
}
url += "&sortcountchapt=" + (filters?.sortcountchapt?.value || "1");
url += "&sortdaycreate=" + (filters?.sortdaycreate?.value || "1");
url +=
"&sortby=" + (showLatestNovels ? "upd" : filters?.sortby?.value || "topweek");
url += "&gpage=" + pageNo;
const body = await fetchApi(url).then((res) => res.text());
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio('div[class="block-home"] > div[class="one"]').each(
function () {
const name = loadedCheerio(this)
.find('div[class="img-home"] > a')
.attr("title");
const cover = loadedCheerio(this)
.find('div[class="img-home"] > a > img')
.attr("src")
?.replace("-150x150", "");
const url = loadedCheerio(this)
.find('div[class="img-home"] > a')
.attr("href");
if (!name || !url) return;
novels.push({ name, cover, url });
},
);
return novels;
}
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
const body = await fetchApi(novelUrl).then((res) => res.text());
const loadedCheerio = parseHTML(body);
const novel: Plugin.SourceNovel = {
url: novelUrl,
name: loadedCheerio('div[class="desc-book"] > h1').text().trim(),
cover: loadedCheerio('div[class="img-book"] > img').attr("src"),
summary: loadedCheerio('div[id="desc-tab"]').text().trim()
};
loadedCheerio("#info-book > p").each(function () {
let text = loadedCheerio(this).text().replace(/,/g, "").split(" ");
if (text[0] === "Автор:") {
novel.author = text.splice(1).join(" ");
} else if (text[0] === "Жанры:") {
novel.genres = text.splice(1).join(",");
} else if (text[0] === "Статус:") {
novel.status = text.includes("продолжается")
? NovelStatus.Ongoing
: NovelStatus.Completed;
}
});
const chapters: Plugin.ChapterItem[] = [];
loadedCheerio(".download-chapter div.title").each(function () {
const name = loadedCheerio(this).find("a").attr("title");
const releaseTime = loadedCheerio(this).find("time").text();
const url = loadedCheerio(this).find("a").attr("href");
if (!name || !url) return;
chapters.push({ name, releaseTime, url });
});
novel.chapters = chapters.reverse();
return novel;
}
async parseChapter(chapterUrl: string): Promise<string> {
const body = await fetchApi(chapterUrl).then((res) => res.text());
const loadedCheerio = parseHTML(body);
loadedCheerio('div[class="adblock-service"]').remove();
const chapterText = loadedCheerio('div[class="entry-content"]').html();
return chapterText || "";
}
async searchNovels(
searchTerm: string,
pageNo: number | undefined = 1,
): Promise<Plugin.NovelItem[]> {
const url = `${this.site}/?searchrn=${searchTerm}&but=Поиск по названию&sortby=upd&gpage=${pageNo}`;
const body = await fetchApi(url).then((res) => res.text());
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio('div[class="block-home"] > div[class="one"]').each(
function () {
const name = loadedCheerio(this)
.find('div[class="img-home"] > a')
.attr("title");
const cover = loadedCheerio(this)
.find('div[class="img-home"] > a > img')
.attr("src")
?.replace("-150x150", "");
const url = loadedCheerio(this)
.find('div[class="img-home"] > a')
.attr("href");
if (!name || !url) return;
novels.push({ name, cover, url });
},
);
return novels;
}
fetchImage = fetchFile;
filters = {
sortby: {
label: "Сортировка:",
value: "topweek",
options: [
{ label: "Топ недели", value: "topweek" },
{ label: "По алфавиту", value: "alphabet" },
{ label: "По дате обновления", value: "upd" },
{ label: "По дате создания", value: "new" },
{ label: "По просмотрам", value: "count" },
{ label: "Топ года", value: "topyear" },
{ label: "Топ дня", value: "topday" },
{ label: "Топ за все время", value: "alltime" },
{ label: "Топ месяца", value: "topmonth" },
],
type: FilterTypes.Picker,
},
sortdaycreate: {
label: "Дата добавления:",
value: "1",
options: [
{ label: "Любое", value: "1" },
{ label: "От 120 до 180 дней", value: "1218" },
{ label: "От 180 до 365 дней", value: "1836" },
{ label: "От 30 до 60 дней", value: "3060" },
{ label: "От 365 дней", value: "365" },
{ label: "От 60 до 90 дней", value: "6090" },
{ label: "От 90 до 120 дней", value: "9012" },
{ label: "Послед. 30 дней", value: "30" },
],
type: FilterTypes.Picker,
},
sortcountchapt: {
label: "Количество глав:",
value: "1",
options: [
{ label: "Любое кол-во глав", value: "1" },
{ label: "До 500", value: "500" },
{ label: "От 1000 до 2000", value: "1020" },
{ label: "От 2000 до 3000", value: "2030" },
{ label: "От 3000 до 4000", value: "3040" },
{ label: "От 4000", value: "400" },
{ label: "От 500 до 1000", value: "510" },
],
type: FilterTypes.Picker,
},
genre: {
label: "Жанры:",
value: { include: [], exclude: [] },
options: [
{ label: "Боевые Искусства", value: "Боевые Искусства" },
{ label: "Виртуальный Мир", value: "Виртуальный Мир" },
{ label: "Гарем", value: "Гарем" },
{ label: "Детектив", value: "Детектив" },
{ label: "Драма", value: "Драма" },
{ label: "Игра", value: "Игра" },
{ label: "Истории из жизни", value: "Истории из жизни" },
{ label: "Исторический", value: "Исторический" },
{ label: "История", value: "История" },
{ label: "Исэкай", value: "Исэкай" },
{ label: "Комедия", value: "Комедия" },
{ label: "Меха", value: "Меха" },
{ label: "Мистика", value: "Мистика" },
{ label: "Научная Фантастика", value: "Научная Фантастика" },
{ label: "Повседневность", value: "Повседневность" },
{ label: "Постапокалипсис", value: "Постапокалипсис" },
{ label: "Приключения", value: "Приключения" },
{ label: "Психология", value: "Психология" },
{ label: "Романтика", value: "Романтика" },
{ label: "Сверхъестественное", value: "Сверхъестественное" },
{ label: "Сёнэн", value: "Сёнэн" },
{ label: "Сёнэн-ай", value: "Сёнэн-ай" },
{ label: "Спорт", value: "Спорт" },
{ label: "Сэйнэн", value: "Сэйнэн" },
{ label: "Сюаньхуа", value: "Сюаньхуа" },
{ label: "Трагедия", value: "Трагедия" },
{ label: "Триллер", value: "Триллер" },
{ label: "Фантастика", value: "Фантастика" },
{ label: "Фэнтези", value: "Фэнтези" },
{ label: "Хоррор", value: "Хоррор" },
{ label: "Школьная жизнь", value: "Школьная жизнь" },
{ label: "Шоунен", value: "Шоунен" },
{ label: "Экшн", value: "Экшн" },
{ label: "Этти", value: "Этти" },
{ label: "Юри", value: "Юри" },
{ label: "Adult", value: "Adult" },
{ label: "Ecchi", value: "Ecchi" },
{ label: "Josei", value: "Josei" },
{ label: "Lolicon", value: "Lolicon" },
{ label: "Mature", value: "Mature" },
{ label: "Shoujo", value: "Shoujo" },
{ label: "Wuxia", value: "Wuxia" },
{ label: "Xianxia", value: "Xianxia" },
{ label: "Xuanhuan", value: "Xuanhuan" },
{ label: "Yaoi", value: "Yaoi" },
],
type: FilterTypes.ExcludableCheckboxGroup,
},
lang: {
label: "Выбрать языки:",
value: [],
options: [
{ label: "Английский", value: "Английский" },
{ label: "Китайский", value: "Китайский" },
{ label: "Корейский", value: "Корейский" },
{ label: "Японский", value: "Японский" },
],
type: FilterTypes.CheckboxGroup,
},
} satisfies Filters;
}
export default new Jaomix();
+957 -958
View File
File diff suppressed because it is too large Load Diff
+1284 -1285
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+408 -409
View File
@@ -1,409 +1,408 @@
import { Plugin } from "@typings/plugin";
import { FilterTypes, Filters } from "@libs/filterInputs";
import { defaultCover } from "@libs/defaultCover";
import { fetchApi, fetchFile } from "@libs/fetch";
import { NovelStatus } from "@libs/novelStatus";
import { load as parseHTML } from "cheerio";
import dayjs from "dayjs";
class RNRF implements Plugin.PluginBase {
id = "RNRF";
name = "РанобэРФ";
site = "https://ранобэ.рф";
version = "1.0.0";
icon = "src/ru/ranoberf/icon.png";
userAgent = "";
cookieString = "";
async popularNovels(
pageNo: number,
{ showLatestNovels, filters }: Plugin.PopularNovelsOptions,
): Promise<Plugin.NovelItem[]> {
let url = this.site + "/books?order=";
url += showLatestNovels
? "lastPublishedChapter"
: filters?.sort?.value || "popular";
url += "&page=" + pageNo;
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = parseHTML(body);
const jsonRaw = loadedCheerio("#__NEXT_DATA__").html();
const json: response = JSON.parse(jsonRaw || "{}");
const novels: Plugin.NovelItem[] = [];
json.props.pageProps?.totalData?.items?.forEach((novel) =>
novels.push({
name: novel.title,
cover: novel?.verticalImage?.url
? this.site + novel.verticalImage.url
: defaultCover,
url: this.site + "/" + novel.slug,
}),
);
return novels;
}
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
const result = await fetchApi(novelUrl);
const body = await result.text();
const loadedCheerio = parseHTML(body);
const jsonRaw = loadedCheerio("#__NEXT_DATA__").html();
const book = (JSON.parse(jsonRaw || "{}") as response).props.pageProps.book;
const novel: Plugin.SourceNovel = {
url: novelUrl,
name: book?.title,
cover: book?.verticalImage?.url
? this.site + book.verticalImage.url
: defaultCover,
summary: book?.description,
author: book?.author || "",
genres: book?.genres.map((item) => item.title).join(", "),
status: book?.additionalInfo.includes("Активен")
? NovelStatus.Ongoing
: NovelStatus.Completed,
};
const chapters: Plugin.ChapterItem[] = [];
book?.chapters?.forEach((chapter) => {
if (!chapter.isDonate || chapter.isUserPaid) {
chapters.push({
name: chapter.title,
releaseTime: dayjs(chapter.publishedAt).format("LLL"),
url: this.site + chapter.url,
});
}
});
novel.chapters = chapters.reverse();
return novel;
}
async parseChapter(chapterUrl: string): Promise<string> {
const result = await fetchApi(chapterUrl);
const body = await result.text();
let loadedCheerio = parseHTML(body);
const jsonRaw = loadedCheerio("#__NEXT_DATA__").html();
const json: response = JSON.parse(jsonRaw || "{}");
loadedCheerio = parseHTML(
json.props.pageProps?.chapter?.content?.text || "",
);
const baseUrl = this.site;
loadedCheerio("img").each(function () {
if (!loadedCheerio(this).attr("src")?.startsWith("http")) {
const src = loadedCheerio(this).attr("src");
loadedCheerio(this).attr("src", baseUrl + src);
}
});
const chapterText = loadedCheerio.html();
return chapterText;
}
async searchNovels(
searchTerm: string,
//pageNo: number | undefined = 1,
): Promise<Plugin.NovelItem[]> {
const url = `${this.site}/v3/books?filter[or][0][title][like]=${searchTerm}&filter[or][1][titleEn][like]=${searchTerm}&filter[or][2][fullTitle][like]=${searchTerm}&filter[status][]=active&filter[status][]=abandoned&filter[status][]=completed&expand=verticalImage`;
const result = await fetchApi(url);
const body = (await result.json()) as { items: Item[] };
const novels: Plugin.NovelItem[] = [];
body.items.forEach((novel) =>
novels.push({
name: novel.title,
cover: novel?.verticalImage?.url
? this.site + novel.verticalImage.url
: defaultCover,
url: this.site + "/" + novel.slug,
}),
);
return novels;
}
fetchImage = fetchFile;
filters = {
sort: {
label: "Сортировка",
value: "",
options: [
{ label: "Рейтинг", value: "popular" },
{ label: "Дате добавления", value: "new" },
{ label: "Дате обновления", value: "lastPublishedChapter" },
{ label: "Законченные", value: "completed" },
],
type: FilterTypes.Picker,
},
} satisfies Filters;
}
export default new RNRF();
interface response {
props: Props;
page: string;
query: Query;
buildId: string;
isFallback: boolean;
gssp: boolean;
appGip: boolean;
dynamicIds?: string[];
}
interface Props {
pageProps: PageProps;
isMobile: boolean;
theme: string;
__N_SSP: boolean;
}
interface PageProps {
initialReduxState: InitialReduxState;
book?: PagePropsBook;
totalData?: TotalData;
layoutViewCookies?: string;
displayBanner?: boolean;
chapter?: PagePropsChapter;
}
interface PagePropsBook {
id: number;
countryId: number;
creatorId: number;
lastChapterId: number;
sourceId: number;
imgVerticalId: number;
imgHorizontalId: number;
imgSquareId: number;
imageVerticalId: number;
imageHorizontalId: number;
title: string;
titleEn: string;
fullTitle: string;
fullTitleEn: string;
description: string;
slug: string;
author: string;
additionalInfo: string;
importantInfo: string;
status: string;
views: number;
likes: number;
dislikes: number;
intervalSec: number;
intervalForNextFreeChapterSec: number;
chapterCost: number;
chapterPrice: number;
chapterPriceCollected: number;
maxSubscriptionChapters: number;
maxDonateChapters: number;
isDisplayOnMainPage: boolean;
withoutSchedule: boolean;
nextFreeChapterPublishedAt: null;
createdAt: Date;
updatedAt: Date;
userRating: null;
userBookmark: null;
country: Country;
genres: Genre[];
timer: Timer;
chapters: ChapterElement[];
verticalImage: Image;
horizontalImage: Image;
squareImage: Image;
}
interface ChapterElement {
id: number;
bookId: number;
title: string;
url: string;
numberChapter: string;
tom: number | null;
chapterShortNumber: number | null;
isDonate: boolean;
isSponsored: boolean;
isSubscription: boolean;
isEdited: boolean;
publishedAt: Date;
price: number;
views: number;
isUserPaid?: boolean;
}
interface Country {
id: number;
title: string;
code: string;
}
interface Genre {
id: number;
title: string;
slug: string;
}
interface Image {
id: number;
alt: string;
path: string;
name: string;
url: string;
}
interface Timer {
value: null;
for: null;
message: string;
}
interface PagePropsChapter {
id: number;
bookId: number;
editorId: null;
translatorId: number;
parserChapterId: null;
title: string;
slug: string;
status: string;
tom: null;
views: number;
isSponsored: boolean;
isSubscription: boolean;
isDonate: boolean;
isIndexing: boolean;
publishedAt: Date;
changeAvailabilityAt: null;
createdAt: Date;
updatedAt: Date;
numberChapter: string;
price: number;
content: Content;
book: ChapterBook;
userBookmark: null;
isUserPaid: boolean;
nextChapter: null;
previousChapter: PreviousChapter;
corrections: null;
}
interface ChapterBook {
id: number;
title: string;
titleEn: string;
url: string;
}
interface Content {
id: number;
text: string;
symbolsCount: number;
}
interface PreviousChapter {
id: number;
title: string;
views: number;
publishedAt: Date;
url: string;
numberChapter: string;
}
interface InitialReduxState {
data?: Data;
auth: Auth;
banners?: Banners;
corrections?: Corrections;
readerSettings?: ReaderSettings;
}
interface Auth {
isAuth: boolean;
user: null;
}
interface Banners {
displaySale: boolean;
}
interface Corrections {
items: null;
data: null;
}
interface Data {
bookPage: BookPage | null;
chapterPage: ChapterPage | null;
}
interface BookPage {
bookId: number;
bookmark: null;
}
interface ChapterPage {
chapterId: number;
bookId: number;
bookmark: null;
}
interface ReaderSettings {
fontSize: number;
lineHeight: number;
textIndent: number;
sidebarHide: number;
textAlign: string;
}
interface TotalData {
items: Item[];
_links: Links;
pagesData: PagesData;
}
interface Links {
self: First;
first: First;
last: First;
next: First;
}
interface First {
href: string;
}
interface Item {
id: number;
title: string;
description: string;
slug: string;
url: string;
status: string;
dislikes: number;
likes: number;
userRating: null;
lastChapter: ChapterElement;
verticalImage: Image;
horizontalImage: Image;
squareImage: Image;
}
interface PagesData {
totalCount: number;
pageCount: number;
currentPage: number;
perPage: number;
}
interface Query {
book?: string;
chapter?: string;
}
import { Plugin } from "@typings/plugin";
import { FilterTypes, Filters } from "@libs/filterInputs";
import { defaultCover } from "@libs/defaultCover";
import { fetchApi, fetchFile } from "@libs/fetch";
import { NovelStatus } from "@libs/novelStatus";
import { load as parseHTML } from "cheerio";
import dayjs from "dayjs";
class RNRF implements Plugin.PluginBase {
id = "RNRF";
name = "РанобэРФ";
site = "https://ранобэ.рф";
version = "1.0.0";
icon = "src/ru/ranoberf/icon.png";
userAgent = "";
async popularNovels(
pageNo: number,
{ showLatestNovels, filters }: Plugin.PopularNovelsOptions,
): Promise<Plugin.NovelItem[]> {
let url = this.site + "/books?order=";
url += showLatestNovels
? "lastPublishedChapter"
: filters?.sort?.value || "popular";
url += "&page=" + pageNo;
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = parseHTML(body);
const jsonRaw = loadedCheerio("#__NEXT_DATA__").html();
const json: response = JSON.parse(jsonRaw || "{}");
const novels: Plugin.NovelItem[] = [];
json.props.pageProps?.totalData?.items?.forEach((novel) =>
novels.push({
name: novel.title,
cover: novel?.verticalImage?.url
? this.site + novel.verticalImage.url
: defaultCover,
url: this.site + "/" + novel.slug,
}),
);
return novels;
}
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
const result = await fetchApi(novelUrl);
const body = await result.text();
const loadedCheerio = parseHTML(body);
const jsonRaw = loadedCheerio("#__NEXT_DATA__").html();
const book = (JSON.parse(jsonRaw || "{}") as response).props.pageProps.book;
const novel: Plugin.SourceNovel = {
url: novelUrl,
name: book?.title,
cover: book?.verticalImage?.url
? this.site + book.verticalImage.url
: defaultCover,
summary: book?.description,
author: book?.author || "",
genres: book?.genres.map((item) => item.title).join(", "),
status: book?.additionalInfo.includes("Активен")
? NovelStatus.Ongoing
: NovelStatus.Completed,
};
const chapters: Plugin.ChapterItem[] = [];
book?.chapters?.forEach((chapter) => {
if (!chapter.isDonate || chapter.isUserPaid) {
chapters.push({
name: chapter.title,
releaseTime: dayjs(chapter.publishedAt).format("LLL"),
url: this.site + chapter.url,
});
}
});
novel.chapters = chapters.reverse();
return novel;
}
async parseChapter(chapterUrl: string): Promise<string> {
const result = await fetchApi(chapterUrl);
const body = await result.text();
let loadedCheerio = parseHTML(body);
const jsonRaw = loadedCheerio("#__NEXT_DATA__").html();
const json: response = JSON.parse(jsonRaw || "{}");
loadedCheerio = parseHTML(
json.props.pageProps?.chapter?.content?.text || "",
);
const baseUrl = this.site;
loadedCheerio("img").each(function () {
if (!loadedCheerio(this).attr("src")?.startsWith("http")) {
const src = loadedCheerio(this).attr("src");
loadedCheerio(this).attr("src", baseUrl + src);
}
});
const chapterText = loadedCheerio.html();
return chapterText;
}
async searchNovels(
searchTerm: string,
//pageNo: number | undefined = 1,
): Promise<Plugin.NovelItem[]> {
const url = `${this.site}/v3/books?filter[or][0][title][like]=${searchTerm}&filter[or][1][titleEn][like]=${searchTerm}&filter[or][2][fullTitle][like]=${searchTerm}&filter[status][]=active&filter[status][]=abandoned&filter[status][]=completed&expand=verticalImage`;
const result = await fetchApi(url);
const body = (await result.json()) as { items: Item[] };
const novels: Plugin.NovelItem[] = [];
body.items.forEach((novel) =>
novels.push({
name: novel.title,
cover: novel?.verticalImage?.url
? this.site + novel.verticalImage.url
: defaultCover,
url: this.site + "/" + novel.slug,
}),
);
return novels;
}
fetchImage = fetchFile;
filters = {
sort: {
label: "Сортировка",
value: "",
options: [
{ label: "Рейтинг", value: "popular" },
{ label: "Дате добавления", value: "new" },
{ label: "Дате обновления", value: "lastPublishedChapter" },
{ label: "Законченные", value: "completed" },
],
type: FilterTypes.Picker,
},
} satisfies Filters;
}
export default new RNRF();
interface response {
props: Props;
page: string;
query: Query;
buildId: string;
isFallback: boolean;
gssp: boolean;
appGip: boolean;
dynamicIds?: string[];
}
interface Props {
pageProps: PageProps;
isMobile: boolean;
theme: string;
__N_SSP: boolean;
}
interface PageProps {
initialReduxState: InitialReduxState;
book?: PagePropsBook;
totalData?: TotalData;
layoutViewCookies?: string;
displayBanner?: boolean;
chapter?: PagePropsChapter;
}
interface PagePropsBook {
id: number;
countryId: number;
creatorId: number;
lastChapterId: number;
sourceId: number;
imgVerticalId: number;
imgHorizontalId: number;
imgSquareId: number;
imageVerticalId: number;
imageHorizontalId: number;
title: string;
titleEn: string;
fullTitle: string;
fullTitleEn: string;
description: string;
slug: string;
author: string;
additionalInfo: string;
importantInfo: string;
status: string;
views: number;
likes: number;
dislikes: number;
intervalSec: number;
intervalForNextFreeChapterSec: number;
chapterCost: number;
chapterPrice: number;
chapterPriceCollected: number;
maxSubscriptionChapters: number;
maxDonateChapters: number;
isDisplayOnMainPage: boolean;
withoutSchedule: boolean;
nextFreeChapterPublishedAt: null;
createdAt: Date;
updatedAt: Date;
userRating: null;
userBookmark: null;
country: Country;
genres: Genre[];
timer: Timer;
chapters: ChapterElement[];
verticalImage: Image;
horizontalImage: Image;
squareImage: Image;
}
interface ChapterElement {
id: number;
bookId: number;
title: string;
url: string;
numberChapter: string;
tom: number | null;
chapterShortNumber: number | null;
isDonate: boolean;
isSponsored: boolean;
isSubscription: boolean;
isEdited: boolean;
publishedAt: Date;
price: number;
views: number;
isUserPaid?: boolean;
}
interface Country {
id: number;
title: string;
code: string;
}
interface Genre {
id: number;
title: string;
slug: string;
}
interface Image {
id: number;
alt: string;
path: string;
name: string;
url: string;
}
interface Timer {
value: null;
for: null;
message: string;
}
interface PagePropsChapter {
id: number;
bookId: number;
editorId: null;
translatorId: number;
parserChapterId: null;
title: string;
slug: string;
status: string;
tom: null;
views: number;
isSponsored: boolean;
isSubscription: boolean;
isDonate: boolean;
isIndexing: boolean;
publishedAt: Date;
changeAvailabilityAt: null;
createdAt: Date;
updatedAt: Date;
numberChapter: string;
price: number;
content: Content;
book: ChapterBook;
userBookmark: null;
isUserPaid: boolean;
nextChapter: null;
previousChapter: PreviousChapter;
corrections: null;
}
interface ChapterBook {
id: number;
title: string;
titleEn: string;
url: string;
}
interface Content {
id: number;
text: string;
symbolsCount: number;
}
interface PreviousChapter {
id: number;
title: string;
views: number;
publishedAt: Date;
url: string;
numberChapter: string;
}
interface InitialReduxState {
data?: Data;
auth: Auth;
banners?: Banners;
corrections?: Corrections;
readerSettings?: ReaderSettings;
}
interface Auth {
isAuth: boolean;
user: null;
}
interface Banners {
displaySale: boolean;
}
interface Corrections {
items: null;
data: null;
}
interface Data {
bookPage: BookPage | null;
chapterPage: ChapterPage | null;
}
interface BookPage {
bookId: number;
bookmark: null;
}
interface ChapterPage {
chapterId: number;
bookId: number;
bookmark: null;
}
interface ReaderSettings {
fontSize: number;
lineHeight: number;
textIndent: number;
sidebarHide: number;
textAlign: string;
}
interface TotalData {
items: Item[];
_links: Links;
pagesData: PagesData;
}
interface Links {
self: First;
first: First;
last: First;
next: First;
}
interface First {
href: string;
}
interface Item {
id: number;
title: string;
description: string;
slug: string;
url: string;
status: string;
dislikes: number;
likes: number;
userRating: null;
lastChapter: ChapterElement;
verticalImage: Image;
horizontalImage: Image;
squareImage: Image;
}
interface PagesData {
totalCount: number;
pageCount: number;
currentPage: number;
perPage: number;
}
interface Query {
book?: string;
chapter?: string;
}
+1105 -1106
View File
File diff suppressed because it is too large Load Diff
+375 -385
View File
@@ -1,385 +1,375 @@
import { CheerioAPI, load as parseHTML } from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import { FilterTypes, Filters } from "@libs/filterInputs";
import { Plugin } from "@typings/plugin";
import { showToast } from "@libs/showToast";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus";
class TuNovelaLigera implements Plugin.PluginBase {
id = "tunovelaligera";
name = "TuNovelaLigera";
icon = "src/es/tunovelaligera/icon.png";
site = "https://tunovelaligera.com/";
version = "1.0.0";
userAgent = "";
cookieString = "";
async popularNovels(
pageNo: number,
{ filters }: Plugin.PopularNovelsOptions<typeof this.filters>
): Promise<Plugin.NovelItem[]> {
let link = `${this.site}`;
link += filters.genres ? `genero/` + filters.genres : "novelas";
link += `/page/${pageNo}`;
link += filters.order;
const headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
const result = await fetchApi(link, { headers });
const body = await result.text();
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio(".page-item-detail").each((i, el) => {
const novelName = loadedCheerio(el).find(".h5 > a").text();
const novelCover = loadedCheerio(el).find("img").attr("src");
const novelUrl = loadedCheerio(el).find(".h5 > a").attr("href");
if (!novelUrl) return;
const novel = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
}
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
const url = novelUrl;
const headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
const result = await fetchApi(url, { headers });
const body = await result.text();
let loadedCheerio = parseHTML(body);
const novel: Plugin.SourceNovel = {
url,
chapters: [],
};
loadedCheerio(".manga-title-badges").remove();
novel.name = loadedCheerio(".post-title > h1").text().trim();
let novelCover = loadedCheerio(".summary_image > a > img");
novel.cover =
novelCover.attr("data-src") ||
novelCover.attr("src") ||
novelCover.attr("data-cfsrc") ||
defaultCover;
loadedCheerio(".post-content_item").each(function () {
const detailName = loadedCheerio(this)
.find(".summary-heading > h5")
.text()
.trim();
const detail = loadedCheerio(this)
.find(".summary-content")
.text()
.trim();
switch (detailName) {
case "Generos":
novel.genres = detail.replace(/, /g, ",");
break;
case "Autores":
novel.author = detail;
break;
case "Estado":
novel.status =
detail.includes("OnGoing") ||
detail.includes("Updating")
? NovelStatus.Ongoing
: NovelStatus.Completed;
break;
}
});
novel.summary = loadedCheerio("div.summary__content > p").text().trim();
let chapter: Plugin.ChapterItem[] = [];
const delay = (ms: number) => new Promise((res) => setTimeout(res, ms));
let lastPage = 1;
lastPage = +loadedCheerio(".lcp_paginator li:last").prev().text();
const getChapters = async () => {
const n = url.split("/");
const novelName = n[4];
showToast("Cargando desde Archivo...");
const formData = new FormData();
formData.append("action", "madara_load_more");
formData.append("page", "0");
formData.append("template", "html/loop/content");
formData.append("vars[category_name]", novelName);
formData.append("vars[posts_per_page]", "10000");
const result = await fetchApi(
`${this.site}wp-admin/admin-ajax.php`,
{
method: "POST",
body: formData,
headers,
}
);
const text = await result.text();
loadedCheerio = parseHTML(text);
loadedCheerio(".heading").each((i, el) => {
const chapterName = loadedCheerio(el)
.text()
.replace(/[\t\n]/g, "")
.trim();
const releaseDate = null;
const chapterUrl =
loadedCheerio(el).find("a").attr("href") || "";
chapter.push({
name: chapterName,
url: chapterUrl,
releaseTime: releaseDate,
});
});
return chapter.reverse();
};
const getPageChapters = async () => {
for (let i = 1; i <= lastPage; i++) {
const chaptersUrl = `${novelUrl}?lcp_page0=${i}`;
showToast(`Cargando desde la página ${i}/${lastPage}...`);
const result = await fetchApi(chaptersUrl, { headers });
const chaptersHTML = await result.text();
let chapterCheerio = parseHTML(chaptersHTML);
chapterCheerio(".lcp_catlist li").each((i, el) => {
const chapterName = chapterCheerio(el)
.find("a")
.text()
.replace(/[\t\n]/g, "")
.trim();
const releaseDate = chapterCheerio(el)
.find("span")
.text()
.trim();
const chapterUrl =
chapterCheerio(el).find("a").attr("href") || "";
chapter.push({
name: chapterName,
releaseTime: releaseDate,
url: chapterUrl,
});
});
await delay(1000);
}
return chapter.reverse();
};
novel.chapters = await getChapters();
if (!novel.chapters.length) {
showToast("¡Archivo no encontrado!");
await delay(1000);
novel.chapters = await getPageChapters();
}
return novel;
}
async parseChapter(chapterUrl: string): Promise<string> {
const headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
const result = await fetchApi(chapterUrl);
const body = await result.text();
const loadedCheerio = parseHTML(body);
loadedCheerio("#hola_siguiente").next().find("div").remove();
const chapterText =
loadedCheerio("#hola_siguiente").next().html() || "";
return chapterText;
}
async searchNovels(
searchTerm: string,
pageNo?: number | undefined
): Promise<Plugin.NovelItem[]> {
const url = `${this.site}?s=${searchTerm}&post_type=wp-manga`;
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio(".c-tabs-item__content").each((i, el) => {
const novelName = loadedCheerio(el).find(".h4 > a").text();
const novelCover = loadedCheerio(el).find("img").attr("src");
const novelUrl = loadedCheerio(el).find(".h4 > a").attr("href");
if (!novelUrl) return;
novels.push({
name: novelName,
url: novelUrl,
cover: novelCover,
});
});
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
return await fetchFile(url);
}
filters = {
order: {
value: "?m_orderby=rating",
label: "Ordenado por",
options: [
{ label: "Lo mas reciente", value: "?m_orderby=latest" },
{ label: "A-Z", value: "?m_orderby=alphabet" },
{ label: "Clasificación", value: "?m_orderby=rating" },
{ label: "Trending", value: "?m_orderby=trending" },
{ label: "Mas visto", value: "?m_orderby=views" },
{ label: "Nuevo", value: "?m_orderby=new-manga" },
],
type: FilterTypes.Picker,
},
genres: {
value: "",
label: "Generos",
options: [
{ label: "None", value: "" },
{ label: "Acción", value: "accion" },
{ label: "Adulto", value: "adulto" },
{ label: "Artes Marciales", value: "artes-marciales" },
{ label: "Aventura", value: "aventura" },
{ label: "Ciencia Ficción", value: "ciencia-ficcion" },
{ label: "Comedia", value: "comedia" },
{ label: "Deportes", value: "deportes" },
{ label: "Drama", value: "drama" },
{ label: "Eastern Fantasy", value: "eastern-fantasy" },
{ label: "Ecchi", value: "ecchi" },
{ label: "FanFiction", value: "fan-fiction" },
{ label: "Fantasía", value: "fantasia" },
{ label: "Fantasía oriental", value: "fantasia-oriental" },
{ label: "Ficción Romántica", value: "ficcion-romantica" },
{ label: "Gender Bender", value: "gender-bender" },
{ label: "Harem", value: "harem" },
{ label: "Histórico", value: "historico" },
{ label: "Horror", value: "horror" },
{ label: "Josei", value: "josei" },
{ label: "Maduro", value: "maduro" },
{ label: "Mecha", value: "mecha" },
{ label: "Misterio", value: "misterio" },
{ label: "Novela China", value: "novela-china" },
{ label: "Novela FanFiction", value: "novela-fanfiction" },
{ label: "Novela Japonesa", value: "novela-japonesa" },
{ label: "Novela Koreana", value: "novela-koreana" },
{ label: "Novela ligera", value: "novela-ligera" },
{ label: "Novela original", value: "novela-original" },
{ label: "Novela Web", value: "web-novel" },
{ label: "Psicológico", value: "psicologico" },
{ label: "Realismo Mágico", value: "realismo-magico" },
{ label: "Recuento de vida", value: "recuento-de-vida" },
{ label: "Romance", value: "romance" },
{
label: "Romance contemporáneo",
value: "romance-contemporaneo",
},
{ label: "Romance Moderno", value: "romance-moderno" },
{ label: "Seinen", value: "seinen" },
{ label: "Shoujo", value: "shoujo" },
{ label: "Shounen", value: "shounen" },
{ label: "Sobrenatural", value: "sobrenatural" },
{ label: "Tragedia", value: "tragedia" },
{ label: "Vampiros", value: "vampiros" },
{ label: "Vida Escolar", value: "vida-escolar" },
{ label: "Western Fantasy", value: "western-fantasy" },
{ label: "Wuxia", value: "wuxia" },
{ label: "Xianxia", value: "xianxia" },
{ label: "Xuanhuan", value: "xuanhuan" },
{ label: "Yaoi", value: "yaoi" },
],
type: FilterTypes.Picker,
},
} satisfies Filters;
}
export default new TuNovelaLigera();
import { CheerioAPI, load as parseHTML } from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import { FilterTypes, Filters } from "@libs/filterInputs";
import { Plugin } from "@typings/plugin";
import { showToast } from "@libs/showToast";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus";
class TuNovelaLigera implements Plugin.PluginBase {
id = "tunovelaligera";
name = "TuNovelaLigera";
icon = "src/es/tunovelaligera/icon.png";
site = "https://tunovelaligera.com/";
version = "1.0.0";
userAgent = "";
async popularNovels(
pageNo: number,
{ filters }: Plugin.PopularNovelsOptions<typeof this.filters>
): Promise<Plugin.NovelItem[]> {
let link = `${this.site}`;
link += filters.genres ? `genero/` + filters.genres : "novelas";
link += `/page/${pageNo}`;
link += filters.order;
const headers = new Headers();
const result = await fetchApi(link, { headers });
const body = await result.text();
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio(".page-item-detail").each((i, el) => {
const novelName = loadedCheerio(el).find(".h5 > a").text();
const novelCover = loadedCheerio(el).find("img").attr("src");
const novelUrl = loadedCheerio(el).find(".h5 > a").attr("href");
if (!novelUrl) return;
const novel = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
}
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
const url = novelUrl;
const headers = new Headers();
const result = await fetchApi(url, { headers });
const body = await result.text();
let loadedCheerio = parseHTML(body);
const novel: Plugin.SourceNovel = {
url,
chapters: [],
};
loadedCheerio(".manga-title-badges").remove();
novel.name = loadedCheerio(".post-title > h1").text().trim();
let novelCover = loadedCheerio(".summary_image > a > img");
novel.cover =
novelCover.attr("data-src") ||
novelCover.attr("src") ||
novelCover.attr("data-cfsrc") ||
defaultCover;
loadedCheerio(".post-content_item").each(function () {
const detailName = loadedCheerio(this)
.find(".summary-heading > h5")
.text()
.trim();
const detail = loadedCheerio(this)
.find(".summary-content")
.text()
.trim();
switch (detailName) {
case "Generos":
novel.genres = detail.replace(/, /g, ",");
break;
case "Autores":
novel.author = detail;
break;
case "Estado":
novel.status =
detail.includes("OnGoing") ||
detail.includes("Updating")
? NovelStatus.Ongoing
: NovelStatus.Completed;
break;
}
});
novel.summary = loadedCheerio("div.summary__content > p").text().trim();
let chapter: Plugin.ChapterItem[] = [];
const delay = (ms: number) => new Promise((res) => setTimeout(res, ms));
let lastPage = 1;
lastPage = +loadedCheerio(".lcp_paginator li:last").prev().text();
const getChapters = async () => {
const n = url.split("/");
const novelName = n[4];
showToast("Cargando desde Archivo...");
const formData = new FormData();
formData.append("action", "madara_load_more");
formData.append("page", "0");
formData.append("template", "html/loop/content");
formData.append("vars[category_name]", novelName);
formData.append("vars[posts_per_page]", "10000");
const result = await fetchApi(
`${this.site}wp-admin/admin-ajax.php`,
{
method: "POST",
body: formData,
headers,
}
);
const text = await result.text();
loadedCheerio = parseHTML(text);
loadedCheerio(".heading").each((i, el) => {
const chapterName = loadedCheerio(el)
.text()
.replace(/[\t\n]/g, "")
.trim();
const releaseDate = null;
const chapterUrl =
loadedCheerio(el).find("a").attr("href") || "";
chapter.push({
name: chapterName,
url: chapterUrl,
releaseTime: releaseDate,
});
});
return chapter.reverse();
};
const getPageChapters = async () => {
for (let i = 1; i <= lastPage; i++) {
const chaptersUrl = `${novelUrl}?lcp_page0=${i}`;
showToast(`Cargando desde la página ${i}/${lastPage}...`);
const result = await fetchApi(chaptersUrl, { headers });
const chaptersHTML = await result.text();
let chapterCheerio = parseHTML(chaptersHTML);
chapterCheerio(".lcp_catlist li").each((i, el) => {
const chapterName = chapterCheerio(el)
.find("a")
.text()
.replace(/[\t\n]/g, "")
.trim();
const releaseDate = chapterCheerio(el)
.find("span")
.text()
.trim();
const chapterUrl =
chapterCheerio(el).find("a").attr("href") || "";
chapter.push({
name: chapterName,
releaseTime: releaseDate,
url: chapterUrl,
});
});
await delay(1000);
}
return chapter.reverse();
};
novel.chapters = await getChapters();
if (!novel.chapters.length) {
showToast("¡Archivo no encontrado!");
await delay(1000);
novel.chapters = await getPageChapters();
}
return novel;
}
async parseChapter(chapterUrl: string): Promise<string> {
const headers = new Headers();
const result = await fetchApi(chapterUrl);
const body = await result.text();
const loadedCheerio = parseHTML(body);
loadedCheerio("#hola_siguiente").next().find("div").remove();
const chapterText =
loadedCheerio("#hola_siguiente").next().html() || "";
return chapterText;
}
async searchNovels(
searchTerm: string,
pageNo?: number | undefined
): Promise<Plugin.NovelItem[]> {
const url = `${this.site}?s=${searchTerm}&post_type=wp-manga`;
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio(".c-tabs-item__content").each((i, el) => {
const novelName = loadedCheerio(el).find(".h4 > a").text();
const novelCover = loadedCheerio(el).find("img").attr("src");
const novelUrl = loadedCheerio(el).find(".h4 > a").attr("href");
if (!novelUrl) return;
novels.push({
name: novelName,
url: novelUrl,
cover: novelCover,
});
});
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
return await fetchFile(url);
}
filters = {
order: {
value: "?m_orderby=rating",
label: "Ordenado por",
options: [
{ label: "Lo mas reciente", value: "?m_orderby=latest" },
{ label: "A-Z", value: "?m_orderby=alphabet" },
{ label: "Clasificación", value: "?m_orderby=rating" },
{ label: "Trending", value: "?m_orderby=trending" },
{ label: "Mas visto", value: "?m_orderby=views" },
{ label: "Nuevo", value: "?m_orderby=new-manga" },
],
type: FilterTypes.Picker,
},
genres: {
value: "",
label: "Generos",
options: [
{ label: "None", value: "" },
{ label: "Acción", value: "accion" },
{ label: "Adulto", value: "adulto" },
{ label: "Artes Marciales", value: "artes-marciales" },
{ label: "Aventura", value: "aventura" },
{ label: "Ciencia Ficción", value: "ciencia-ficcion" },
{ label: "Comedia", value: "comedia" },
{ label: "Deportes", value: "deportes" },
{ label: "Drama", value: "drama" },
{ label: "Eastern Fantasy", value: "eastern-fantasy" },
{ label: "Ecchi", value: "ecchi" },
{ label: "FanFiction", value: "fan-fiction" },
{ label: "Fantasía", value: "fantasia" },
{ label: "Fantasía oriental", value: "fantasia-oriental" },
{ label: "Ficción Romántica", value: "ficcion-romantica" },
{ label: "Gender Bender", value: "gender-bender" },
{ label: "Harem", value: "harem" },
{ label: "Histórico", value: "historico" },
{ label: "Horror", value: "horror" },
{ label: "Josei", value: "josei" },
{ label: "Maduro", value: "maduro" },
{ label: "Mecha", value: "mecha" },
{ label: "Misterio", value: "misterio" },
{ label: "Novela China", value: "novela-china" },
{ label: "Novela FanFiction", value: "novela-fanfiction" },
{ label: "Novela Japonesa", value: "novela-japonesa" },
{ label: "Novela Koreana", value: "novela-koreana" },
{ label: "Novela ligera", value: "novela-ligera" },
{ label: "Novela original", value: "novela-original" },
{ label: "Novela Web", value: "web-novel" },
{ label: "Psicológico", value: "psicologico" },
{ label: "Realismo Mágico", value: "realismo-magico" },
{ label: "Recuento de vida", value: "recuento-de-vida" },
{ label: "Romance", value: "romance" },
{
label: "Romance contemporáneo",
value: "romance-contemporaneo",
},
{ label: "Romance Moderno", value: "romance-moderno" },
{ label: "Seinen", value: "seinen" },
{ label: "Shoujo", value: "shoujo" },
{ label: "Shounen", value: "shounen" },
{ label: "Sobrenatural", value: "sobrenatural" },
{ label: "Tragedia", value: "tragedia" },
{ label: "Vampiros", value: "vampiros" },
{ label: "Vida Escolar", value: "vida-escolar" },
{ label: "Western Fantasy", value: "western-fantasy" },
{ label: "Wuxia", value: "wuxia" },
{ label: "Xianxia", value: "xianxia" },
{ label: "Xuanhuan", value: "xuanhuan" },
{ label: "Yaoi", value: "yaoi" },
],
type: FilterTypes.Picker,
},
} satisfies Filters;
}
export default new TuNovelaLigera();
+310 -323
View File
@@ -1,323 +1,310 @@
import { load as parseHTML } from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import { FilterTypes, Filters } from "@libs/filterInputs";
import { Plugin } from "@typings/plugin";
class LSHNovel implements Plugin.PluginBase {
id = "lshnovel";
name = "Liebe Schnee Hiver Novel";
icon = "multisrc/wpmangastream/icons/lshnovel.png";
site = "https://lshnovel.com/";
version = "1.0.0";
userAgent = "";
cookieString = "";
async popularNovels(
pageNo: number,
{ filters }: Plugin.PopularNovelsOptions<typeof this.filters>
): Promise<Plugin.NovelItem[]> {
let link = `${this.site}series/?page=${pageNo}`;
if (filters.genres.value.length) {
link += filters.genres.value.map((i) => `&genre[]=${i}`).join("");
}
if (filters.type.value.length)
link += filters.type.value.map((i) => `&lang[]=${i}`).join("");
link += "&status=" + filters.status;
link += "&order=" + filters.order;
const headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
const body = await fetchApi(link, { headers }).then((result) =>
result.text()
);
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio("article.bs").each(function () {
const novelName = loadedCheerio(this).find(".ntitle").text().trim();
let image = loadedCheerio(this).find("img");
const novelCover = image.attr("data-src") || image.attr("src");
const novelUrl = loadedCheerio(this).find("a").attr("href");
if (!novelUrl) return;
const novel = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
}
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
const url = novelUrl;
const headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
const result = await fetchApi(url, { headers });
const body = await result.text();
let loadedCheerio = parseHTML(body);
const novel: Plugin.SourceNovel = {
url,
chapters: [],
};
novel.name = loadedCheerio(".entry-title").text();
novel.cover =
loadedCheerio("img.wp-post-image").attr("data-src") ||
loadedCheerio("img.wp-post-image").attr("src");
loadedCheerio("div.spe > span").each(function () {
const detailName = loadedCheerio(this).find("b").text().trim();
const detail = loadedCheerio(this)
.find("b")
.remove()
.end()
.text()
.trim();
switch (detailName) {
case "Yazar:":
novel.author = detail;
break;
case "Seviye:":
novel.status = detail;
break;
}
});
novel.genres = loadedCheerio(".genxed")
.text()
.trim()
.replace(/\s/g, ",");
loadedCheerio('div[itemprop="description"] h3,p.a,strong').remove();
novel.summary = loadedCheerio('div[itemprop="description"]')
.find("br")
.replaceWith("\n")
.end()
.text();
let chapter: Plugin.ChapterItem[] = [];
loadedCheerio(".eplister")
.find("li")
.each(function () {
const chapterName =
loadedCheerio(this).find(".epl-num").text() +
" - " +
loadedCheerio(this).find(".epl-title").text();
const releaseDate = loadedCheerio(this)
.find(".epl-date")
.text()
.trim();
const chapterUrl = loadedCheerio(this).find("a").attr("href");
if (!chapterUrl) return;
chapter.push({
name: chapterName,
releaseTime: releaseDate,
url: chapterUrl,
});
});
novel.chapters = chapter.reverse();
return novel;
}
async parseChapter(chapterUrl: string): Promise<string> {
const headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
const result = await fetchApi(chapterUrl, { headers });
const body = await result.text();
const loadedCheerio = parseHTML(body);
let chapterText = loadedCheerio(".epcontent").html() || "";
return chapterText;
}
async searchNovels(
searchTerm: string,
pageNo?: number | undefined
): Promise<Plugin.NovelItem[]> {
const url = `${this.site}?s=${searchTerm}`;
const headers = new Headers();
if (this.cookieString) {
headers.append("cookie", this.cookieString);
}
const result = await fetchApi(url, { headers });
const body = await result.text();
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio("article.bs").each(function () {
const novelName = loadedCheerio(this).find(".ntitle").text().trim();
const novelCover = loadedCheerio(this).find("img").attr("src");
const novelUrl = loadedCheerio(this).find("a").attr("href");
if (!novelUrl) return;
novels.push({
name: novelName,
url: novelUrl,
cover: novelCover,
});
});
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
return await fetchFile(url);
}
filters = {
order: {
value: "popular",
label: "Önerilen",
options: [
{ label: "Varsayılan", value: "" },
{ label: "A-Z", value: "title" },
{ label: "Z-A", value: "titlereverse" },
{ label: "Son Yüklemeler", value: "update" },
{ label: "Son Eklenenler", value: "latest" },
{ label: "Bestimiz", value: "popular" },
],
type: FilterTypes.Picker,
},
status: {
label: "Statü",
value: "",
options: [
{ label: "Tümü", value: "" },
{ label: "Ongoing", value: "ongoing" },
{ label: "Hiatus", value: "hiatus" },
{ label: "Completed", value: "completed" },
],
type: FilterTypes.Picker,
},
type: {
value: [],
label: "Tür",
options: [
{ label: "Çeviri Novel", value: "ceviri-novel" },
{ label: "Liz-Chan", value: "liz-chan" },
{ label: "Manhwa", value: "manhwa" },
{ label: "Orijinal Novel", value: "orijinal-novel" },
{ label: "Web Novel", value: "web-novel" },
],
type: FilterTypes.CheckboxGroup,
},
genres: {
value: [],
label: "Kategori",
options: [
{ label: "+18", value: "18" },
{ label: "Action", value: "action" },
{ label: "Adult", value: "adult" },
{ label: "Aksiyon", value: "aksiyon" },
{ label: "BL", value: "bl" },
{ label: "Comedy", value: "comedy" },
{ label: "Doğaüstü", value: "dogaustu" },
{ label: "Dram", value: "dram" },
{ label: "Drama", value: "drama" },
{ label: "Ecchi", value: "ecchi" },
{ label: "Fantastik", value: "fantastik" },
{ label: "Fantasy", value: "fantasy" },
{ label: "Gizem", value: "gizem" },
{ label: "Harem", value: "harem" },
{ label: "Historical", value: "historical" },
{ label: "Josei", value: "josei" },
{ label: "Macera", value: "macera" },
{ label: "Manhwa", value: "manhwa" },
{ label: "Martial Arts", value: "martial-arts" },
{ label: "Mature", value: "mature" },
{ label: "Novel", value: "novel" },
{ label: "Okul", value: "okul" },
{ label: "Psikolojik", value: "psikolojik" },
{ label: "Psychological", value: "psychological" },
{ label: "Reverse Harem", value: "reverse-harem" },
{ label: "Romance", value: "romance" },
{ label: "Romantik", value: "romantik" },
{ label: "Shoujo", value: "shoujo" },
{ label: "Slice Of Life", value: "slice-of-life" },
{ label: "Smut", value: "smut" },
{ label: "Supernatural", value: "supernatural" },
{ label: "Tarihi", value: "tarihi" },
{ label: "Tragedy", value: "tragedy" },
{ label: "Yaoi", value: "yaoi" },
],
type: FilterTypes.CheckboxGroup,
},
} satisfies Filters;
}
export default new LSHNovel();
import { load as parseHTML } from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import { FilterTypes, Filters } from "@libs/filterInputs";
import { Plugin } from "@typings/plugin";
class LSHNovel implements Plugin.PluginBase {
id = "lshnovel";
name = "Liebe Schnee Hiver Novel";
icon = "multisrc/wpmangastream/icons/lshnovel.png";
site = "https://lshnovel.com/";
version = "1.0.0";
userAgent = "";
async popularNovels(
pageNo: number,
{ filters }: Plugin.PopularNovelsOptions<typeof this.filters>
): Promise<Plugin.NovelItem[]> {
let link = `${this.site}series/?page=${pageNo}`;
if (filters.genres.value.length) {
link += filters.genres.value.map((i) => `&genre[]=${i}`).join("");
}
if (filters.type.value.length)
link += filters.type.value.map((i) => `&lang[]=${i}`).join("");
link += "&status=" + filters.status;
link += "&order=" + filters.order;
const headers = new Headers();
const body = await fetchApi(link, { headers }).then((result) =>
result.text()
);
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio("article.bs").each(function () {
const novelName = loadedCheerio(this).find(".ntitle").text().trim();
let image = loadedCheerio(this).find("img");
const novelCover = image.attr("data-src") || image.attr("src");
const novelUrl = loadedCheerio(this).find("a").attr("href");
if (!novelUrl) return;
const novel = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
}
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
const url = novelUrl;
const headers = new Headers();
const result = await fetchApi(url, { headers });
const body = await result.text();
let loadedCheerio = parseHTML(body);
const novel: Plugin.SourceNovel = {
url,
chapters: [],
};
novel.name = loadedCheerio(".entry-title").text();
novel.cover =
loadedCheerio("img.wp-post-image").attr("data-src") ||
loadedCheerio("img.wp-post-image").attr("src");
loadedCheerio("div.spe > span").each(function () {
const detailName = loadedCheerio(this).find("b").text().trim();
const detail = loadedCheerio(this)
.find("b")
.remove()
.end()
.text()
.trim();
switch (detailName) {
case "Yazar:":
novel.author = detail;
break;
case "Seviye:":
novel.status = detail;
break;
}
});
novel.genres = loadedCheerio(".genxed")
.text()
.trim()
.replace(/\s/g, ",");
loadedCheerio('div[itemprop="description"] h3,p.a,strong').remove();
novel.summary = loadedCheerio('div[itemprop="description"]')
.find("br")
.replaceWith("\n")
.end()
.text();
let chapter: Plugin.ChapterItem[] = [];
loadedCheerio(".eplister")
.find("li")
.each(function () {
const chapterName =
loadedCheerio(this).find(".epl-num").text() +
" - " +
loadedCheerio(this).find(".epl-title").text();
const releaseDate = loadedCheerio(this)
.find(".epl-date")
.text()
.trim();
const chapterUrl = loadedCheerio(this).find("a").attr("href");
if (!chapterUrl) return;
chapter.push({
name: chapterName,
releaseTime: releaseDate,
url: chapterUrl,
});
});
novel.chapters = chapter.reverse();
return novel;
}
async parseChapter(chapterUrl: string): Promise<string> {
const headers = new Headers();
const result = await fetchApi(chapterUrl, { headers });
const body = await result.text();
const loadedCheerio = parseHTML(body);
let chapterText = loadedCheerio(".epcontent").html() || "";
return chapterText;
}
async searchNovels(
searchTerm: string,
pageNo?: number | undefined
): Promise<Plugin.NovelItem[]> {
const url = `${this.site}?s=${searchTerm}`;
const headers = new Headers();
const result = await fetchApi(url, { headers });
const body = await result.text();
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio("article.bs").each(function () {
const novelName = loadedCheerio(this).find(".ntitle").text().trim();
const novelCover = loadedCheerio(this).find("img").attr("src");
const novelUrl = loadedCheerio(this).find("a").attr("href");
if (!novelUrl) return;
novels.push({
name: novelName,
url: novelUrl,
cover: novelCover,
});
});
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
return await fetchFile(url);
}
filters = {
order: {
value: "popular",
label: "Önerilen",
options: [
{ label: "Varsayılan", value: "" },
{ label: "A-Z", value: "title" },
{ label: "Z-A", value: "titlereverse" },
{ label: "Son Yüklemeler", value: "update" },
{ label: "Son Eklenenler", value: "latest" },
{ label: "Bestimiz", value: "popular" },
],
type: FilterTypes.Picker,
},
status: {
label: "Statü",
value: "",
options: [
{ label: "Tümü", value: "" },
{ label: "Ongoing", value: "ongoing" },
{ label: "Hiatus", value: "hiatus" },
{ label: "Completed", value: "completed" },
],
type: FilterTypes.Picker,
},
type: {
value: [],
label: "Tür",
options: [
{ label: "Çeviri Novel", value: "ceviri-novel" },
{ label: "Liz-Chan", value: "liz-chan" },
{ label: "Manhwa", value: "manhwa" },
{ label: "Orijinal Novel", value: "orijinal-novel" },
{ label: "Web Novel", value: "web-novel" },
],
type: FilterTypes.CheckboxGroup,
},
genres: {
value: [],
label: "Kategori",
options: [
{ label: "+18", value: "18" },
{ label: "Action", value: "action" },
{ label: "Adult", value: "adult" },
{ label: "Aksiyon", value: "aksiyon" },
{ label: "BL", value: "bl" },
{ label: "Comedy", value: "comedy" },
{ label: "Doğaüstü", value: "dogaustu" },
{ label: "Dram", value: "dram" },
{ label: "Drama", value: "drama" },
{ label: "Ecchi", value: "ecchi" },
{ label: "Fantastik", value: "fantastik" },
{ label: "Fantasy", value: "fantasy" },
{ label: "Gizem", value: "gizem" },
{ label: "Harem", value: "harem" },
{ label: "Historical", value: "historical" },
{ label: "Josei", value: "josei" },
{ label: "Macera", value: "macera" },
{ label: "Manhwa", value: "manhwa" },
{ label: "Martial Arts", value: "martial-arts" },
{ label: "Mature", value: "mature" },
{ label: "Novel", value: "novel" },
{ label: "Okul", value: "okul" },
{ label: "Psikolojik", value: "psikolojik" },
{ label: "Psychological", value: "psychological" },
{ label: "Reverse Harem", value: "reverse-harem" },
{ label: "Romance", value: "romance" },
{ label: "Romantik", value: "romantik" },
{ label: "Shoujo", value: "shoujo" },
{ label: "Slice Of Life", value: "slice-of-life" },
{ label: "Smut", value: "smut" },
{ label: "Supernatural", value: "supernatural" },
{ label: "Tarihi", value: "tarihi" },
{ label: "Tragedy", value: "tragedy" },
{ label: "Yaoi", value: "yaoi" },
],
type: FilterTypes.CheckboxGroup,
},
} satisfies Filters;
}
export default new LSHNovel();
+255 -256
View File
@@ -1,256 +1,255 @@
import { Plugin } from "@typings/plugin";
import { fetchApi, fetchFile } from "@libs/fetch";
import { NovelStatus } from "@libs/novelStatus";
import dayjs from "dayjs";
class Smakolykytl implements Plugin.PluginBase {
id = "smakolykytl";
name = "Смаколики";
site = "https://smakolykytl.site/";
version = "1.0.0";
icon = "src/ua/smakolykytl/icon.png";
userAgent = "";
cookieString = "";
async popularNovels(
pageNo: number,
{ showLatestNovels, filters }: Plugin.PopularNovelsOptions,
): Promise<Plugin.NovelItem[]> {
const url = showLatestNovels
? "https://api.smakolykytl.site/api/user/updates"
: "https://api.smakolykytl.site/api/user/projects";
const result = await fetchApi(url);
const json = (await result.json()) as response;
const novels: Plugin.NovelItem[] = [];
(json?.projects || json?.updates)?.forEach((novel) =>
novels.push({
name: novel.title,
cover: novel.image.url,
url: this.site + "titles/" + novel.id,
}),
);
return novels;
}
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
const id = novelUrl.split("/").pop();
const result = await fetchApi(
"https://api.smakolykytl.site/api/user/projects/" + id,
);
const book = (await result.json()) as response;
const novel: Plugin.SourceNovel = {
url: novelUrl,
name: book?.project?.title,
cover: book?.project?.image?.url,
summary: book?.project?.description,
author: book?.project?.author,
status: book?.project?.status_translate.includes("Триває")
? NovelStatus.Ongoing
: NovelStatus.Completed,
};
const tags = [book?.project?.genres, book?.project?.tags]
.flat()
.map((tags) => tags?.title)
.filter((tags) => tags);
if (tags.length) {
novel.genres = tags.join(", ");
}
const chapters: Plugin.ChapterItem[] = [];
const res = await fetchApi(
"https://api.smakolykytl.site/api/user/projects/" + id + "/books",
);
const data = (await res.json()) as response;
data?.books?.forEach(
(volume) =>
volume?.chapters?.map((chapter) =>
chapters.push({
name: volume.title + " " + chapter.title,
releaseTime: dayjs(chapter.modifiedAt).format("LLL"),
url: this.site + "read/" + chapter.id,
}),
),
);
novel.chapters = chapters;
return novel;
}
async parseChapter(chapterUrl: string): Promise<string> {
const id = chapterUrl.split("/").pop();
const result = await fetchApi(
"https://api.smakolykytl.site/api/user/chapters/" + id,
);
const json = (await result.json()) as response;
const chapterRaw: HTML[] = JSON.parse(json?.chapter?.content || "[]");
const chapterText = jsonToHtml(chapterRaw);
return chapterText;
}
async searchNovels(
searchTerm: string,
//pageNo: number | undefined = 1,
): Promise<Plugin.NovelItem[]> {
const result = await fetchApi(
"https://api.smakolykytl.site/api/user/projects",
);
const json = (await result.json()) as response;
const novels: Plugin.NovelItem[] = [];
json?.projects
?.filter(
(novel) =>
novel.title.includes(searchTerm) || String(novel.id) === searchTerm,
)
?.forEach((novel) =>
novels.push({
name: novel.title,
cover: novel.image.url,
url: this.site + "titles/" + novel.id,
}),
);
return novels;
}
fetchImage = fetchFile;
}
export default new Smakolykytl();
function jsonToHtml(json: HTML[], html: string = "") {
json.forEach((element) => {
switch (element.type) {
case "hardBreak":
html += "<br>";
break;
case "horizontalRule":
html += "<hr>";
break;
case "image":
if (element.attrs) {
const attrs = Object.entries(element.attrs)
.filter((attr) => attr?.[1])
.map((attr) => `${attr[0]}="${attr[1]}"`);
html += "<img " + attrs.join("; ") + ">";
}
break;
case "paragraph":
html +=
"<p>" +
(element.content ? jsonToHtml(element.content) : "<br>") +
"</p>";
break;
case "text":
html += element.text;
break;
default:
html += JSON.stringify(element, null, "\t"); //maybe I missed something.
break;
}
});
return html;
}
interface response {
projects?: TopLevelProject[];
updates?: Update[];
project?: TopLevelProject;
books?: BookElement[];
chapter?: TopLevelChapter;
}
interface BookElement {
id: number;
rank: number;
title: string;
chapters: PurpleChapter[];
}
interface PurpleChapter {
id: number;
title: string;
rank: string;
modifiedAt: Date;
}
interface TopLevelChapter {
id: number;
title: string;
rank: string;
content: string;
modifiedAt: Date;
book: ChapterBook;
}
interface ChapterBook {
id: number;
rank: number;
title: string;
chapters: FluffyChapter[];
project: BookProject;
}
interface FluffyChapter {
id: number;
rank: string;
}
interface BookProject {
id: number;
}
interface TopLevelProject {
id: number;
title: string;
description: string;
author: string;
translator: string;
modifiedAt: Date;
alternatives: string;
release: string;
nation: string;
status: string;
status_translate: string;
image: Image;
tags?: Genre[];
genres?: Genre[];
}
interface Genre {
id: number;
title: string;
}
interface Image {
id: number;
url: string;
name: string;
}
interface Update {
id: number;
title: string;
author: string;
translator: string;
modifiedAt: Date;
image: Image;
}
interface HTML {
type: string;
content?: HTML[];
attrs?: Attrs;
text?: string;
}
interface Attrs {
src: string;
alt: string | null;
title: string | null;
}
import { Plugin } from "@typings/plugin";
import { fetchApi, fetchFile } from "@libs/fetch";
import { NovelStatus } from "@libs/novelStatus";
import dayjs from "dayjs";
class Smakolykytl implements Plugin.PluginBase {
id = "smakolykytl";
name = "Смаколики";
site = "https://smakolykytl.site/";
version = "1.0.0";
icon = "src/ua/smakolykytl/icon.png";
userAgent = "";
async popularNovels(
pageNo: number,
{ showLatestNovels, filters }: Plugin.PopularNovelsOptions,
): Promise<Plugin.NovelItem[]> {
const url = showLatestNovels
? "https://api.smakolykytl.site/api/user/updates"
: "https://api.smakolykytl.site/api/user/projects";
const result = await fetchApi(url);
const json = (await result.json()) as response;
const novels: Plugin.NovelItem[] = [];
(json?.projects || json?.updates)?.forEach((novel) =>
novels.push({
name: novel.title,
cover: novel.image.url,
url: this.site + "titles/" + novel.id,
}),
);
return novels;
}
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
const id = novelUrl.split("/").pop();
const result = await fetchApi(
"https://api.smakolykytl.site/api/user/projects/" + id,
);
const book = (await result.json()) as response;
const novel: Plugin.SourceNovel = {
url: novelUrl,
name: book?.project?.title,
cover: book?.project?.image?.url,
summary: book?.project?.description,
author: book?.project?.author,
status: book?.project?.status_translate.includes("Триває")
? NovelStatus.Ongoing
: NovelStatus.Completed,
};
const tags = [book?.project?.genres, book?.project?.tags]
.flat()
.map((tags) => tags?.title)
.filter((tags) => tags);
if (tags.length) {
novel.genres = tags.join(", ");
}
const chapters: Plugin.ChapterItem[] = [];
const res = await fetchApi(
"https://api.smakolykytl.site/api/user/projects/" + id + "/books",
);
const data = (await res.json()) as response;
data?.books?.forEach(
(volume) =>
volume?.chapters?.map((chapter) =>
chapters.push({
name: volume.title + " " + chapter.title,
releaseTime: dayjs(chapter.modifiedAt).format("LLL"),
url: this.site + "read/" + chapter.id,
}),
),
);
novel.chapters = chapters;
return novel;
}
async parseChapter(chapterUrl: string): Promise<string> {
const id = chapterUrl.split("/").pop();
const result = await fetchApi(
"https://api.smakolykytl.site/api/user/chapters/" + id,
);
const json = (await result.json()) as response;
const chapterRaw: HTML[] = JSON.parse(json?.chapter?.content || "[]");
const chapterText = jsonToHtml(chapterRaw);
return chapterText;
}
async searchNovels(
searchTerm: string,
//pageNo: number | undefined = 1,
): Promise<Plugin.NovelItem[]> {
const result = await fetchApi(
"https://api.smakolykytl.site/api/user/projects",
);
const json = (await result.json()) as response;
const novels: Plugin.NovelItem[] = [];
json?.projects
?.filter(
(novel) =>
novel.title.includes(searchTerm) || String(novel.id) === searchTerm,
)
?.forEach((novel) =>
novels.push({
name: novel.title,
cover: novel.image.url,
url: this.site + "titles/" + novel.id,
}),
);
return novels;
}
fetchImage = fetchFile;
}
export default new Smakolykytl();
function jsonToHtml(json: HTML[], html: string = "") {
json.forEach((element) => {
switch (element.type) {
case "hardBreak":
html += "<br>";
break;
case "horizontalRule":
html += "<hr>";
break;
case "image":
if (element.attrs) {
const attrs = Object.entries(element.attrs)
.filter((attr) => attr?.[1])
.map((attr) => `${attr[0]}="${attr[1]}"`);
html += "<img " + attrs.join("; ") + ">";
}
break;
case "paragraph":
html +=
"<p>" +
(element.content ? jsonToHtml(element.content) : "<br>") +
"</p>";
break;
case "text":
html += element.text;
break;
default:
html += JSON.stringify(element, null, "\t"); //maybe I missed something.
break;
}
});
return html;
}
interface response {
projects?: TopLevelProject[];
updates?: Update[];
project?: TopLevelProject;
books?: BookElement[];
chapter?: TopLevelChapter;
}
interface BookElement {
id: number;
rank: number;
title: string;
chapters: PurpleChapter[];
}
interface PurpleChapter {
id: number;
title: string;
rank: string;
modifiedAt: Date;
}
interface TopLevelChapter {
id: number;
title: string;
rank: string;
content: string;
modifiedAt: Date;
book: ChapterBook;
}
interface ChapterBook {
id: number;
rank: number;
title: string;
chapters: FluffyChapter[];
project: BookProject;
}
interface FluffyChapter {
id: number;
rank: string;
}
interface BookProject {
id: number;
}
interface TopLevelProject {
id: number;
title: string;
description: string;
author: string;
translator: string;
modifiedAt: Date;
alternatives: string;
release: string;
nation: string;
status: string;
status_translate: string;
image: Image;
tags?: Genre[];
genres?: Genre[];
}
interface Genre {
id: number;
title: string;
}
interface Image {
id: number;
url: string;
name: string;
}
interface Update {
id: number;
title: string;
author: string;
translator: string;
modifiedAt: Date;
image: Image;
}
interface HTML {
type: string;
content?: HTML[];
attrs?: Attrs;
text?: string;
}
interface Attrs {
src: string;
alt: string | null;
title: string | null;
}
+1 -2
View File
@@ -9,7 +9,7 @@ class HakoPlugin implements Plugin.PluginBase {
site: string;
version: string;
userAgent: string;
cookieString: string;
constructor() {
this.id = "ln.hako";
this.name = "Hako";
@@ -17,7 +17,6 @@ class HakoPlugin implements Plugin.PluginBase {
this.site = "https://ln.hako.vn";
this.version = "1.0.0";
this.userAgent = "";
this.cookieString = "";
}
parseNovels(loadedCheerio: CheerioAPI) {
const novels: Plugin.NovelItem[] = [];

Some files were not shown because too many files have changed in this diff Show More