Full TS for Plugins (#538)
* remove lang, descrription in plugin script * remove languages import * Update README.md * fix: missing lang * clean: remove description * feat(Add Sources) (#15) * add many sources * add showToast * feat(Add Source): (#16) * add source * remove descriptions * Early Novel & Fast Novel (#1) * some more plugin * plugin * try something new * yes * try yes * genres is plural * fastnovel full fix * testings * early check * earlynovel fixed * showToast check * earlynovel done * fastnovel fixe * again * showToasts again * fix for fastnovel * done * for pr * Update freenovelupdates.js * MTL Reader and MTL Novel (#2) * first * test * wops * mtlreaders * ok * for PR * Nitro Scans and Novel Hold (#3) * start feature * more feature * something * eslint * yes * maybe * wa * asdasd * amazing * change it up * for pr * WPmangastream and Novelfull (#4) (#17) * source generation * fix json parse error * update plguins * delete fetchApi, nobleMTL (.js) * delete showToast.js * Typescript Support (#18) * Initial TS Config * Initial TS Config * Fix most errors * Fix test webserver * Fix webserver isPlugin not working * Fix typos * Add check if plugins have all the fields * Move exports.protected to the bottom of the plugin * Change username, reponame and branchname * Fix no exports error * Fix type * Fix typo in tsc_fix * Remove const from exports to not re-define consts * Readd const becuause exports may not exist. * Fix plugins to work in-app * Fix NobleMTL * Remove fix_ts.ts * Change template.ts * delete cheerio_space * move api into ./testweb * remove js dir * remove js dir (again) * remove ./js (again) * init multisrc generator (test) * remove module.exports in libs * madara generator * update template * rename generator, TS for hako * fix icon url for madara * fix icon for madara (again) * update Readme, nodemon * export default for all libs * fix madara novelurl * update: pluginId, name, filename for madara * feat: check same id error * update: precommit, fix: require.default * Revert "update: precommit, fix: require.default" This reverts commit c642c5c72241f13eccfe417210c22272c4739ffa. * Port all plugins to ts (#19) - fix cheerio - remove export default - fix spelling * update template * add multisrc noveltl, update generator param, fix web search * fix undefined id for Snailulitka * add rulate multisrc, fix max length textarea * add readwn multisrc * delete: erolate and rulate are in multisrc * Change broken extension and show error on commit for those files (#20) * Change to .broken.ts and show error on commit for those files * remove novelStatus * fix: wrong id in github action * remove mangastream multisrc * update icon for readwn multisrc --------- Co-authored-by: K1ngfish3r <trulyihu@gmail.com> Co-authored-by: Marcin Majewski <skilletssgames@gmail.com>
This commit is contained in:
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
exports.id = "boxnovel";
|
||||
exports.name = "BoxNovel [madara]";
|
||||
exports.icon = "multisrc/madara/icons/boxnovel.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://boxnovel.com/";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = (pageNo, { showLatestNovels }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
let url = exports.site + "novel" + '/page/' + pageNo + sortOrder;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
const body = yield (0, fetch_1.fetchApi)(novelUrl).then(res => res.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
novel.name = loadedCheerio('.post-title h1').text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
const detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\t\n]/g, ',');
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
novel.summary = loadedCheerio('div.summary__content').text().trim();
|
||||
let html;
|
||||
if (true) {
|
||||
const novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
const body = {
|
||||
action: "manga_get_chapters",
|
||||
manga: novelId,
|
||||
};
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
.then(res => res.text());
|
||||
}
|
||||
else {
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(res => res.text());
|
||||
}
|
||||
if (html !== '0') {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
const chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
let releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
releaseDate = (0, parseMadaraDate_1.parseMadaraDate)(releaseDate);
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
}
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = (chapterUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url);
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
exports.id = "clicknovel";
|
||||
exports.name = "ClickNovel [madara]";
|
||||
exports.icon = "multisrc/madara/icons/clicknovel.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://clicknovel.net/";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = (pageNo, { showLatestNovels }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
let url = exports.site + "novel" + '/page/' + pageNo + sortOrder;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
const body = yield (0, fetch_1.fetchApi)(novelUrl).then(res => res.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
novel.name = loadedCheerio('.post-title h1').text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
const detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\t\n]/g, ',');
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
novel.summary = loadedCheerio('div.summary__content').text().trim();
|
||||
let html;
|
||||
if (false) {
|
||||
const novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
const body = {
|
||||
action: "manga_get_chapters",
|
||||
manga: novelId,
|
||||
};
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
.then(res => res.text());
|
||||
}
|
||||
else {
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(res => res.text());
|
||||
}
|
||||
if (html !== '0') {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
const chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
let releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
releaseDate = (0, parseMadaraDate_1.parseMadaraDate)(releaseDate);
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
}
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = (chapterUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url);
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
exports.id = "cratenovel";
|
||||
exports.name = "CrateNovel [madara]";
|
||||
exports.icon = "multisrc/madara/icons/cratenovel.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://cratenovel.com/";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = (pageNo, { showLatestNovels }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
let url = exports.site + "novel" + '/page/' + pageNo + sortOrder;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
const body = yield (0, fetch_1.fetchApi)(novelUrl).then(res => res.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
novel.name = loadedCheerio('.post-title h1').text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
const detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\t\n]/g, ',');
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
novel.summary = loadedCheerio('div.summary__content').text().trim();
|
||||
let html;
|
||||
if (true) {
|
||||
const novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
const body = {
|
||||
action: "manga_get_chapters",
|
||||
manga: novelId,
|
||||
};
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
.then(res => res.text());
|
||||
}
|
||||
else {
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(res => res.text());
|
||||
}
|
||||
if (html !== '0') {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
const chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
let releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
releaseDate = (0, parseMadaraDate_1.parseMadaraDate)(releaseDate);
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
}
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = (chapterUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url);
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
exports.id = "daonovel";
|
||||
exports.name = "DaoNovel [madara]";
|
||||
exports.icon = "multisrc/madara/icons/daonovel.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://daonovel.com/";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = (pageNo, { showLatestNovels }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
let url = exports.site + "novels-list" + '/page/' + pageNo + sortOrder;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
const body = yield (0, fetch_1.fetchApi)(novelUrl).then(res => res.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
novel.name = loadedCheerio('.post-title h1').text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
const detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\t\n]/g, ',');
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
novel.summary = loadedCheerio('div.summary__content').text().trim();
|
||||
let html;
|
||||
if (true) {
|
||||
const novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
const body = {
|
||||
action: "manga_get_chapters",
|
||||
manga: novelId,
|
||||
};
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
.then(res => res.text());
|
||||
}
|
||||
else {
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(res => res.text());
|
||||
}
|
||||
if (html !== '0') {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
const chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
let releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
releaseDate = (0, parseMadaraDate_1.parseMadaraDate)(releaseDate);
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
}
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = (chapterUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = baseUrl + "/" + "novels" + "/" + chapterUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url);
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
exports.id = "fanTLS";
|
||||
exports.name = "Fans Translations [madara]";
|
||||
exports.icon = "multisrc/madara/icons/fanstranslations.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://fanstranslations.com/";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = (pageNo, { showLatestNovels }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
let url = exports.site + "novel" + '/page/' + pageNo + sortOrder;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
const body = yield (0, fetch_1.fetchApi)(novelUrl).then(res => res.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
novel.name = loadedCheerio('.post-title h1').text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
const detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\t\n]/g, ',');
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
novel.summary = loadedCheerio('div.summary__content').text().trim();
|
||||
let html;
|
||||
if (true) {
|
||||
const novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
const body = {
|
||||
action: "manga_get_chapters",
|
||||
manga: novelId,
|
||||
};
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
.then(res => res.text());
|
||||
}
|
||||
else {
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(res => res.text());
|
||||
}
|
||||
if (html !== '0') {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
const chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
let releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
releaseDate = (0, parseMadaraDate_1.parseMadaraDate)(releaseDate);
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
}
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = (chapterUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url);
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
exports.id = "1stkissnovel";
|
||||
exports.name = "FirstKissNovel [madara]";
|
||||
exports.icon = "multisrc/madara/icons/firstkissnovel.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://1stkissnovel.org/";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = (pageNo, { showLatestNovels }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
let url = exports.site + "novel" + '/page/' + pageNo + sortOrder;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
const body = yield (0, fetch_1.fetchApi)(novelUrl).then(res => res.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
novel.name = loadedCheerio('.post-title h1').text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
const detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\t\n]/g, ',');
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
novel.summary = loadedCheerio('div.summary__content').text().trim();
|
||||
let html;
|
||||
if (true) {
|
||||
const novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
const body = {
|
||||
action: "manga_get_chapters",
|
||||
manga: novelId,
|
||||
};
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
.then(res => res.text());
|
||||
}
|
||||
else {
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(res => res.text());
|
||||
}
|
||||
if (html !== '0') {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
const chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
let releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
releaseDate = (0, parseMadaraDate_1.parseMadaraDate)(releaseDate);
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
}
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = (chapterUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url);
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
exports.id = "freenovel.me";
|
||||
exports.name = "FreeNovelMe [madara]";
|
||||
exports.icon = "multisrc/madara/icons/freenovelme.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://freenovel.me/";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = (pageNo, { showLatestNovels }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
let url = exports.site + "novel" + '/page/' + pageNo + sortOrder;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
const body = yield (0, fetch_1.fetchApi)(novelUrl).then(res => res.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
novel.name = loadedCheerio('.post-title h1').text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
const detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\t\n]/g, ',');
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
novel.summary = loadedCheerio('div.summary__content').text().trim();
|
||||
let html;
|
||||
if (false) {
|
||||
const novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
const body = {
|
||||
action: "manga_get_chapters",
|
||||
manga: novelId,
|
||||
};
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
.then(res => res.text());
|
||||
}
|
||||
else {
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(res => res.text());
|
||||
}
|
||||
if (html !== '0') {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
const chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
let releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
releaseDate = (0, parseMadaraDate_1.parseMadaraDate)(releaseDate);
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
}
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = (chapterUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url);
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
exports.id = "guavaread";
|
||||
exports.name = "Guavaread [madara]";
|
||||
exports.icon = "multisrc/madara/icons/guavaread.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://guavaread.com/";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = (pageNo, { showLatestNovels }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
let url = exports.site + "novel" + '/page/' + pageNo + sortOrder;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
const body = yield (0, fetch_1.fetchApi)(novelUrl).then(res => res.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
novel.name = loadedCheerio('.post-title h1').text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
const detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\t\n]/g, ',');
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
novel.summary = loadedCheerio('div.summary__content').text().trim();
|
||||
let html;
|
||||
if (true) {
|
||||
const novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
const body = {
|
||||
action: "manga_get_chapters",
|
||||
manga: novelId,
|
||||
};
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
.then(res => res.text());
|
||||
}
|
||||
else {
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(res => res.text());
|
||||
}
|
||||
if (html !== '0') {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
const chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
let releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
releaseDate = (0, parseMadaraDate_1.parseMadaraDate)(releaseDate);
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
}
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = (chapterUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url);
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
exports.id = "lnheaven";
|
||||
exports.name = "LightNovelHeaven [madara]";
|
||||
exports.icon = "multisrc/madara/icons/lightnovelheaven.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://lightnovelheaven.com/";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = (pageNo, { showLatestNovels }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
let url = exports.site + "series" + '/page/' + pageNo + sortOrder;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
const body = yield (0, fetch_1.fetchApi)(novelUrl).then(res => res.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
novel.name = loadedCheerio('.post-title h1').text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
const detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\t\n]/g, ',');
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
novel.summary = loadedCheerio('div.summary__content').text().trim();
|
||||
let html;
|
||||
if (true) {
|
||||
const novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
const body = {
|
||||
action: "manga_get_chapters",
|
||||
manga: novelId,
|
||||
};
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
.then(res => res.text());
|
||||
}
|
||||
else {
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(res => res.text());
|
||||
}
|
||||
if (html !== '0') {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
const chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
let releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
releaseDate = (0, parseMadaraDate_1.parseMadaraDate)(releaseDate);
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
}
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = (chapterUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = baseUrl + "/" + "series" + "/" + chapterUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url);
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,164 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
// import dayjs from 'dayjs';
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
// import { parseMadaraDate } from "@libs/parseMadaraDate";
|
||||
// import { isUrlAbsolute } from '@libs/isAbsoluteUrl';
|
||||
// import { showToast } from "@libs/showToast";
|
||||
// import { Filter, FilterInputs } from "@libs/filterInputs";
|
||||
// import { NovelStatus } from '@libs/novelStatus';
|
||||
// import { defaultCover } from "@libs/defaultCover";
|
||||
exports.id = "Ltnovel.com";
|
||||
exports.name = "Ltnovel.com";
|
||||
exports.icon = "multisrc/readwn/icon/ltnovel.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://www.ltnovel.com/";
|
||||
// export const filters: Filter[] = [];
|
||||
exports["protected"] = false;
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = function (page, { filters, showLatestNovels }) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const pageNo = page - 1;
|
||||
const url = baseUrl + 'list/all/all-onclick-' + pageNo + '.html';
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('li.novel-item').each(function () {
|
||||
const novelName = loadedCheerio(this).find('h4').text();
|
||||
const novelUrl = baseUrl + loadedCheerio(this).find('a').attr('href');
|
||||
const coverUri = loadedCheerio(this)
|
||||
.find('.novel-cover > img')
|
||||
.attr('data-src');
|
||||
const novelCover = baseUrl + coverUri;
|
||||
const novel = { name: novelName, cover: novelCover, url: novelUrl };
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)(novelUrl);
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
chapters: [],
|
||||
};
|
||||
novel.name = loadedCheerio('h1.novel-title').text();
|
||||
const coverUri = loadedCheerio('figure.cover > img').attr('data-src');
|
||||
novel.cover = baseUrl + coverUri;
|
||||
novel.summary = loadedCheerio('.summary')
|
||||
.text()
|
||||
.replace('Summary', '')
|
||||
.trim();
|
||||
novel.genres = '';
|
||||
loadedCheerio('div.categories > ul > li').each(function () {
|
||||
novel.genres += loadedCheerio(this).text().trim() + ',';
|
||||
});
|
||||
loadedCheerio('div.header-stats > span').each(function () {
|
||||
if (loadedCheerio(this).find('small').text() === 'Status') {
|
||||
novel.status = loadedCheerio(this).find('strong').text();
|
||||
}
|
||||
});
|
||||
novel.genres = novel.genres.slice(0, -1);
|
||||
novel.author = loadedCheerio('span[itemprop=author]').text();
|
||||
let novelChapters = [];
|
||||
const novelId = novelUrl.replace('.html', '').replace(baseUrl, '');
|
||||
const latestChapterNo = parseInt(loadedCheerio('.header-stats')
|
||||
.find('span > strong')
|
||||
.first()
|
||||
.text()
|
||||
.trim());
|
||||
let lastChapterNo = 1;
|
||||
loadedCheerio('.chapter-list li').each(function () {
|
||||
var _a;
|
||||
const chapterName = loadedCheerio(this)
|
||||
.find('a .chapter-title')
|
||||
.text()
|
||||
.trim();
|
||||
const chapterUrl = baseUrl + ((_a = loadedCheerio(this).find('a').attr('href')) === null || _a === void 0 ? void 0 : _a.trim());
|
||||
const releaseDate = loadedCheerio(this)
|
||||
.find('a .chapter-update')
|
||||
.text()
|
||||
.trim();
|
||||
lastChapterNo = parseInt(loadedCheerio(this).find('a .chapter-no').text().trim());
|
||||
const chapter = { name: chapterName, releaseTime: releaseDate, url: chapterUrl };
|
||||
novelChapters.push(chapter);
|
||||
});
|
||||
// Itterate once more before loop to finish off
|
||||
lastChapterNo++;
|
||||
for (let i = lastChapterNo; i <= latestChapterNo; i++) {
|
||||
const chapterName = 'Chapter ' + i;
|
||||
const chapterUrl = baseUrl + novelId + '_' + i + '.html';
|
||||
const releaseDate = null;
|
||||
const chapter = { name: chapterName, releaseTime: releaseDate, url: chapterUrl };
|
||||
novelChapters.push(chapter);
|
||||
}
|
||||
novel.chapters = novelChapters;
|
||||
return novel;
|
||||
});
|
||||
};
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = function (chapterUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)(chapterUrl);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.chapter-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const searchUrl = baseUrl + 'e/search/index.php';
|
||||
const result = yield (0, fetch_1.fetchApi)(searchUrl, {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
Referer: baseUrl + 'search.html',
|
||||
Origin: baseUrl,
|
||||
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36',
|
||||
},
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
show: 'title',
|
||||
tempid: 1,
|
||||
tbname: 'news',
|
||||
keyboard: searchTerm,
|
||||
}),
|
||||
});
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('li.novel-item').each(function () {
|
||||
const novelName = loadedCheerio(this).find('h4').text();
|
||||
const novelUrl = baseUrl + loadedCheerio(this).find('a').attr('href');
|
||||
const coverUri = baseUrl + loadedCheerio(this).find('img').attr('data-src');
|
||||
const novelCover = baseUrl + coverUri;
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url, {});
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
exports.id = "lunarletters";
|
||||
exports.name = "LunarLetters [madara]";
|
||||
exports.icon = "multisrc/madara/icons/lunarletters.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://www.lunarletters.com/";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = (pageNo, { showLatestNovels }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
let url = exports.site + "series" + '/page/' + pageNo + sortOrder;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
const body = yield (0, fetch_1.fetchApi)(novelUrl).then(res => res.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
novel.name = loadedCheerio('.post-title h1').text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
const detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\t\n]/g, ',');
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
novel.summary = loadedCheerio('div.summary__content').text().trim();
|
||||
let html;
|
||||
if (true) {
|
||||
const novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
const body = {
|
||||
action: "manga_get_chapters",
|
||||
manga: novelId,
|
||||
};
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
.then(res => res.text());
|
||||
}
|
||||
else {
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(res => res.text());
|
||||
}
|
||||
if (html !== '0') {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
const chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
let releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
releaseDate = (0, parseMadaraDate_1.parseMadaraDate)(releaseDate);
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
}
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = (chapterUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = baseUrl + "/" + "series" + "/" + chapterUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url);
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
exports.id = "mtlnovel.club";
|
||||
exports.name = "MTLNovel.Club [madara]";
|
||||
exports.icon = "multisrc/madara/icons/mtlnovel.club.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://mtlnovel.club/";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = (pageNo, { showLatestNovels }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
let url = exports.site + "novel" + '/page/' + pageNo + sortOrder;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
const body = yield (0, fetch_1.fetchApi)(novelUrl).then(res => res.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
novel.name = loadedCheerio('.post-title h1').text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
const detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\t\n]/g, ',');
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
novel.summary = loadedCheerio('div.summary__content').text().trim();
|
||||
let html;
|
||||
if (true) {
|
||||
const novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
const body = {
|
||||
action: "manga_get_chapters",
|
||||
manga: novelId,
|
||||
};
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
.then(res => res.text());
|
||||
}
|
||||
else {
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(res => res.text());
|
||||
}
|
||||
if (html !== '0') {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
const chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
let releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
releaseDate = (0, parseMadaraDate_1.parseMadaraDate)(releaseDate);
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
}
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = (chapterUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url);
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
exports.id = "mtl-novel";
|
||||
exports.name = "MTL-Novel [madara]";
|
||||
exports.icon = "multisrc/madara/icons/mtl-novel.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://mtl-novel.com/";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = (pageNo, { showLatestNovels }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
let url = exports.site + "novel" + '/page/' + pageNo + sortOrder;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
const body = yield (0, fetch_1.fetchApi)(novelUrl).then(res => res.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
novel.name = loadedCheerio('.post-title h1').text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
const detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\t\n]/g, ',');
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
novel.summary = loadedCheerio('div.summary__content').text().trim();
|
||||
let html;
|
||||
if (true) {
|
||||
const novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
const body = {
|
||||
action: "manga_get_chapters",
|
||||
manga: novelId,
|
||||
};
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
.then(res => res.text());
|
||||
}
|
||||
else {
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(res => res.text());
|
||||
}
|
||||
if (html !== '0') {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
const chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
let releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
releaseDate = (0, parseMadaraDate_1.parseMadaraDate)(releaseDate);
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
}
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = (chapterUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url);
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
exports.id = "mostnovel";
|
||||
exports.name = "MostNovel [madara]";
|
||||
exports.icon = "multisrc/madara/icons/mostnovel.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://mostnovel.com/";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = (pageNo, { showLatestNovels }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
let url = exports.site + "manga" + '/page/' + pageNo + sortOrder;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
const body = yield (0, fetch_1.fetchApi)(novelUrl).then(res => res.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
novel.name = loadedCheerio('.post-title h1').text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
const detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\t\n]/g, ',');
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
novel.summary = loadedCheerio('div.summary__content').text().trim();
|
||||
let html;
|
||||
if (false) {
|
||||
const novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
const body = {
|
||||
action: "manga_get_chapters",
|
||||
manga: novelId,
|
||||
};
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
.then(res => res.text());
|
||||
}
|
||||
else {
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(res => res.text());
|
||||
}
|
||||
if (html !== '0') {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
const chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
let releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
releaseDate = (0, parseMadaraDate_1.parseMadaraDate)(releaseDate);
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
}
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = (chapterUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = baseUrl + "/" + "manga" + "/" + chapterUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url);
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
exports.id = "mysticalmerries";
|
||||
exports.name = "MysticalSeries [madara]";
|
||||
exports.icon = "multisrc/madara/icons/mysticalseries.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://mysticalmerries.com/";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = (pageNo, { showLatestNovels }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
let url = exports.site + "series" + '/page/' + pageNo + sortOrder;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
const body = yield (0, fetch_1.fetchApi)(novelUrl).then(res => res.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
novel.name = loadedCheerio('.post-title h1').text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
const detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\t\n]/g, ',');
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
novel.summary = loadedCheerio('div.summary__content').text().trim();
|
||||
let html;
|
||||
if (true) {
|
||||
const novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
const body = {
|
||||
action: "manga_get_chapters",
|
||||
manga: novelId,
|
||||
};
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
.then(res => res.text());
|
||||
}
|
||||
else {
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(res => res.text());
|
||||
}
|
||||
if (html !== '0') {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
const chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
let releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
releaseDate = (0, parseMadaraDate_1.parseMadaraDate)(releaseDate);
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
}
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = (chapterUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = baseUrl + "/" + "series" + "/" + chapterUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url);
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
exports.id = "neosekaiTLS";
|
||||
exports.name = "NeoSekai Translations [madara]";
|
||||
exports.icon = "multisrc/madara/icons/neosekaitranslations.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://www.neosekaitranslations.com/";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = (pageNo, { showLatestNovels }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
let url = exports.site + "novel" + '/page/' + pageNo + sortOrder;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
const body = yield (0, fetch_1.fetchApi)(novelUrl).then(res => res.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
novel.name = loadedCheerio('.post-title h1').text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
const detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\t\n]/g, ',');
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
novel.summary = loadedCheerio('div.summary__content').text().trim();
|
||||
let html;
|
||||
if (false) {
|
||||
const novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
const body = {
|
||||
action: "manga_get_chapters",
|
||||
manga: novelId,
|
||||
};
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
.then(res => res.text());
|
||||
}
|
||||
else {
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(res => res.text());
|
||||
}
|
||||
if (html !== '0') {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
const chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
let releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
releaseDate = (0, parseMadaraDate_1.parseMadaraDate)(releaseDate);
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
}
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = (chapterUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url);
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
exports.id = "nocturneTLS";
|
||||
exports.name = "Nocturne Translations [madara]";
|
||||
exports.icon = "multisrc/madara/icons/nocturnetranslations.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://nocturnetls.net/";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = (pageNo, { showLatestNovels }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
let url = exports.site + "novels" + '/page/' + pageNo + sortOrder;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
const body = yield (0, fetch_1.fetchApi)(novelUrl).then(res => res.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
novel.name = loadedCheerio('.post-title h1').text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
const detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\t\n]/g, ',');
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
novel.summary = loadedCheerio('div.summary__content').text().trim();
|
||||
let html;
|
||||
if (false) {
|
||||
const novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
const body = {
|
||||
action: "manga_get_chapters",
|
||||
manga: novelId,
|
||||
};
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
.then(res => res.text());
|
||||
}
|
||||
else {
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(res => res.text());
|
||||
}
|
||||
if (html !== '0') {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
const chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
let releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
releaseDate = (0, parseMadaraDate_1.parseMadaraDate)(releaseDate);
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
}
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = (chapterUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = baseUrl + "/" + "novels" + "/" + chapterUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url);
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
exports.id = "noobchanTL";
|
||||
exports.name = "Noobchan Translation [madara]";
|
||||
exports.icon = "multisrc/madara/icons/noobchantranslation.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://noobchan.xyz/";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = (pageNo, { showLatestNovels }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
let url = exports.site + "novel" + '/page/' + pageNo + sortOrder;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
const body = yield (0, fetch_1.fetchApi)(novelUrl).then(res => res.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
novel.name = loadedCheerio('.post-title h1').text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
const detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\t\n]/g, ',');
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
novel.summary = loadedCheerio('div.summary__content').text().trim();
|
||||
let html;
|
||||
if (true) {
|
||||
const novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
const body = {
|
||||
action: "manga_get_chapters",
|
||||
manga: novelId,
|
||||
};
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
.then(res => res.text());
|
||||
}
|
||||
else {
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(res => res.text());
|
||||
}
|
||||
if (html !== '0') {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
const chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
let releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
releaseDate = (0, parseMadaraDate_1.parseMadaraDate)(releaseDate);
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
}
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = (chapterUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url);
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,131 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.icon = exports.version = exports.site = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
exports.id = "NF.me";
|
||||
exports.name = "NovelFull.me";
|
||||
exports.site = "https://novelfull.me/";
|
||||
exports.version = "1.0.0";
|
||||
exports.icon = "src/en/novelfullme/icon.png";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = function (page) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = `${baseUrl}popular?page=${page}`;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio(".book-item").each(function () {
|
||||
var _a;
|
||||
const novelName = loadedCheerio(this).find(".title").text();
|
||||
const novelCover = "https:" + loadedCheerio(this).find("img").attr("data-src");
|
||||
const novelUrl = baseUrl +
|
||||
((_a = loadedCheerio(this).find(".title a").attr("href")) === null || _a === void 0 ? void 0 : _a.substring(1));
|
||||
const novel = { name: novelName, cover: novelCover, url: novelUrl };
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
var _a, _b;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = novelUrl;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novel = {
|
||||
url,
|
||||
name: "",
|
||||
cover: "",
|
||||
author: "",
|
||||
status: "",
|
||||
genres: "",
|
||||
summary: "",
|
||||
chapters: [],
|
||||
};
|
||||
novel.name = loadedCheerio(".name h1").text().trim();
|
||||
novel.cover =
|
||||
"https:" + loadedCheerio(".img-cover img").attr("data-src");
|
||||
novel.summary = loadedCheerio("body > div.layout > div.main-container.book-details > div > div.row.no-gutters > div.col-lg-8 > div.mt-1 > div.section.box.mt-1.summary > div.section-body > p.content")
|
||||
.text()
|
||||
.trim();
|
||||
novel.author = "Unknown";
|
||||
novel.status = (_a = loadedCheerio("body > div.layout > div.main-container.book-details > div > div.row.no-gutters > div.col-lg-8 > div.book-info > div.detail > div.meta.box.mt-1.p-10 > p:nth-child(1) > a > span")
|
||||
.text()) === null || _a === void 0 ? void 0 : _a.trim();
|
||||
novel.genres = (_b = loadedCheerio("body > div.layout > div.main-container.book-details > div > div.row.no-gutters > div.col-lg-8 > div.book-info > div.detail > div.meta.box.mt-1.p-10 > p:nth-child(2)")
|
||||
.text()) === null || _b === void 0 ? void 0 : _b.replace("Genres :", "").replace(/[\s\n]+/g, " ").trim();
|
||||
let chapters = [];
|
||||
const chaptersUrl = novelUrl.replace(baseUrl, "https://novelfull.me/api/novels/") +
|
||||
"/chapters?source=detail";
|
||||
const chaptersRequest = yield (0, fetch_1.fetchApi)(chaptersUrl);
|
||||
const chaptersHtml = yield chaptersRequest.text();
|
||||
loadedCheerio = (0, cheerio_1.load)(chaptersHtml);
|
||||
loadedCheerio("li").each(function () {
|
||||
const chapterName = loadedCheerio(this)
|
||||
.find(".chapter-title")
|
||||
.text()
|
||||
.trim();
|
||||
const releaseDate = loadedCheerio(this)
|
||||
.find(".chapter-update")
|
||||
.text()
|
||||
.trim();
|
||||
const chapterUrl = loadedCheerio(this).find("a").attr("href");
|
||||
if (!chapterUrl)
|
||||
return;
|
||||
chapters.push({
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
});
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
};
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = function (chapterUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = chapterUrl;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio("#listen-chapter").remove();
|
||||
loadedCheerio("#google_translate_element").remove();
|
||||
const chapterText = loadedCheerio(".chapter__content").html();
|
||||
return chapterText;
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = function (searchTerm) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = `${baseUrl}search?status=all&sort=views&q=${searchTerm}`;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio(".book-item").each(function () {
|
||||
var _a;
|
||||
const novelName = loadedCheerio(this).find(".title").text();
|
||||
const novelCover = "https:" + loadedCheerio(this).find("img").attr("data-src");
|
||||
const novelUrl = baseUrl +
|
||||
((_a = loadedCheerio(this).find(".title a").attr("href")) === null || _a === void 0 ? void 0 : _a.substring(1));
|
||||
const novel = { name: novelName, cover: novelCover, url: novelUrl };
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.searchNovels = searchNovels;
|
||||
exports.fetchImage = fetch_1.fetchFile;
|
||||
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
exports.id = "novelmultiverse";
|
||||
exports.name = "NovelMultiverse [madara]";
|
||||
exports.icon = "multisrc/madara/icons/novelmultiverse.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://www.novelmultiverse.com/";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = (pageNo, { showLatestNovels }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
let url = exports.site + "novel" + '/page/' + pageNo + sortOrder;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
const body = yield (0, fetch_1.fetchApi)(novelUrl).then(res => res.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
novel.name = loadedCheerio('.post-title h1').text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
const detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\t\n]/g, ',');
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
novel.summary = loadedCheerio('div.summary__content').text().trim();
|
||||
let html;
|
||||
if (false) {
|
||||
const novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
const body = {
|
||||
action: "manga_get_chapters",
|
||||
manga: novelId,
|
||||
};
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
.then(res => res.text());
|
||||
}
|
||||
else {
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(res => res.text());
|
||||
}
|
||||
if (html !== '0') {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
const chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
let releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
releaseDate = (0, parseMadaraDate_1.parseMadaraDate)(releaseDate);
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
}
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = (chapterUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url);
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,104 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.parseChapter = exports.popularNovels = exports.parseNovelAndChapters = exports.searchNovels = exports.version = exports.icon = exports.site = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
exports.id = "NO.net";
|
||||
exports.name = "novelsOnline";
|
||||
exports.site = "https://novelsonline.net";
|
||||
exports.icon = "src/coverNotAvailable.jpg";
|
||||
exports.version = "1.0.0";
|
||||
const pluginId = exports.id;
|
||||
const searchNovels = function (searchTerm) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)("https://novelsonline.net/sResults.php", {
|
||||
headers: {
|
||||
Accept: "*/*",
|
||||
"Accept-Language": "pl,en-US;q=0.7,en;q=0.3",
|
||||
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
|
||||
},
|
||||
method: "POST",
|
||||
body: "q=" + encodeURIComponent(searchTerm),
|
||||
}, pluginId).then((res) => res.text());
|
||||
let $ = (0, cheerio_1.load)(result);
|
||||
const headers = $("li");
|
||||
return headers
|
||||
.map((i, h) => {
|
||||
const novelName = $(h).text();
|
||||
const novelUrl = $(h).find("a").attr("href");
|
||||
const novelCover = $(h).find("img").attr("src");
|
||||
if (!novelUrl) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
})
|
||||
.get()
|
||||
.filter((sr) => sr !== null);
|
||||
});
|
||||
};
|
||||
exports.searchNovels = searchNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let novel = {
|
||||
url: novelUrl,
|
||||
chapters: [],
|
||||
};
|
||||
const result = yield (0, fetch_1.fetchApi)(novelUrl).then((res) => res.text());
|
||||
let $ = (0, cheerio_1.load)(result);
|
||||
novel.name = $("h1").text();
|
||||
novel.cover = $(".novel-cover").find("a > img").attr("src");
|
||||
novel.author = $("div.novel-details > div:nth-child(5) > div.novel-detail-body")
|
||||
.find("li")
|
||||
.map((_, el) => $(el).text())
|
||||
.get()
|
||||
.join(", ");
|
||||
novel.genres = $("div.novel-details > div:nth-child(2) > div.novel-detail-body")
|
||||
.find("li")
|
||||
.map((_, el) => $(el).text())
|
||||
.get()
|
||||
.join(",");
|
||||
novel.summary = $("div.novel-right > div > div:nth-child(1) > div.novel-detail-body").text();
|
||||
novel.chapters = $("ul.chapter-chs > li > a")
|
||||
.map((_, el) => {
|
||||
const chapterUrl = $(el).attr("href");
|
||||
const chapterName = $(el).text();
|
||||
return {
|
||||
name: chapterName,
|
||||
releaseTime: "",
|
||||
url: chapterUrl,
|
||||
};
|
||||
})
|
||||
.get();
|
||||
return novel;
|
||||
});
|
||||
};
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const popularNovels = function (page) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return []; /** TO DO */
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseChapter = function (chapterUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)(chapterUrl).then((res) => res.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(result);
|
||||
const chapterText = loadedCheerio("#contentall").html() || "";
|
||||
return chapterText;
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
exports.fetchImage = fetch_1.fetchFile;
|
||||
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
exports.id = "novelr18";
|
||||
exports.name = "NovelR18 [madara]";
|
||||
exports.icon = "multisrc/madara/icons/novelr18.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://novelr18.com/";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = (pageNo, { showLatestNovels }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
let url = exports.site + "novel" + '/page/' + pageNo + sortOrder;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
const body = yield (0, fetch_1.fetchApi)(novelUrl).then(res => res.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
novel.name = loadedCheerio('.post-title h1').text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
const detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\t\n]/g, ',');
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
novel.summary = loadedCheerio('div.summary__content').text().trim();
|
||||
let html;
|
||||
if (true) {
|
||||
const novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
const body = {
|
||||
action: "manga_get_chapters",
|
||||
manga: novelId,
|
||||
};
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
.then(res => res.text());
|
||||
}
|
||||
else {
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(res => res.text());
|
||||
}
|
||||
if (html !== '0') {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
const chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
let releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
releaseDate = (0, parseMadaraDate_1.parseMadaraDate)(releaseDate);
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
}
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = (chapterUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = baseUrl + "/" + "manga" + "/" + chapterUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url);
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
exports.id = "novelTL";
|
||||
exports.name = "NovelTranslate [madara]";
|
||||
exports.icon = "multisrc/madara/icons/noveltranslate.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://noveltranslate.com/";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = (pageNo, { showLatestNovels }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
let url = exports.site + "all-novels" + '/page/' + pageNo + sortOrder;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
const body = yield (0, fetch_1.fetchApi)(novelUrl).then(res => res.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
novel.name = loadedCheerio('.post-title h1').text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
const detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\t\n]/g, ',');
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
novel.summary = loadedCheerio('div.summary__content').text().trim();
|
||||
let html;
|
||||
if (false) {
|
||||
const novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
const body = {
|
||||
action: "manga_get_chapters",
|
||||
manga: novelId,
|
||||
};
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
.then(res => res.text());
|
||||
}
|
||||
else {
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(res => res.text());
|
||||
}
|
||||
if (html !== '0') {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
const chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
let releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
releaseDate = (0, parseMadaraDate_1.parseMadaraDate)(releaseDate);
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
}
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = (chapterUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = baseUrl + "/" + "manga" + "/" + chapterUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url);
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,164 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
// import dayjs from 'dayjs';
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
// import { parseMadaraDate } from "@libs/parseMadaraDate";
|
||||
// import { isUrlAbsolute } from '@libs/isAbsoluteUrl';
|
||||
// import { showToast } from "@libs/showToast";
|
||||
// import { Filter, FilterInputs } from "@libs/filterInputs";
|
||||
// import { NovelStatus } from '@libs/novelStatus';
|
||||
// import { defaultCover } from "@libs/defaultCover";
|
||||
exports.id = "Novelmt.com";
|
||||
exports.name = "Novelmt.com";
|
||||
exports.icon = "multisrc/readwn/icon/novelmt.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://www.novelmt.com/";
|
||||
// export const filters: Filter[] = [];
|
||||
exports["protected"] = false;
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = function (page, { filters, showLatestNovels }) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const pageNo = page - 1;
|
||||
const url = baseUrl + 'list/all/all-onclick-' + pageNo + '.html';
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('li.novel-item').each(function () {
|
||||
const novelName = loadedCheerio(this).find('h4').text();
|
||||
const novelUrl = baseUrl + loadedCheerio(this).find('a').attr('href');
|
||||
const coverUri = loadedCheerio(this)
|
||||
.find('.novel-cover > img')
|
||||
.attr('data-src');
|
||||
const novelCover = baseUrl + coverUri;
|
||||
const novel = { name: novelName, cover: novelCover, url: novelUrl };
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)(novelUrl);
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
chapters: [],
|
||||
};
|
||||
novel.name = loadedCheerio('h1.novel-title').text();
|
||||
const coverUri = loadedCheerio('figure.cover > img').attr('data-src');
|
||||
novel.cover = baseUrl + coverUri;
|
||||
novel.summary = loadedCheerio('.summary')
|
||||
.text()
|
||||
.replace('Summary', '')
|
||||
.trim();
|
||||
novel.genres = '';
|
||||
loadedCheerio('div.categories > ul > li').each(function () {
|
||||
novel.genres += loadedCheerio(this).text().trim() + ',';
|
||||
});
|
||||
loadedCheerio('div.header-stats > span').each(function () {
|
||||
if (loadedCheerio(this).find('small').text() === 'Status') {
|
||||
novel.status = loadedCheerio(this).find('strong').text();
|
||||
}
|
||||
});
|
||||
novel.genres = novel.genres.slice(0, -1);
|
||||
novel.author = loadedCheerio('span[itemprop=author]').text();
|
||||
let novelChapters = [];
|
||||
const novelId = novelUrl.replace('.html', '').replace(baseUrl, '');
|
||||
const latestChapterNo = parseInt(loadedCheerio('.header-stats')
|
||||
.find('span > strong')
|
||||
.first()
|
||||
.text()
|
||||
.trim());
|
||||
let lastChapterNo = 1;
|
||||
loadedCheerio('.chapter-list li').each(function () {
|
||||
var _a;
|
||||
const chapterName = loadedCheerio(this)
|
||||
.find('a .chapter-title')
|
||||
.text()
|
||||
.trim();
|
||||
const chapterUrl = baseUrl + ((_a = loadedCheerio(this).find('a').attr('href')) === null || _a === void 0 ? void 0 : _a.trim());
|
||||
const releaseDate = loadedCheerio(this)
|
||||
.find('a .chapter-update')
|
||||
.text()
|
||||
.trim();
|
||||
lastChapterNo = parseInt(loadedCheerio(this).find('a .chapter-no').text().trim());
|
||||
const chapter = { name: chapterName, releaseTime: releaseDate, url: chapterUrl };
|
||||
novelChapters.push(chapter);
|
||||
});
|
||||
// Itterate once more before loop to finish off
|
||||
lastChapterNo++;
|
||||
for (let i = lastChapterNo; i <= latestChapterNo; i++) {
|
||||
const chapterName = 'Chapter ' + i;
|
||||
const chapterUrl = baseUrl + novelId + '_' + i + '.html';
|
||||
const releaseDate = null;
|
||||
const chapter = { name: chapterName, releaseTime: releaseDate, url: chapterUrl };
|
||||
novelChapters.push(chapter);
|
||||
}
|
||||
novel.chapters = novelChapters;
|
||||
return novel;
|
||||
});
|
||||
};
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = function (chapterUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)(chapterUrl);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.chapter-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const searchUrl = baseUrl + 'e/search/index.php';
|
||||
const result = yield (0, fetch_1.fetchApi)(searchUrl, {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
Referer: baseUrl + 'search.html',
|
||||
Origin: baseUrl,
|
||||
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36',
|
||||
},
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
show: 'title',
|
||||
tempid: 1,
|
||||
tbname: 'news',
|
||||
keyboard: searchTerm,
|
||||
}),
|
||||
});
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('li.novel-item').each(function () {
|
||||
const novelName = loadedCheerio(this).find('h4').text();
|
||||
const novelUrl = baseUrl + loadedCheerio(this).find('a').attr('href');
|
||||
const coverUri = baseUrl + loadedCheerio(this).find('img').attr('data-src');
|
||||
const novelCover = baseUrl + coverUri;
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url, {});
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
exports.id = "novelroom";
|
||||
exports.name = "Novelroom.net [madara]";
|
||||
exports.icon = "multisrc/madara/icons/novelroom.net.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://novelroom.net/";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = (pageNo, { showLatestNovels }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
let url = exports.site + "manga" + '/page/' + pageNo + sortOrder;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
const body = yield (0, fetch_1.fetchApi)(novelUrl).then(res => res.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
novel.name = loadedCheerio('.post-title h1').text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
const detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\t\n]/g, ',');
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
novel.summary = loadedCheerio('div.summary__content').text().trim();
|
||||
let html;
|
||||
if (false) {
|
||||
const novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
const body = {
|
||||
action: "manga_get_chapters",
|
||||
manga: novelId,
|
||||
};
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
.then(res => res.text());
|
||||
}
|
||||
else {
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(res => res.text());
|
||||
}
|
||||
if (html !== '0') {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
const chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
let releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
releaseDate = (0, parseMadaraDate_1.parseMadaraDate)(releaseDate);
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
}
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = (chapterUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = baseUrl + "/" + "manga" + "/" + chapterUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url);
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
exports.id = "novelstic";
|
||||
exports.name = "Novelstic [madara]";
|
||||
exports.icon = "multisrc/madara/icons/novelstic.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://novelstic.com/";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = (pageNo, { showLatestNovels }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
let url = exports.site + "novel" + '/page/' + pageNo + sortOrder;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
const body = yield (0, fetch_1.fetchApi)(novelUrl).then(res => res.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
novel.name = loadedCheerio('.post-title h1').text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
const detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\t\n]/g, ',');
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
novel.summary = loadedCheerio('div.summary__content').text().trim();
|
||||
let html;
|
||||
if (true) {
|
||||
const novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
const body = {
|
||||
action: "manga_get_chapters",
|
||||
manga: novelId,
|
||||
};
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
.then(res => res.text());
|
||||
}
|
||||
else {
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(res => res.text());
|
||||
}
|
||||
if (html !== '0') {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
const chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
let releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
releaseDate = (0, parseMadaraDate_1.parseMadaraDate)(releaseDate);
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
}
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = (chapterUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url);
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
exports.id = "onlymtl";
|
||||
exports.name = "OnlyMTL [madara]";
|
||||
exports.icon = "multisrc/madara/icons/onlymtl.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://www.onlymtl.com/";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = (pageNo, { showLatestNovels }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
let url = exports.site + "novel" + '/page/' + pageNo + sortOrder;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
const body = yield (0, fetch_1.fetchApi)(novelUrl).then(res => res.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
novel.name = loadedCheerio('.post-title h1').text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
const detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\t\n]/g, ',');
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
novel.summary = loadedCheerio('div.summary__content').text().trim();
|
||||
let html;
|
||||
if (true) {
|
||||
const novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
const body = {
|
||||
action: "manga_get_chapters",
|
||||
manga: novelId,
|
||||
};
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
.then(res => res.text());
|
||||
}
|
||||
else {
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(res => res.text());
|
||||
}
|
||||
if (html !== '0') {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
const chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
let releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
releaseDate = (0, parseMadaraDate_1.parseMadaraDate)(releaseDate);
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
}
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = (chapterUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url);
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
exports.id = "readwebnovels";
|
||||
exports.name = "ReadWebNovels [madara]";
|
||||
exports.icon = "multisrc/madara/icons/readwebnovels.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://readwebnovels.net/";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = (pageNo, { showLatestNovels }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
let url = exports.site + "novel" + '/page/' + pageNo + sortOrder;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
const body = yield (0, fetch_1.fetchApi)(novelUrl).then(res => res.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
novel.name = loadedCheerio('.post-title h1').text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
const detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\t\n]/g, ',');
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
novel.summary = loadedCheerio('div.summary__content').text().trim();
|
||||
let html;
|
||||
if (false) {
|
||||
const novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
const body = {
|
||||
action: "manga_get_chapters",
|
||||
manga: novelId,
|
||||
};
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
.then(res => res.text());
|
||||
}
|
||||
else {
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(res => res.text());
|
||||
}
|
||||
if (html !== '0') {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
const chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
let releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
releaseDate = (0, parseMadaraDate_1.parseMadaraDate)(releaseDate);
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
}
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = (chapterUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url);
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,164 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
// import dayjs from 'dayjs';
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
// import { parseMadaraDate } from "@libs/parseMadaraDate";
|
||||
// import { isUrlAbsolute } from '@libs/isAbsoluteUrl';
|
||||
// import { showToast } from "@libs/showToast";
|
||||
// import { Filter, FilterInputs } from "@libs/filterInputs";
|
||||
// import { NovelStatus } from '@libs/novelStatus';
|
||||
// import { defaultCover } from "@libs/defaultCover";
|
||||
exports.id = "Readwn.com";
|
||||
exports.name = "Readwn.com";
|
||||
exports.icon = "multisrc/readwn/icon/readwn.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://www.readwn.com/";
|
||||
// export const filters: Filter[] = [];
|
||||
exports["protected"] = false;
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = function (page, { filters, showLatestNovels }) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const pageNo = page - 1;
|
||||
const url = baseUrl + 'list/all/all-onclick-' + pageNo + '.html';
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('li.novel-item').each(function () {
|
||||
const novelName = loadedCheerio(this).find('h4').text();
|
||||
const novelUrl = baseUrl + loadedCheerio(this).find('a').attr('href');
|
||||
const coverUri = loadedCheerio(this)
|
||||
.find('.novel-cover > img')
|
||||
.attr('data-src');
|
||||
const novelCover = baseUrl + coverUri;
|
||||
const novel = { name: novelName, cover: novelCover, url: novelUrl };
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)(novelUrl);
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
chapters: [],
|
||||
};
|
||||
novel.name = loadedCheerio('h1.novel-title').text();
|
||||
const coverUri = loadedCheerio('figure.cover > img').attr('data-src');
|
||||
novel.cover = baseUrl + coverUri;
|
||||
novel.summary = loadedCheerio('.summary')
|
||||
.text()
|
||||
.replace('Summary', '')
|
||||
.trim();
|
||||
novel.genres = '';
|
||||
loadedCheerio('div.categories > ul > li').each(function () {
|
||||
novel.genres += loadedCheerio(this).text().trim() + ',';
|
||||
});
|
||||
loadedCheerio('div.header-stats > span').each(function () {
|
||||
if (loadedCheerio(this).find('small').text() === 'Status') {
|
||||
novel.status = loadedCheerio(this).find('strong').text();
|
||||
}
|
||||
});
|
||||
novel.genres = novel.genres.slice(0, -1);
|
||||
novel.author = loadedCheerio('span[itemprop=author]').text();
|
||||
let novelChapters = [];
|
||||
const novelId = novelUrl.replace('.html', '').replace(baseUrl, '');
|
||||
const latestChapterNo = parseInt(loadedCheerio('.header-stats')
|
||||
.find('span > strong')
|
||||
.first()
|
||||
.text()
|
||||
.trim());
|
||||
let lastChapterNo = 1;
|
||||
loadedCheerio('.chapter-list li').each(function () {
|
||||
var _a;
|
||||
const chapterName = loadedCheerio(this)
|
||||
.find('a .chapter-title')
|
||||
.text()
|
||||
.trim();
|
||||
const chapterUrl = baseUrl + ((_a = loadedCheerio(this).find('a').attr('href')) === null || _a === void 0 ? void 0 : _a.trim());
|
||||
const releaseDate = loadedCheerio(this)
|
||||
.find('a .chapter-update')
|
||||
.text()
|
||||
.trim();
|
||||
lastChapterNo = parseInt(loadedCheerio(this).find('a .chapter-no').text().trim());
|
||||
const chapter = { name: chapterName, releaseTime: releaseDate, url: chapterUrl };
|
||||
novelChapters.push(chapter);
|
||||
});
|
||||
// Itterate once more before loop to finish off
|
||||
lastChapterNo++;
|
||||
for (let i = lastChapterNo; i <= latestChapterNo; i++) {
|
||||
const chapterName = 'Chapter ' + i;
|
||||
const chapterUrl = baseUrl + novelId + '_' + i + '.html';
|
||||
const releaseDate = null;
|
||||
const chapter = { name: chapterName, releaseTime: releaseDate, url: chapterUrl };
|
||||
novelChapters.push(chapter);
|
||||
}
|
||||
novel.chapters = novelChapters;
|
||||
return novel;
|
||||
});
|
||||
};
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = function (chapterUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)(chapterUrl);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.chapter-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const searchUrl = baseUrl + 'e/search/index.php';
|
||||
const result = yield (0, fetch_1.fetchApi)(searchUrl, {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
Referer: baseUrl + 'search.html',
|
||||
Origin: baseUrl,
|
||||
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36',
|
||||
},
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
show: 'title',
|
||||
tempid: 1,
|
||||
tbname: 'news',
|
||||
keyboard: searchTerm,
|
||||
}),
|
||||
});
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('li.novel-item').each(function () {
|
||||
const novelName = loadedCheerio(this).find('h4').text();
|
||||
const novelUrl = baseUrl + loadedCheerio(this).find('a').attr('href');
|
||||
const coverUri = baseUrl + loadedCheerio(this).find('img').attr('data-src');
|
||||
const novelCover = baseUrl + coverUri;
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url, {});
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
exports.id = "sleeptTLS";
|
||||
exports.name = "SleepyTranslations [madara]";
|
||||
exports.icon = "multisrc/madara/icons/sleepytranslations.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://sleepytranslations.com/";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = (pageNo, { showLatestNovels }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
let url = exports.site + "series" + '/page/' + pageNo + sortOrder;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
const body = yield (0, fetch_1.fetchApi)(novelUrl).then(res => res.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
novel.name = loadedCheerio('.post-title h1').text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
const detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\t\n]/g, ',');
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
novel.summary = loadedCheerio('div.summary__content').text().trim();
|
||||
let html;
|
||||
if (true) {
|
||||
const novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
const body = {
|
||||
action: "manga_get_chapters",
|
||||
manga: novelId,
|
||||
};
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
.then(res => res.text());
|
||||
}
|
||||
else {
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(res => res.text());
|
||||
}
|
||||
if (html !== '0') {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
const chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
let releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
releaseDate = (0, parseMadaraDate_1.parseMadaraDate)(releaseDate);
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
}
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = (chapterUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = baseUrl + "/" + "series" + "/" + chapterUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url);
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
exports.id = "sonicmtl";
|
||||
exports.name = "SonicMTL [madara]";
|
||||
exports.icon = "multisrc/madara/icons/sonicmtl.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://www.sonicmtl.com/";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = (pageNo, { showLatestNovels }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
let url = exports.site + "novel" + '/page/' + pageNo + sortOrder;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
const body = yield (0, fetch_1.fetchApi)(novelUrl).then(res => res.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
novel.name = loadedCheerio('.post-title h1').text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
const detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\t\n]/g, ',');
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
novel.summary = loadedCheerio('div.summary__content').text().trim();
|
||||
let html;
|
||||
if (true) {
|
||||
const novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
const body = {
|
||||
action: "manga_get_chapters",
|
||||
manga: novelId,
|
||||
};
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
.then(res => res.text());
|
||||
}
|
||||
else {
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(res => res.text());
|
||||
}
|
||||
if (html !== '0') {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
const chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
let releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
releaseDate = (0, parseMadaraDate_1.parseMadaraDate)(releaseDate);
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
}
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = (chapterUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url);
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
exports.id = "sugarbbscan";
|
||||
exports.name = "Sugar Babies [madara]";
|
||||
exports.icon = "multisrc/madara/icons/sugarbabies.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://sugarbbscan.com/";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = (pageNo, { showLatestNovels }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
let url = exports.site + "series" + '/page/' + pageNo + sortOrder;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
const body = yield (0, fetch_1.fetchApi)(novelUrl).then(res => res.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
novel.name = loadedCheerio('.post-title h1').text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
const detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\t\n]/g, ',');
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
novel.summary = loadedCheerio('div.summary__content').text().trim();
|
||||
let html;
|
||||
if (false) {
|
||||
const novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
const body = {
|
||||
action: "manga_get_chapters",
|
||||
manga: novelId,
|
||||
};
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
.then(res => res.text());
|
||||
}
|
||||
else {
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(res => res.text());
|
||||
}
|
||||
if (html !== '0') {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
const chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
let releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
releaseDate = (0, parseMadaraDate_1.parseMadaraDate)(releaseDate);
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
}
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = (chapterUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = baseUrl + "/" + "series" + "/" + chapterUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url);
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
exports.id = "sweetEscapeTL";
|
||||
exports.name = "Sweet Escape Translations [madara]";
|
||||
exports.icon = "multisrc/madara/icons/sweetescapetranslations.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://sweetescapetranslations.com/";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = (pageNo, { showLatestNovels }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
let url = exports.site + "manga" + '/page/' + pageNo + sortOrder;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
const body = yield (0, fetch_1.fetchApi)(novelUrl).then(res => res.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
novel.name = loadedCheerio('.post-title h1').text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
const detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\t\n]/g, ',');
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
novel.summary = loadedCheerio('div.summary__content').text().trim();
|
||||
let html;
|
||||
if (false) {
|
||||
const novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
const body = {
|
||||
action: "manga_get_chapters",
|
||||
manga: novelId,
|
||||
};
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
.then(res => res.text());
|
||||
}
|
||||
else {
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(res => res.text());
|
||||
}
|
||||
if (html !== '0') {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
const chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
let releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
releaseDate = (0, parseMadaraDate_1.parseMadaraDate)(releaseDate);
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
}
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = (chapterUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = baseUrl + "/" + "manga" + "/" + chapterUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url);
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
exports.id = "webnovelover";
|
||||
exports.name = "WebNovelLover [madara]";
|
||||
exports.icon = "multisrc/madara/icons/webnovellover.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://www.webnovelover.com/";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = (pageNo, { showLatestNovels }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
let url = exports.site + "novel" + '/page/' + pageNo + sortOrder;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
const body = yield (0, fetch_1.fetchApi)(novelUrl).then(res => res.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
novel.name = loadedCheerio('.post-title h1').text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
const detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\t\n]/g, ',');
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
novel.summary = loadedCheerio('div.summary__content').text().trim();
|
||||
let html;
|
||||
if (false) {
|
||||
const novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
const body = {
|
||||
action: "manga_get_chapters",
|
||||
manga: novelId,
|
||||
};
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
.then(res => res.text());
|
||||
}
|
||||
else {
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(res => res.text());
|
||||
}
|
||||
if (html !== '0') {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
const chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
let releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
releaseDate = (0, parseMadaraDate_1.parseMadaraDate)(releaseDate);
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
}
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = (chapterUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url);
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
exports.id = "wuxiaworld.site";
|
||||
exports.name = "WuxiaWorld.Site [madara]";
|
||||
exports.icon = "multisrc/madara/icons/wuxiaworld.site.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://wuxiaworld.site/";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = (pageNo, { showLatestNovels }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
let url = exports.site + "novel" + '/page/' + pageNo + sortOrder;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
const body = yield (0, fetch_1.fetchApi)(novelUrl).then(res => res.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
novel.name = loadedCheerio('.post-title h1').text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
const detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\t\n]/g, ',');
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
novel.summary = loadedCheerio('div.summary__content').text().trim();
|
||||
let html;
|
||||
if (true) {
|
||||
const novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
const body = {
|
||||
action: "manga_get_chapters",
|
||||
manga: novelId,
|
||||
};
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
.then(res => res.text());
|
||||
}
|
||||
else {
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(res => res.text());
|
||||
}
|
||||
if (html !== '0') {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
const chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
let releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
releaseDate = (0, parseMadaraDate_1.parseMadaraDate)(releaseDate);
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
}
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = (chapterUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url);
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
exports.id = "zetroTL";
|
||||
exports.name = "Zetro Translation [madara]";
|
||||
exports.icon = "multisrc/madara/icons/zetrotranslation.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://zetrotranslation.com/";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = (pageNo, { showLatestNovels }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
let url = exports.site + "novel" + '/page/' + pageNo + sortOrder;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
const body = yield (0, fetch_1.fetchApi)(novelUrl).then(res => res.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
novel.name = loadedCheerio('.post-title h1').text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
const detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\t\n]/g, ',');
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
novel.summary = loadedCheerio('div.summary__content').text().trim();
|
||||
let html;
|
||||
if (false) {
|
||||
const novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
const body = {
|
||||
action: "manga_get_chapters",
|
||||
manga: novelId,
|
||||
};
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
.then(res => res.text());
|
||||
}
|
||||
else {
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(res => res.text());
|
||||
}
|
||||
if (html !== '0') {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
const chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
let releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
releaseDate = (0, parseMadaraDate_1.parseMadaraDate)(releaseDate);
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
}
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = (chapterUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url);
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
exports.id = "zinnovel";
|
||||
exports.name = "ZinnNovel [madara]";
|
||||
exports.icon = "multisrc/madara/icons/zinnnovel.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://zinnovel.com/";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = (pageNo, { showLatestNovels }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const sortOrder = showLatestNovels
|
||||
? '?m_orderby=latest'
|
||||
: '/?m_orderby=rating';
|
||||
let url = exports.site + "manga" + '/page/' + pageNo + sortOrder;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
const body = yield (0, fetch_1.fetchApi)(novelUrl).then(res => res.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
novel.name = loadedCheerio('.post-title h1').text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
const detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\t\n]/g, ',');
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
novel.summary = loadedCheerio('div.summary__content').text().trim();
|
||||
let html;
|
||||
if (false) {
|
||||
const novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
const body = {
|
||||
action: "manga_get_chapters",
|
||||
manga: novelId,
|
||||
};
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
.then(res => res.text());
|
||||
}
|
||||
else {
|
||||
html = yield (0, fetch_1.fetchApi)(baseUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(res => res.text());
|
||||
}
|
||||
if (html !== '0') {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
const chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
const chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
let releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
releaseDate = (0, parseMadaraDate_1.parseMadaraDate)(releaseDate);
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
}
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = (chapterUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = baseUrl + "/" + "manga" + "/" + chapterUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html();
|
||||
return chapterText;
|
||||
});
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then(res => res.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url);
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,178 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.icon = exports.version = exports.site = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
exports.id = "ANF.com";
|
||||
exports.name = "AllNovelFull";
|
||||
exports.site = "https://allnovelfull.com";
|
||||
exports.version = "1.0.0";
|
||||
exports.icon = "src/en/allnovelfull/icon.png";
|
||||
const popularNovels = function (page) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = `${exports.site}/most-popular?page=${page}`;
|
||||
const result = yield (0, fetch_1.fetchApi)(url, {});
|
||||
if (!result.ok) {
|
||||
console.error("Cloudflare error");
|
||||
// console.error(await result.text());
|
||||
// TODO: Cloudflare protection or other error
|
||||
return [];
|
||||
}
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const novels = [];
|
||||
loadedCheerio(".col-truyen-main .list-truyen .row").each(function () {
|
||||
const novelName = loadedCheerio(this)
|
||||
.find("h3.truyen-title > a")
|
||||
.text();
|
||||
const novelCover = exports.site + loadedCheerio(this).find("img.cover").attr("src");
|
||||
const novelUrl = exports.site + loadedCheerio(this).find("h3.truyen-title > a").attr("href");
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = novelUrl;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
if (!result.ok) {
|
||||
console.error("Cloudflare error");
|
||||
// console.error(await result.text());
|
||||
// TODO: Cloudflare protection or other error
|
||||
return { url, chapters: [] };
|
||||
}
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
novel.name = loadedCheerio("div.book > img").attr("alt");
|
||||
novel.cover = exports.site + loadedCheerio("div.book > img").attr("src");
|
||||
novel.summary = loadedCheerio("div.desc-text").text().trim();
|
||||
novel.author = loadedCheerio("div.info > div > h3")
|
||||
.filter(function () {
|
||||
return loadedCheerio(this).text().trim() === "Author:";
|
||||
})
|
||||
.siblings()
|
||||
.text();
|
||||
novel.genres = loadedCheerio("div.info > div")
|
||||
.filter(function () {
|
||||
return (loadedCheerio(this).find("h3").text().trim() === "Genre:");
|
||||
})
|
||||
.text()
|
||||
.replace("Genre:", "");
|
||||
novel.status = loadedCheerio("div.info > div > h3")
|
||||
.filter(function () {
|
||||
return loadedCheerio(this).text().trim() === "Status:";
|
||||
})
|
||||
.next()
|
||||
.text();
|
||||
const novelId = loadedCheerio("#rating").attr("data-novel-id");
|
||||
function getChapters(id) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const chapterListUrl = exports.site + "/ajax/chapter-option?novelId=" + id;
|
||||
const data = yield (0, fetch_1.fetchApi)(chapterListUrl);
|
||||
if (!data.ok) {
|
||||
console.error("Cloudflare error");
|
||||
// console.error(await result.text());
|
||||
// TODO: Cloudflare protection or other error
|
||||
return [];
|
||||
}
|
||||
const chapters = yield data.text();
|
||||
loadedCheerio = (0, cheerio_1.load)(chapters);
|
||||
const novelChapters = [];
|
||||
loadedCheerio("select > option").each(function () {
|
||||
var _a;
|
||||
let chapterName = loadedCheerio(this).text();
|
||||
let releaseDate = null;
|
||||
let chapterUrl = (_a = loadedCheerio(this)
|
||||
.attr("value")) === null || _a === void 0 ? void 0 : _a.replace(`/${novelUrl}`, "");
|
||||
if (chapterUrl) {
|
||||
novelChapters.push({
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
});
|
||||
}
|
||||
});
|
||||
return novelChapters;
|
||||
});
|
||||
}
|
||||
if (novelId) {
|
||||
novel.chapters = yield getChapters(novelId);
|
||||
}
|
||||
return novel;
|
||||
});
|
||||
};
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = function (chapterUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = exports.site + chapterUrl;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
if (!result.ok) {
|
||||
console.error("Cloudflare error");
|
||||
// console.error(await result.text());
|
||||
// TODO: Cloudflare protection or other error
|
||||
return "Cloudflare protected site!";
|
||||
}
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio("#chapter-content").html() || "";
|
||||
return chapterText;
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = function (searchTerm) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = `${exports.site}/search?keyword=${searchTerm}`;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
if (!result.ok) {
|
||||
console.error(yield result.text());
|
||||
// TODO: Cloudflare protection or other error
|
||||
return [];
|
||||
}
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio("div.col-truyen-main > div.list-truyen > .row").each(function () {
|
||||
const novelUrl = exports.site +
|
||||
loadedCheerio(this).find("h3.truyen-title > a").attr("href");
|
||||
const novelName = loadedCheerio(this)
|
||||
.find("h3.truyen-title > a")
|
||||
.text();
|
||||
const novelCover = exports.site + loadedCheerio(this).find("img").attr("src");
|
||||
if (novelUrl) {
|
||||
novels.push({
|
||||
url: novelUrl,
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
});
|
||||
}
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = function (url, init) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url, init);
|
||||
});
|
||||
};
|
||||
exports.fetchImage = fetchImage;
|
||||
exports.protected = false;
|
||||
@@ -0,0 +1,150 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.icon = exports.version = exports.site = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
exports.id = "BLN.com";
|
||||
exports.name = "BestLightNovel";
|
||||
exports.site = "https://bestlightnovel.com/";
|
||||
exports.version = "1.0.0";
|
||||
exports.icon = "src/en/bestlightnovel/icon.png";
|
||||
const popularNovels = function (page) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = exports.site + "novel_list?type=topview&category=all&state=all&page=1" + page;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
if (!result.ok) {
|
||||
console.error(yield result.text());
|
||||
// TODO: Cloudflare protection or other error
|
||||
return [];
|
||||
}
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
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;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
var _a, _b, _c;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = novelUrl;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
if (!result.ok) {
|
||||
console.error(yield result.text());
|
||||
// TODO: Cloudflare protection
|
||||
return { url, chapters: [] };
|
||||
}
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novel = {
|
||||
url,
|
||||
name: "",
|
||||
cover: "",
|
||||
author: "",
|
||||
status: novelStatus_1.NovelStatus.Unknown,
|
||||
genres: "",
|
||||
summary: "",
|
||||
chapters: [],
|
||||
};
|
||||
novel.name = loadedCheerio(".truyen_info_right h1").text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio(".info_image img").attr("src") || defaultCover_1.defaultCover;
|
||||
novel.summary = (_a = loadedCheerio("#noidungm").text()) === null || _a === void 0 ? void 0 : _a.trim();
|
||||
novel.author = (_b = 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()) === null || _b === void 0 ? void 0 : _b.trim();
|
||||
let status = (_c = 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()) === null || _c === void 0 ? void 0 : _c.trim();
|
||||
novel.status =
|
||||
status === "ONGOING"
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: status === "COMPLETED"
|
||||
? novelStatus_1.NovelStatus.Completed
|
||||
: novelStatus_1.NovelStatus.Unknown;
|
||||
let novelChapters = [];
|
||||
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;
|
||||
});
|
||||
};
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = function (chapterUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = chapterUrl;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio("#vung_doc").html();
|
||||
return chapterText;
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = function (searchTerm) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = `${exports.site}search_novels/${searchTerm}`;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
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;
|
||||
});
|
||||
};
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (...args) => (0, fetch_1.fetchFile)(...args);
|
||||
exports.fetchImage = fetchImage;
|
||||
exports.protected = false;
|
||||
@@ -0,0 +1,147 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.icon = exports.version = exports.site = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
exports.id = "comrademao";
|
||||
exports.name = "Comrade Mao";
|
||||
exports.site = "https://comrademao.com/";
|
||||
exports.version = "1.0.0";
|
||||
exports.icon = "src/en/comrademao/icon.png";
|
||||
const popularNovels = function (page) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let url = exports.site + "page/" + page + "/?post_type=novel";
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio(".listupd")
|
||||
.find("div.bs")
|
||||
.each(function () {
|
||||
const novelName = loadedCheerio(this).find(".tt").text().trim();
|
||||
const novelCover = loadedCheerio(this).find("img").attr("src");
|
||||
const novelUrl = loadedCheerio(this).find("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;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = novelUrl;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novel = { url };
|
||||
novel.name = loadedCheerio(".entry-title").text().trim();
|
||||
novel.cover = loadedCheerio("div.thumbook > div > img").attr("src");
|
||||
novel.summary = loadedCheerio("div.infox > div:nth-child(6) > span > p")
|
||||
.text()
|
||||
.trim();
|
||||
novel.genres = loadedCheerio("div.infox > div:nth-child(4) > span")
|
||||
.text()
|
||||
.replace(/\s/g, "");
|
||||
novel.status = loadedCheerio("div.infox > div:nth-child(3) > span")
|
||||
.text()
|
||||
.trim();
|
||||
novel.author = loadedCheerio("div.infox > div:nth-child(2) > span")
|
||||
.text()
|
||||
.trim();
|
||||
let novelChapters = [];
|
||||
loadedCheerio("#chapterlist")
|
||||
.find("li")
|
||||
.each(function () {
|
||||
const releaseDate = (0, dayjs_1.default)(loadedCheerio(this).find(".chapterdate").text()).format("LL");
|
||||
const chapterName = loadedCheerio(this)
|
||||
.find(".chapternum")
|
||||
.text();
|
||||
const chapterUrl = loadedCheerio(this).find("a").attr("href");
|
||||
if (!chapterUrl) {
|
||||
// TODO: Handle error
|
||||
console.error("No chapter url!");
|
||||
return;
|
||||
}
|
||||
novelChapters.push({
|
||||
name: chapterName,
|
||||
url: chapterUrl,
|
||||
releaseTime: releaseDate,
|
||||
});
|
||||
});
|
||||
novel.chapters = novelChapters.reverse();
|
||||
return novel;
|
||||
});
|
||||
};
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = function (chapterUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = chapterUrl;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
if (!result.ok) {
|
||||
const err = yield result.text();
|
||||
console.error(err);
|
||||
// TODO: Cloudflare protection or other error
|
||||
return "Error!" + err;
|
||||
}
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let chapterText = loadedCheerio("#chaptercontent").html();
|
||||
return chapterText;
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = function (searchTerm) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = exports.site + "?s=" + searchTerm + "&post_type=novel";
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio(".listupd")
|
||||
.find("div.bs")
|
||||
.each(function () {
|
||||
const novelName = loadedCheerio(this).find(".tt").text().trim();
|
||||
const novelCover = loadedCheerio(this).find("img").attr("src");
|
||||
const novelUrl = loadedCheerio(this).find("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;
|
||||
});
|
||||
};
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (...args) => (0, fetch_1.fetchFile)(...args);
|
||||
exports.fetchImage = fetchImage;
|
||||
exports.protected = false;
|
||||
@@ -0,0 +1,134 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.icon = exports.version = exports.site = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
exports.id = "DDL.com";
|
||||
exports.name = "Divine Dao Library";
|
||||
exports.site = "https://www.divinedaolibrary.com/";
|
||||
exports.version = "1.0.0";
|
||||
exports.icon = "src/`en/divinedaolibrary/icon.png";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = function (page) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let url = baseUrl + "novels";
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio("#main")
|
||||
.find("li")
|
||||
.each(function () {
|
||||
const novelName = loadedCheerio(this).find("a").text();
|
||||
const novelCover = defaultCover_1.defaultCover;
|
||||
const novelUrl = loadedCheerio(this).find(" a").attr("href");
|
||||
if (!novelUrl)
|
||||
return;
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = novelUrl;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novel = { url };
|
||||
novel.name = loadedCheerio("h1.entry-title").text().trim();
|
||||
novel.cover =
|
||||
loadedCheerio(".entry-content").find("img").attr("data-ezsrc") ||
|
||||
defaultCover_1.defaultCover;
|
||||
novel.summary = loadedCheerio("#main > article > div > p:nth-child(6)")
|
||||
.text()
|
||||
.trim();
|
||||
novel.author = loadedCheerio("#main > article > div > h3:nth-child(2)")
|
||||
.text()
|
||||
.replace(/Author:/g, "")
|
||||
.trim();
|
||||
let novelChapters = [];
|
||||
loadedCheerio("#main")
|
||||
.find("li > span > a")
|
||||
.each(function () {
|
||||
const chapterName = loadedCheerio(this).text().trim();
|
||||
const releaseDate = null;
|
||||
const chapterUrl = loadedCheerio(this).attr("href");
|
||||
if (!chapterUrl)
|
||||
return;
|
||||
novelChapters.push({
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
});
|
||||
});
|
||||
novel.chapters = novelChapters;
|
||||
return novel;
|
||||
});
|
||||
};
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = function (chapterUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = chapterUrl;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let chapterName = loadedCheerio(".entry-title").text().trim();
|
||||
let chapterText = loadedCheerio(".entry-content").html();
|
||||
if (!chapterText) {
|
||||
chapterText = loadedCheerio(".page-header").html();
|
||||
}
|
||||
chapterText = `<p><h1>${chapterName}</h1></p>` + chapterText;
|
||||
return chapterText;
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = function (searchTerm) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let url = baseUrl + "novels";
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio("#main")
|
||||
.find("li")
|
||||
.each(function () {
|
||||
const novelName = loadedCheerio(this).find("a").text();
|
||||
const novelCover = defaultCover_1.defaultCover;
|
||||
const novelUrl = loadedCheerio(this).find(" a").attr("href");
|
||||
if (!novelUrl)
|
||||
return;
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
novels = novels.filter((novel) => novel.name.toLowerCase().includes(searchTerm.toLowerCase()));
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = function (url, init) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url, init);
|
||||
});
|
||||
};
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,175 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.icon = exports.version = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const showToast_1 = require("@libs/showToast");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
exports.id = "earlynovel";
|
||||
exports.name = "Early Novel";
|
||||
exports.version = "1.0.0";
|
||||
exports.icon = "multisrc/madara/icons/latestnovel.png";
|
||||
exports.site = "https://earlynovel.net/";
|
||||
module.exports.protected = false;
|
||||
const pluginId = exports.id;
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = function (page) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = `${baseUrl}most-popular?page=${page}`;
|
||||
const body = yield (0, fetch_1.fetchApi)(url, {}, pluginId).then((r) => r.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio(".col-truyen-main > .list-truyen > .row").each(function () {
|
||||
var _a;
|
||||
const novelName = loadedCheerio(this)
|
||||
.find("h3.truyen-title > a")
|
||||
.attr("title");
|
||||
const novelCover = loadedCheerio(this).find(".lazyimg").attr("data-desk-image") ||
|
||||
loadedCheerio(this).find("img.cover").attr("src");
|
||||
const novelUrl = baseUrl +
|
||||
((_a = loadedCheerio(this)
|
||||
.find("h3.truyen-title > a")
|
||||
.attr("href")) === null || _a === void 0 ? void 0 : _a.slice(1));
|
||||
if (!novelUrl || !novelName)
|
||||
return;
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover || defaultCover_1.defaultCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
var _a;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
(0, showToast_1.showToast)("Early Novel may take 20-30 seconds");
|
||||
const url = novelUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(url, {}, pluginId).then((r) => r.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const name = loadedCheerio(".book > img").attr("alt");
|
||||
const cover = loadedCheerio(".book > img").attr("src") || defaultCover_1.defaultCover;
|
||||
const summary = loadedCheerio(".desc-text").text().trim();
|
||||
const novel = {
|
||||
url,
|
||||
chapters: [],
|
||||
name,
|
||||
summary,
|
||||
cover,
|
||||
};
|
||||
loadedCheerio(".info > div > h3").each(function () {
|
||||
let detailName = loadedCheerio(this).text();
|
||||
let detail = loadedCheerio(this)
|
||||
.siblings()
|
||||
.map((i, el) => loadedCheerio(el).text())
|
||||
.toArray()
|
||||
.join(",");
|
||||
switch (detailName) {
|
||||
case "Author:":
|
||||
novel.author = detail;
|
||||
break;
|
||||
case "Status:":
|
||||
novel.status = detail;
|
||||
break;
|
||||
case "Genre:":
|
||||
novel.genres = detail;
|
||||
break;
|
||||
}
|
||||
});
|
||||
//! Doesn't work since there are multiple pages and can't find source API
|
||||
//# Since cannot find sourceAPI i try similar function to lightnovelpub
|
||||
const delay = (ms) => new Promise((res) => setTimeout(res, ms));
|
||||
const lastPageStr = (_a = loadedCheerio('a:contains("Last ")')
|
||||
.attr("title")) === null || _a === void 0 ? void 0 : _a.match(/(\d+)/g);
|
||||
const lastPage = Number((lastPageStr === null || lastPageStr === void 0 ? void 0 : lastPageStr[1]) || "0");
|
||||
function getChapters() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let chapter = [];
|
||||
for (let i = 1; i <= lastPage; i++) {
|
||||
const chaptersUrl = `${novelUrl}?page=${i}`;
|
||||
const chaptersHtml = yield (0, fetch_1.fetchApi)(chaptersUrl, {}, pluginId).then((r) => r.text());
|
||||
loadedCheerio = (0, cheerio_1.load)(chaptersHtml);
|
||||
loadedCheerio("ul.list-chapter > li").each(function () {
|
||||
var _a;
|
||||
const chapterName = loadedCheerio(this)
|
||||
.find(".chapter-text")
|
||||
.text()
|
||||
.trim();
|
||||
const releaseDate = null;
|
||||
const chapterHref = (_a = loadedCheerio(this)
|
||||
.find("a")
|
||||
.attr("href")) === null || _a === void 0 ? void 0 : _a.slice(1);
|
||||
if (!chapterHref)
|
||||
return;
|
||||
const chapterUrl = baseUrl + chapterHref;
|
||||
chapter.push({
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
});
|
||||
});
|
||||
yield delay(1000);
|
||||
}
|
||||
return chapter;
|
||||
});
|
||||
}
|
||||
novel.chapters = yield getChapters();
|
||||
return novel;
|
||||
});
|
||||
};
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = function (chapterUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl, {}, pluginId).then((r) => r.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio("#chapter-c").html() || "";
|
||||
return chapterText;
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = function (searchTerm) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = `${baseUrl}search?keyword=${searchTerm}`;
|
||||
const body = yield (0, fetch_1.fetchApi)(url, {}, pluginId).then((r) => r.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio("div.col-truyen-main > div.list-truyen > .row").each(function () {
|
||||
const novelUrl = baseUrl +
|
||||
loadedCheerio(this).find("h3.truyen-title > a").attr("href");
|
||||
const novelName = loadedCheerio(this)
|
||||
.find("h3.truyen-title > a")
|
||||
.text();
|
||||
const novelCover = baseUrl + loadedCheerio(this).find("img").attr("src");
|
||||
if (novelUrl) {
|
||||
novels.push({
|
||||
url: novelUrl,
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
});
|
||||
}
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = function fetchImage(url) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const headers = {
|
||||
Referer: baseUrl,
|
||||
};
|
||||
return yield (0, fetch_1.fetchFile)(url, { headers: headers });
|
||||
});
|
||||
};
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,153 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.icon = exports.version = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
exports.id = "fastnovel";
|
||||
exports.name = "Fast Novel";
|
||||
exports.version = "1.0.0";
|
||||
exports.icon = "src/en/fastnovel/icon.png";
|
||||
exports.site = "https://fastnovel.org/";
|
||||
exports.protected = false;
|
||||
const pluginId = exports.id;
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = function (page) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = `${baseUrl}sort/p/?page=${page}`;
|
||||
const body = yield (0, fetch_1.fetchApi)(url, {}, pluginId).then((r) => r.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio(".col-novel-main .list-novel .row").each(function () {
|
||||
const novelName = loadedCheerio(this).find("h3.novel-title > a").text();
|
||||
const novelCover = loadedCheerio(this).find("img.cover").attr("src");
|
||||
const novelUrl = loadedCheerio(this)
|
||||
.find("h3.novel-title > a")
|
||||
.attr("href");
|
||||
if (!novelUrl)
|
||||
return;
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = novelUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(url, {}, pluginId).then((r) => r.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const novel = {
|
||||
url,
|
||||
chapters: [],
|
||||
};
|
||||
novel.name = loadedCheerio("div.book > img").attr("alt");
|
||||
novel.cover = loadedCheerio("div.book > img").attr("src");
|
||||
novel.summary = loadedCheerio("div.desc-text").text().trim();
|
||||
loadedCheerio("ul.info > li > h3").each(function () {
|
||||
let detailName = loadedCheerio(this).text();
|
||||
let detail = loadedCheerio(this)
|
||||
.siblings()
|
||||
.map((i, el) => loadedCheerio(el).text())
|
||||
.toArray()
|
||||
.join(",");
|
||||
switch (detailName) {
|
||||
case "Author:":
|
||||
novel.author = detail;
|
||||
break;
|
||||
case "Status:":
|
||||
novel.status = detail;
|
||||
break;
|
||||
case "Genre:":
|
||||
novel.genres = detail;
|
||||
break;
|
||||
}
|
||||
});
|
||||
const novelId = loadedCheerio("#rating").attr("data-novel-id");
|
||||
function getChapters(id) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const chapterListUrl = baseUrl + "ajax/chapter-archive?novelId=" + id;
|
||||
const data = yield (0, fetch_1.fetchApi)(chapterListUrl);
|
||||
const chapterdata = yield data.text();
|
||||
loadedCheerio = (0, cheerio_1.load)(chapterdata);
|
||||
let chapter = [];
|
||||
loadedCheerio("ul.list-chapter > li").each(function () {
|
||||
const chapterName = loadedCheerio(this).find("a").attr("title");
|
||||
const releaseDate = null;
|
||||
const chapterUrl = loadedCheerio(this).find("a").attr("href");
|
||||
if (!chapterName || !chapterUrl)
|
||||
return;
|
||||
chapter.push({
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
});
|
||||
});
|
||||
return chapter;
|
||||
});
|
||||
}
|
||||
if (novelId) {
|
||||
novel.chapters = yield getChapters(novelId);
|
||||
}
|
||||
return novel;
|
||||
});
|
||||
};
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = function (chapterUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl, {}, pluginId).then((r) => r.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('#chr-content > div,h6,p[style="display: none;"]').remove();
|
||||
let chapterText = loadedCheerio("#chr-content").html();
|
||||
return chapterText;
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = function (searchTerm) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = `${baseUrl}search/?keyword=${searchTerm}`;
|
||||
const body = yield (0, fetch_1.fetchApi)(url, {}, pluginId).then((r) => r.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio("div.col-novel-main > div.list-novel > .row").each(function () {
|
||||
const novelUrl = loadedCheerio(this)
|
||||
.find("h3.novel-title > a")
|
||||
.attr("href");
|
||||
const novelName = loadedCheerio(this)
|
||||
.find("h3.novel-title > a")
|
||||
.text();
|
||||
const novelCover = loadedCheerio(this).find("img").attr("src");
|
||||
if (novelUrl) {
|
||||
novels.push({
|
||||
url: novelUrl,
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
});
|
||||
}
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = function (url) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const headers = {
|
||||
Referer: baseUrl,
|
||||
};
|
||||
return yield (0, fetch_1.fetchFile)(url, { headers: headers });
|
||||
});
|
||||
};
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,155 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.icon = exports.version = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
exports.id = "foxaholic";
|
||||
exports.name = "Foxaholic";
|
||||
exports.version = "1.0.0";
|
||||
exports.icon = "src/en/foxaholic/icon.png";
|
||||
exports.site = "https://www.foxaholic.com/";
|
||||
module.exports.protected = false;
|
||||
const pluginId = exports.id;
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = function (page) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const link = `${baseUrl}novel/page/${page}/?m_orderby=rating`;
|
||||
const result = yield (0, fetch_1.fetchApi)(link, {}, pluginId);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const novels = [];
|
||||
loadedCheerio(".page-item-detail").each(function () {
|
||||
const novelName = loadedCheerio(this).find(".h5 > a").text();
|
||||
const novelCover = loadedCheerio(this).find("img").attr("data-src");
|
||||
const novelUrl = loadedCheerio(this).find(".h5 > a").attr("href");
|
||||
if (!novelUrl)
|
||||
return;
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = novelUrl;
|
||||
const result = yield (0, fetch_1.fetchApi)(url, {}, pluginId);
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const novel = {
|
||||
url,
|
||||
chapters: [],
|
||||
};
|
||||
novel.name = loadedCheerio(".post-title > h1").text().trim();
|
||||
novel.cover = loadedCheerio(".summary_image > a > img").attr("data-src");
|
||||
loadedCheerio(".post-content_item").each(function () {
|
||||
const detailName = loadedCheerio(this)
|
||||
.find(".summary-heading > h5")
|
||||
.text()
|
||||
.trim();
|
||||
const detail = loadedCheerio(this).find(".summary-content").html();
|
||||
if (!detail)
|
||||
return;
|
||||
switch (detailName) {
|
||||
case "Genre":
|
||||
novel.genres = loadedCheerio(detail)
|
||||
.children("a")
|
||||
.map((i, el) => loadedCheerio(el).text())
|
||||
.toArray()
|
||||
.join(",");
|
||||
break;
|
||||
case "Author":
|
||||
novel.author = loadedCheerio(detail)
|
||||
.children("a")
|
||||
.map((i, el) => loadedCheerio(el).text())
|
||||
.toArray()
|
||||
.join(", ");
|
||||
break;
|
||||
case "Novel":
|
||||
novel.status = detail === null || detail === void 0 ? void 0 : detail.trim().replace(/G/g, "g");
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio(".description-summary > div.summary__content > div").remove();
|
||||
novel.summary = loadedCheerio(".description-summary > div.summary__content")
|
||||
.text()
|
||||
.trim();
|
||||
let chapter = [];
|
||||
loadedCheerio(".wp-manga-chapter").each(function () {
|
||||
const chapterName = loadedCheerio(this)
|
||||
.find("a")
|
||||
.text()
|
||||
.replace(/[\t\n]/g, "")
|
||||
.trim();
|
||||
const releaseDate = loadedCheerio(this).find("span").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;
|
||||
});
|
||||
};
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = function (chapterUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)(chapterUrl, {}, pluginId);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio("img").removeAttr("srcset");
|
||||
let chapterText = loadedCheerio(".reading-content").html();
|
||||
return chapterText;
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = function (searchTerm) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = `${baseUrl}?s=${searchTerm}&post_type=wp-manga`;
|
||||
const result = yield (0, fetch_1.fetchApi)(url, {}, pluginId);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const novels = [];
|
||||
loadedCheerio(".c-tabs-item__content").each(function () {
|
||||
const novelName = loadedCheerio(this).find(".h4 > a").text();
|
||||
const novelCover = loadedCheerio(this).find("img").attr("data-src");
|
||||
const novelUrl = loadedCheerio(this).find(".h4 > a").attr("href");
|
||||
if (!novelUrl)
|
||||
return;
|
||||
novels.push({
|
||||
name: novelName,
|
||||
url: novelUrl,
|
||||
cover: novelCover,
|
||||
});
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = function (url) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const headers = {
|
||||
Referer: baseUrl,
|
||||
};
|
||||
return yield (0, fetch_1.fetchFile)(url, { headers: headers });
|
||||
});
|
||||
};
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,119 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.icon = exports.version = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const showToast_1 = require("@libs/showToast");
|
||||
const isAbsoluteUrl_1 = require("@libs/isAbsoluteUrl");
|
||||
exports.id = "freenovelupdates";
|
||||
exports.name = "Free Novel Updates (Broken)";
|
||||
exports.version = "1.0.0";
|
||||
exports.icon = "src/en/freenovelupdates/icon.png";
|
||||
exports.site = "https://www.freenovelupdates.com";
|
||||
exports.protected = false;
|
||||
const pluginId = exports.id;
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = function (page) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = `${baseUrl}genres/light-novel-1002`;
|
||||
const body = yield (0, fetch_1.fetchApi)(url, {}, pluginId).then((r) => r.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio(".books-item").each(function () {
|
||||
let novelUrl = loadedCheerio(this).find("a").attr("href");
|
||||
if (novelUrl && !(0, isAbsoluteUrl_1.isUrlAbsolute)(novelUrl)) {
|
||||
novelUrl = baseUrl + novelUrl;
|
||||
}
|
||||
if (novelUrl) {
|
||||
const novelName = loadedCheerio(this).find(".title").text().trim();
|
||||
let novelCover = loadedCheerio(this).find("img").attr("src");
|
||||
if (novelCover && !(0, isAbsoluteUrl_1.isUrlAbsolute)(novelCover)) {
|
||||
novelCover = baseUrl + novelCover;
|
||||
}
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
}
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = novelUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(url, {}, pluginId).then((r) => r.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const novel = {
|
||||
url,
|
||||
chapters: [],
|
||||
};
|
||||
novel.name = loadedCheerio("h1").text();
|
||||
let novelCover = loadedCheerio(".img > img").attr("src");
|
||||
novel.cover = novelCover
|
||||
? (0, isAbsoluteUrl_1.isUrlAbsolute)(novelCover)
|
||||
? novelCover
|
||||
: baseUrl + novelCover
|
||||
: undefined;
|
||||
novel.summary = loadedCheerio(".description-content").text().trim();
|
||||
novel.author = loadedCheerio(".author").text().trim();
|
||||
novel.genres = loadedCheerio(".category").text().trim();
|
||||
novel.status = loadedCheerio(".status").text().trim();
|
||||
loadedCheerio(".chapter").each(function () {
|
||||
var _a;
|
||||
let chapterUrl = loadedCheerio(this).find("a").attr("href");
|
||||
if (chapterUrl && !(0, isAbsoluteUrl_1.isUrlAbsolute)(chapterUrl)) {
|
||||
chapterUrl = baseUrl + chapterUrl;
|
||||
}
|
||||
if (chapterUrl) {
|
||||
const chapterName = loadedCheerio(this).find("a").text().trim();
|
||||
const releaseDate = null;
|
||||
const chapter = {
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
};
|
||||
(_a = novel.chapters) === null || _a === void 0 ? void 0 : _a.push(chapter);
|
||||
}
|
||||
});
|
||||
return novel;
|
||||
});
|
||||
};
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = function (chapterUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl, {}, pluginId).then((r) => r.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio(".content").html() || "";
|
||||
return chapterText;
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = function (searchTerm) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
(0, showToast_1.showToast)("Search is not available in this source");
|
||||
return [];
|
||||
});
|
||||
};
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = function (url) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const headers = {
|
||||
Referer: baseUrl,
|
||||
};
|
||||
return yield (0, fetch_1.fetchFile)(url, { headers: headers });
|
||||
});
|
||||
};
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,141 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.icon = exports.version = exports.site = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
exports.id = "FWN.com";
|
||||
exports.name = "Web NOVEL";
|
||||
exports.site = "https://freewebnovel.com/";
|
||||
exports.version = "1.0.0";
|
||||
exports.icon = "src/en/freewebnovel/icon.png";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = function (page) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let url = baseUrl + "completed-novel/" + page;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio(".li-row").each(function () {
|
||||
const novelName = loadedCheerio(this).find(".tit").text();
|
||||
const novelCover = loadedCheerio(this).find("img").attr("src");
|
||||
let novelUrl = "https://freewebnovel.com" +
|
||||
loadedCheerio(this).find("h3 > a").attr("href");
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = novelUrl;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novel = {
|
||||
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, "");
|
||||
let novelSummary = loadedCheerio(".inner").text().trim();
|
||||
novel.summary = novelSummary;
|
||||
let novelChapters = [];
|
||||
let latestChapter;
|
||||
loadedCheerio("h3.tit").each(function (res) {
|
||||
var _a;
|
||||
if (loadedCheerio(this).find("a").text() === novel.name) {
|
||||
latestChapter = (_a = loadedCheerio(this)
|
||||
.next()
|
||||
.find("span.s3")
|
||||
.text()
|
||||
.match(/(\d+)/)) === null || _a === void 0 ? void 0 : _a[0];
|
||||
}
|
||||
});
|
||||
let prefixUrl = novelUrl.replace(".html", "/");
|
||||
for (let i = 1; i <= parseInt(latestChapter || "0", 10); i++) {
|
||||
const chapterName = "Chapter " + i;
|
||||
const releaseDate = null;
|
||||
let chapterUrl = "chapter-" + i;
|
||||
chapterUrl = `${prefixUrl}${chapterUrl}.html`;
|
||||
const chapter = {
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
};
|
||||
novelChapters.push(chapter);
|
||||
}
|
||||
novel.chapters = novelChapters;
|
||||
return novel;
|
||||
});
|
||||
};
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = function (chapterUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = chapterUrl;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let chapterText = loadedCheerio("div.txt").html();
|
||||
return chapterText;
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = function (searchTerm) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = baseUrl + "search/";
|
||||
const formData = {
|
||||
searchkey: searchTerm,
|
||||
};
|
||||
const result = yield (0, fetch_1.fetchApi)(url, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(formData),
|
||||
});
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio(".li-row > .li > .con").each(function () {
|
||||
const novelName = loadedCheerio(this).find(".tit").text();
|
||||
const novelCover = loadedCheerio(this)
|
||||
.find(".pic > a > img")
|
||||
.attr("data-cfsrc");
|
||||
let novelUrl = "https://freewebnovel.com" +
|
||||
loadedCheerio(this).find("h3 > a").attr("href");
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.searchNovels = searchNovels;
|
||||
exports.fetchImage = fetch_1.fetchFile;
|
||||
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.icon = exports.version = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
exports.id = "lightnovelpub";
|
||||
exports.name = "LightNovelPub";
|
||||
exports.version = "1.0.0";
|
||||
exports.icon = "src/en/lightnovelpub/icon.png";
|
||||
exports.site = "https://www.lightnovelpub.com/";
|
||||
exports.protected = true;
|
||||
const baseUrl = exports.site;
|
||||
const pluginId = exports.id;
|
||||
const headers = {
|
||||
Accept: "application/json",
|
||||
"Content-Type": "application/json",
|
||||
};
|
||||
const popularNovels = function (page) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = `${baseUrl}browse/all/popular/all/${page}`;
|
||||
const body = yield (0, fetch_1.fetchApi)(url, {}, pluginId).then((r) => r.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const novels = [];
|
||||
loadedCheerio(".novel-item.ads").remove();
|
||||
loadedCheerio(".novel-item").each(function () {
|
||||
var _a;
|
||||
const novelName = loadedCheerio(this)
|
||||
.find(".novel-title")
|
||||
.text()
|
||||
.trim();
|
||||
const novelCover = loadedCheerio(this).find("img").attr("data-src");
|
||||
const novelUrl = baseUrl +
|
||||
((_a = loadedCheerio(this)
|
||||
.find(".novel-title > a")
|
||||
.attr("href")) === null || _a === void 0 ? void 0 : _a.substring(1));
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
var _a;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = novelUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(url, {}, pluginId).then((r) => r.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const novel = {
|
||||
url,
|
||||
chapters: [],
|
||||
};
|
||||
novel.name = loadedCheerio("h1.novel-title").text().trim();
|
||||
novel.cover = loadedCheerio("figure.cover > img").attr("data-src");
|
||||
novel.genres = "";
|
||||
loadedCheerio(".categories > ul > li > a").each(function () {
|
||||
novel.genres += loadedCheerio(this).text() + ",";
|
||||
});
|
||||
novel.genres = novel.genres.slice(0, -1);
|
||||
loadedCheerio("div.header-stats > span").each(function () {
|
||||
if (loadedCheerio(this).find("small").text() === "Status") {
|
||||
novel.status = loadedCheerio(this).find("strong").text();
|
||||
}
|
||||
});
|
||||
novel.author = loadedCheerio(".author > a > span").text();
|
||||
novel.summary = loadedCheerio(".summary > .content").text().trim();
|
||||
const delay = (ms) => new Promise((res) => setTimeout(res, ms));
|
||||
let lastPage = 1;
|
||||
lastPage = parseInt((_a = loadedCheerio("#novel > header > div.header-body.container > div.novel-info > div.header-stats > span:nth-child(1) > strong")
|
||||
.text()) === null || _a === void 0 ? void 0 : _a.trim());
|
||||
lastPage = Math.ceil(lastPage / 100);
|
||||
function getChapters() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let chapter = [];
|
||||
for (let i = 1; i <= lastPage; i++) {
|
||||
const chaptersUrl = `${novelUrl}/chapters/page-${i}`;
|
||||
const chaptersHtml = yield (0, fetch_1.fetchApi)(chaptersUrl, { headers: headers }, pluginId).then((r) => r.text());
|
||||
loadedCheerio = (0, cheerio_1.load)(chaptersHtml);
|
||||
loadedCheerio(".chapter-list li").each(function () {
|
||||
var _a;
|
||||
const chapterName = loadedCheerio(this)
|
||||
.find(".chapter-title")
|
||||
.text()
|
||||
.trim();
|
||||
const releaseDate = loadedCheerio(this)
|
||||
.find(".chapter-update")
|
||||
.text()
|
||||
.trim();
|
||||
const chapterUrl = baseUrl +
|
||||
((_a = loadedCheerio(this)
|
||||
.find("a")
|
||||
.attr("href")) === null || _a === void 0 ? void 0 : _a.substring(1));
|
||||
chapter.push({
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
});
|
||||
});
|
||||
yield delay(1000);
|
||||
}
|
||||
return chapter;
|
||||
});
|
||||
}
|
||||
novel.chapters = yield getChapters();
|
||||
return novel;
|
||||
});
|
||||
};
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = function (chapterUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl, {}, pluginId).then((r) => r.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let chapterText = loadedCheerio("#chapter-container").html();
|
||||
return chapterText;
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = function (searchTerm) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = `${baseUrl}lnsearchlive`;
|
||||
const link = `${baseUrl}search`;
|
||||
const response = yield (0, fetch_1.fetchApi)(link, {}, pluginId).then((r) => r.text());
|
||||
const token = (0, cheerio_1.load)(response);
|
||||
let verifytoken = token("#novelSearchForm > input").attr("value");
|
||||
let formData = new FormData();
|
||||
formData.append("inputContent", searchTerm);
|
||||
const body = yield (0, fetch_1.fetchApi)(url, {
|
||||
method: "POST",
|
||||
headers: { LNRequestVerifyToken: verifytoken },
|
||||
body: formData,
|
||||
}, pluginId).then((r) => r.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
let results = JSON.parse(loadedCheerio("body").text());
|
||||
loadedCheerio = (0, cheerio_1.load)(results.resultview);
|
||||
loadedCheerio(".novel-item").each(function () {
|
||||
var _a;
|
||||
const novelName = loadedCheerio(this)
|
||||
.find("h4.novel-title")
|
||||
.text()
|
||||
.trim();
|
||||
const novelCover = loadedCheerio(this).find("img").attr("src");
|
||||
const novelUrl = baseUrl + ((_a = loadedCheerio(this).find("a").attr("href")) === null || _a === void 0 ? void 0 : _a.substring(1));
|
||||
novels.push({
|
||||
name: novelName,
|
||||
url: novelUrl,
|
||||
cover: novelCover,
|
||||
});
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = function (url) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url, { headers: headers });
|
||||
});
|
||||
};
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,122 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.icon = exports.version = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
exports.id = "mtlreader";
|
||||
exports.name = "MTL Reader";
|
||||
exports.version = "1.0.0";
|
||||
exports.icon = "src/en/mtlreader/icon.png";
|
||||
exports.site = "https://mtlreader.com/";
|
||||
exports.protected = false;
|
||||
const pluginId = exports.id;
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = function (page) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = `${baseUrl}novels?page=${page}`;
|
||||
const body = yield (0, fetch_1.fetchApi)(url, {}, pluginId).then((r) => r.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio(".col-md-4.col-sm-4").each(function () {
|
||||
const novelName = loadedCheerio(this).find("h5").text();
|
||||
const novelCover = loadedCheerio(this).find("img").attr("src");
|
||||
const novelUrl = loadedCheerio(this).find("h5 > a").attr("href");
|
||||
if (!novelUrl)
|
||||
return;
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = novelUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(url, {}, pluginId).then((r) => r.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const novel = {
|
||||
url,
|
||||
chapters: [],
|
||||
};
|
||||
novel.name = loadedCheerio(".agent-title").text().trim();
|
||||
novel.cover = loadedCheerio(".agent-p-img > img").attr("src");
|
||||
novel.summary = loadedCheerio("#editdescription").text().trim();
|
||||
novel.author = loadedCheerio("i.fa-user")
|
||||
.parent()
|
||||
.text()
|
||||
.replace("Author: ", "")
|
||||
.trim();
|
||||
let chapter = [];
|
||||
loadedCheerio("tr.spaceUnder").each(function () {
|
||||
const chapterName = loadedCheerio(this).find("a").text().trim();
|
||||
const releaseDate = null;
|
||||
const chapterUrl = loadedCheerio(this).find("a").attr("href");
|
||||
if (!chapterUrl)
|
||||
return;
|
||||
chapter.push({
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
});
|
||||
});
|
||||
novel.chapters = chapter;
|
||||
return novel;
|
||||
});
|
||||
};
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = function (chapterUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl, {}, pluginId).then((r) => r.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio(".container ins,script,p.mtlreader").remove();
|
||||
const chapterText = loadedCheerio(".container").html();
|
||||
return chapterText;
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = function (searchTerm) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = `${baseUrl}search?input=${searchTerm}`;
|
||||
const body = yield (0, fetch_1.fetchApi)(url, {}, pluginId).then((r) => r.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio(".col-md-4.col-sm-4").each(function () {
|
||||
const novelName = loadedCheerio(this).find("h5").text();
|
||||
const novelCover = loadedCheerio(this).find("img").attr("src");
|
||||
const novelUrl = loadedCheerio(this).find("h5 > a").attr("href");
|
||||
if (!novelUrl)
|
||||
return;
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = function (url) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const headers = {
|
||||
Referer: baseUrl,
|
||||
};
|
||||
return yield (0, fetch_1.fetchFile)(url, { headers: headers });
|
||||
});
|
||||
};
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,167 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.icon = exports.version = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
exports.id = "nitroscans";
|
||||
exports.name = "Nitroscans";
|
||||
exports.version = "1.0.0";
|
||||
exports.icon = "src/en/nitroscans/icon.png";
|
||||
exports.site = "https://nitroscans.com/";
|
||||
exports.protected = false;
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = function (page) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = baseUrl + "wp-admin/admin-ajax.php";
|
||||
let formData = new FormData();
|
||||
formData.append("action", "madara_load_more");
|
||||
formData.append("page", `${Number(page - 1)}`);
|
||||
formData.append("template", "madara-core/content/content-archive");
|
||||
formData.append("vars[orderby]", "meta_value_num");
|
||||
formData.append("vars[post_type]", "wp-manga");
|
||||
formData.append("vars[meta_key]", "_wp_manga_views");
|
||||
formData.append("vars[wp-manga-genre]", "novels");
|
||||
const body = yield (0, fetch_1.fetchApi)(url, {
|
||||
method: "POST",
|
||||
body: formData,
|
||||
}).then((r) => r.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio(".page-item-detail").each(function () {
|
||||
const novelName = loadedCheerio(this).find("h3 > a").text();
|
||||
const novelCover = loadedCheerio(this).find("img").attr("data-src");
|
||||
const novelUrl = loadedCheerio(this).find("h3 > a").attr("href");
|
||||
if (!novelUrl)
|
||||
return;
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
var _a;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = novelUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then((r) => r.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const novel = {
|
||||
url,
|
||||
chapters: [],
|
||||
};
|
||||
loadedCheerio(".manga-title-badges.custom.novel").remove();
|
||||
novel.name = loadedCheerio(".post-title > h1").text().trim();
|
||||
novel.cover = loadedCheerio(".summary_image")
|
||||
.find("img")
|
||||
.attr("data-src");
|
||||
novel.summary = (_a = loadedCheerio(".summary__content").text()) === null || _a === void 0 ? void 0 : _a.trim();
|
||||
novel.genres = loadedCheerio(".genres-content")
|
||||
.children("a")
|
||||
.map((i, el) => loadedCheerio(el).text())
|
||||
.toArray()
|
||||
.join(",");
|
||||
loadedCheerio(".post-content_item").each(function () {
|
||||
const detailName = loadedCheerio(this)
|
||||
.find(".summary-heading")
|
||||
.text()
|
||||
.trim();
|
||||
const detail = loadedCheerio(this)
|
||||
.find(".summary-content")
|
||||
.text()
|
||||
.trim();
|
||||
switch (detailName) {
|
||||
case "Author(s)":
|
||||
novel.author = detail;
|
||||
break;
|
||||
case "Status":
|
||||
novel.status = detail.replace(/G/g, "g");
|
||||
break;
|
||||
}
|
||||
});
|
||||
let chapter = [];
|
||||
let chapterlisturl = novelUrl + "ajax/chapters/";
|
||||
const data = yield (0, fetch_1.fetchApi)(chapterlisturl, { method: "POST" });
|
||||
const text = yield data.text();
|
||||
loadedCheerio = (0, cheerio_1.load)(text);
|
||||
loadedCheerio(".wp-manga-chapter").each(function () {
|
||||
const chapterName = loadedCheerio(this).find("a").text().trim();
|
||||
const releaseDate = loadedCheerio(this).find("span").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;
|
||||
});
|
||||
};
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = function (chapterUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then((r) => r.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio(".text-left").html();
|
||||
return chapterText;
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = function (searchTerm) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = baseUrl + "wp-admin/admin-ajax.php";
|
||||
let formData = new FormData();
|
||||
formData.append("action", "madara_load_more");
|
||||
formData.append("page", `${Number(1 - 1)}`);
|
||||
formData.append("template", "madara-core/content/content-search");
|
||||
formData.append("vars[s]", searchTerm);
|
||||
formData.append("vars[post_type]", "wp-manga");
|
||||
formData.append("vars[wp-manga-genre]", "novels");
|
||||
const body = yield (0, fetch_1.fetchApi)(url, {
|
||||
method: "POST",
|
||||
body: formData,
|
||||
}).then((r) => r.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio(".c-tabs-item__content").each(function () {
|
||||
const novelName = loadedCheerio(this).find("h3 > a").text();
|
||||
const novelCover = loadedCheerio(this).find("img").attr("data-src");
|
||||
const novelUrl = loadedCheerio(this).find("h3 > a").attr("href");
|
||||
if (!novelUrl)
|
||||
return;
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = function (url) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const headers = {
|
||||
Referer: baseUrl,
|
||||
};
|
||||
return yield (0, fetch_1.fetchFile)(url, { headers: headers });
|
||||
});
|
||||
};
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,300 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.filters = exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.icon = exports.version = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const filterInputs_1 = require("@libs/filterInputs");
|
||||
exports.id = "NobleMTL";
|
||||
exports.name = "NobleMTL";
|
||||
exports.version = "1.0.0";
|
||||
exports.icon = "src/en/noblemtl/icon.png";
|
||||
exports.site = "https://www.noblemtl.com/";
|
||||
exports.protected = false;
|
||||
const popularNovels = function (page, { filters }) {
|
||||
var _a, _b;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let link = `${exports.site}series/?page=${page}`;
|
||||
if ((_a = filters === null || filters === void 0 ? void 0 : filters.genres) === null || _a === void 0 ? void 0 : _a.length) {
|
||||
if (Array.isArray(filters.genres))
|
||||
link += filters.genres.map((i) => `&genre[]=${i}`).join("");
|
||||
}
|
||||
if ((_b = filters === null || filters === void 0 ? void 0 : filters.type) === null || _b === void 0 ? void 0 : _b.length) {
|
||||
if (Array.isArray(filters.type))
|
||||
link += filters.type.map((i) => `&lang[]=${i}`).join("");
|
||||
}
|
||||
link += "&status=" + ((filters === null || filters === void 0 ? void 0 : filters.status) ? filters === null || filters === void 0 ? void 0 : filters.status : "");
|
||||
link += "&order=" + ((filters === null || filters === void 0 ? void 0 : filters.order) ? filters === null || filters === void 0 ? void 0 : filters.order : "popular");
|
||||
const body = yield (0, fetch_1.fetchApi)(link).then((result) => result.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const novels = [];
|
||||
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;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function parseNovelAndChapters(novelUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = novelUrl;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const novel = {
|
||||
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 "المؤلف:":
|
||||
case "Yazar:":
|
||||
case "Autor:":
|
||||
case "Author:":
|
||||
novel.author = detail;
|
||||
break;
|
||||
case "Status:":
|
||||
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 = [];
|
||||
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;
|
||||
});
|
||||
};
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = function (chapterUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)(chapterUrl);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let chapterText = loadedCheerio("div.epcontent").html();
|
||||
return chapterText;
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = function (searchTerm) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = `${exports.site}?s=${searchTerm}`;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const novels = [];
|
||||
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;
|
||||
});
|
||||
};
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = function (url) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const headers = {
|
||||
Referer: exports.site,
|
||||
};
|
||||
return yield (0, fetch_1.fetchFile)(url, { headers: headers });
|
||||
});
|
||||
};
|
||||
exports.fetchImage = fetchImage;
|
||||
exports.filters = [
|
||||
{
|
||||
key: "order",
|
||||
label: "Sort By",
|
||||
values: [
|
||||
{ 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" },
|
||||
],
|
||||
inputType: filterInputs_1.FilterInputs.Picker,
|
||||
},
|
||||
{
|
||||
key: "status",
|
||||
label: "Status",
|
||||
values: [
|
||||
{ label: "All", value: "" },
|
||||
{ label: "Ongoing", value: "ongoing" },
|
||||
{ label: "Hiatus", value: "hiatus" },
|
||||
{ label: "Completed", value: "completed" },
|
||||
],
|
||||
inputType: filterInputs_1.FilterInputs.Picker,
|
||||
},
|
||||
{
|
||||
key: "type",
|
||||
label: "Type",
|
||||
values: [
|
||||
{ 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" },
|
||||
],
|
||||
inputType: filterInputs_1.FilterInputs.Checkbox,
|
||||
},
|
||||
{
|
||||
key: "genres",
|
||||
label: "Genres",
|
||||
values: [
|
||||
{ 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" },
|
||||
],
|
||||
inputType: filterInputs_1.FilterInputs.Checkbox,
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,127 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.icon = exports.version = exports.name = exports.id = void 0;
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const cheerio_1 = require("cheerio");
|
||||
exports.id = "novelforest";
|
||||
exports.name = "Novel Forest (Broken)";
|
||||
exports.version = "1.0.0";
|
||||
exports.icon = "src/en/novelforest/icon.png";
|
||||
exports.site = "https://novelforest.com/";
|
||||
exports.protected = false;
|
||||
const pluginId = exports.id;
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = function (page) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = `${baseUrl}popular?page=${page}`;
|
||||
const body = yield (0, fetch_1.fetchApi)(url, {}, pluginId).then((r) => r.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio(".book-item").each(function () {
|
||||
var _a;
|
||||
const novelName = loadedCheerio(this).find(".title").text();
|
||||
const novelCover = "https:" + loadedCheerio(this).find("img").attr("data-src");
|
||||
const novelUrl = baseUrl +
|
||||
((_a = loadedCheerio(this).find(".title a").attr("href")) === null || _a === void 0 ? void 0 : _a.substring(1));
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
var _a, _b, _c;
|
||||
const url = novelUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(url, {}, pluginId).then((r) => r.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const novel = {
|
||||
url,
|
||||
chapters: [],
|
||||
};
|
||||
novel.name = loadedCheerio(".name h1").text().trim();
|
||||
novel.cover = "https:" + loadedCheerio(".img-cover img").attr("data-src");
|
||||
novel.summary = loadedCheerio("body > div.layout > div.main-container.book-details > div > div.row.no-gutters > div.col-lg-8 > div.mt-1 > div.section.box.mt-1.summary > div.section-body > p.content")
|
||||
.text()
|
||||
.trim();
|
||||
novel.author = (_a = loadedCheerio("body > div.layout > div.main-container.book-details > div > div.row.no-gutters > div.col-lg-8 > div.book-info > div.detail > div.meta.box.mt-1.p-10 > p:nth-child(1) > a > span")
|
||||
.text()) === null || _a === void 0 ? void 0 : _a.trim();
|
||||
novel.status = (_b = loadedCheerio("body > div.layout > div.main-container.book-details > div > div.row.no-gutters > div.col-lg-8 > div.book-info > div.detail > div.meta.box.mt-1.p-10 > p:nth-child(2) > a > span")
|
||||
.text()) === null || _b === void 0 ? void 0 : _b.trim();
|
||||
novel.genres = (_c = loadedCheerio("body > div.layout > div.main-container.book-details > div > div.row.no-gutters > div.col-lg-8 > div.book-info > div.detail > div.meta.box.mt-1.p-10 > p:nth-child(3)")
|
||||
.text()) === null || _c === void 0 ? void 0 : _c.replace("Genres :", "").replace(/[\s\n]+/g, " ").trim();
|
||||
let chapter = [];
|
||||
const chaptersUrl = novelUrl.replace(baseUrl, "https://novelforest.com/api/novels/") +
|
||||
"/chapters?source=detail";
|
||||
const chaptersRequest = yield fetch(chaptersUrl);
|
||||
const chaptersHtml = yield chaptersRequest.text();
|
||||
loadedCheerio = (0, cheerio_1.load)(chaptersHtml);
|
||||
loadedCheerio("li").each(function () {
|
||||
var _a;
|
||||
const chapterName = loadedCheerio(this)
|
||||
.find(".chapter-title")
|
||||
.text()
|
||||
.trim();
|
||||
const releaseDate = loadedCheerio(this)
|
||||
.find(".chapter-update")
|
||||
.text()
|
||||
.trim();
|
||||
const chapterUrl = baseUrl + ((_a = loadedCheerio(this).find("a").attr("href")) === null || _a === void 0 ? void 0 : _a.substring(1));
|
||||
chapter.push({
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
});
|
||||
});
|
||||
novel.chapters = chapter;
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = function (chapterUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl, {}, pluginId).then((r) => r.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio("#listen-chapter").remove();
|
||||
loadedCheerio("#google_translate_element").remove();
|
||||
const chapterText = loadedCheerio(".chapter__content").html();
|
||||
return chapterText;
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = function (searchTerm) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = `${baseUrl}search?q=${searchTerm}`;
|
||||
const body = yield (0, fetch_1.fetchApi)(url, {}, pluginId).then((r) => r.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio(".book-item").each(function () {
|
||||
var _a;
|
||||
const novelName = loadedCheerio(this).find(".title").text();
|
||||
const novelCover = "https:" + loadedCheerio(this).find("img").attr("data-src");
|
||||
const novelUrl = baseUrl +
|
||||
((_a = loadedCheerio(this).find(".title a").attr("href")) === null || _a === void 0 ? void 0 : _a.substring(1));
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.searchNovels = searchNovels;
|
||||
exports.fetchImage = fetch_1.fetchFile;
|
||||
@@ -0,0 +1,148 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.icon = exports.version = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
exports.id = "novelfull";
|
||||
exports.name = "NovelFull";
|
||||
exports.version = "1.0.0";
|
||||
exports.icon = "src/en/novelfull/icon.png";
|
||||
exports.site = "https://novelfull.com/";
|
||||
exports.protected = false;
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = function (page) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = `${baseUrl}most-popular?page=${page}`;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio(".col-truyen-main .list-truyen .row").each(function () {
|
||||
var _a, _b;
|
||||
const novelName = loadedCheerio(this)
|
||||
.find("h3.truyen-title > a")
|
||||
.text();
|
||||
const novelCover = baseUrl + ((_a = loadedCheerio(this).find("img").attr("src")) === null || _a === void 0 ? void 0 : _a.slice(1));
|
||||
const novelUrl = baseUrl +
|
||||
((_b = loadedCheerio(this)
|
||||
.find("h3.truyen-title > a")
|
||||
.attr("href")) === null || _b === void 0 ? void 0 : _b.slice(1));
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = novelUrl;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const novel = {
|
||||
url,
|
||||
chapters: [],
|
||||
};
|
||||
novel.name = loadedCheerio("div.book > img").attr("alt");
|
||||
novel.cover = baseUrl + loadedCheerio("div.book > img").attr("src");
|
||||
novel.summary = loadedCheerio("div.desc-text").text().trim();
|
||||
novel.author = loadedCheerio('h3:contains("Author")')
|
||||
.parent()
|
||||
.contents()
|
||||
.text()
|
||||
.replace("Author:", "");
|
||||
novel.genres = loadedCheerio('h3:contains("Genre")')
|
||||
.siblings()
|
||||
.map((i, el) => loadedCheerio(el).text())
|
||||
.toArray()
|
||||
.join(",");
|
||||
novel.status = loadedCheerio('h3:contains("Status")').next().text();
|
||||
const novelId = loadedCheerio("#rating").attr("data-novel-id");
|
||||
function getChapters(id) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const chapterListUrl = baseUrl + "ajax/chapter-option?novelId=" + id;
|
||||
const data = yield (0, fetch_1.fetchApi)(chapterListUrl);
|
||||
const chapterlist = yield data.text();
|
||||
loadedCheerio = (0, cheerio_1.load)(chapterlist);
|
||||
let chapter = [];
|
||||
loadedCheerio("select > option").each(function () {
|
||||
var _a;
|
||||
const chapterName = loadedCheerio(this).text();
|
||||
const releaseDate = null;
|
||||
const chapterUrl = baseUrl + ((_a = loadedCheerio(this).attr("value")) === null || _a === void 0 ? void 0 : _a.slice(1));
|
||||
chapter.push({
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
});
|
||||
});
|
||||
return chapter;
|
||||
});
|
||||
}
|
||||
novel.chapters = yield getChapters(novelId);
|
||||
return novel;
|
||||
});
|
||||
};
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = function (chapterUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)(chapterUrl);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio("#chapter-content div.ads").remove();
|
||||
let chapterText = loadedCheerio("#chapter-content").html();
|
||||
return chapterText;
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = function (searchTerm) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const searchUrl = `${baseUrl}search?keyword=${searchTerm}`;
|
||||
const result = yield (0, fetch_1.fetchApi)(searchUrl);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio(".col-truyen-main .list-truyen .row").each(function () {
|
||||
var _a, _b;
|
||||
const novelName = loadedCheerio(this)
|
||||
.find("h3.truyen-title > a")
|
||||
.text();
|
||||
const novelCover = baseUrl + ((_a = loadedCheerio(this).find("img").attr("src")) === null || _a === void 0 ? void 0 : _a.slice(1));
|
||||
const novelUrl = baseUrl +
|
||||
((_b = loadedCheerio(this)
|
||||
.find("h3.truyen-title > a")
|
||||
.attr("href")) === null || _b === void 0 ? void 0 : _b.slice(1));
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = function (url) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const headers = {
|
||||
Referer: baseUrl,
|
||||
};
|
||||
return yield (0, fetch_1.fetchFile)(url, { headers: headers });
|
||||
});
|
||||
};
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,133 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.icon = exports.version = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
exports.id = "novelhold";
|
||||
exports.name = "Novel Hold";
|
||||
exports.version = "1.0.0";
|
||||
exports.icon = "src/en/novelhold/icon.png";
|
||||
exports.site = "https://novelhold.com/";
|
||||
exports.protected = false;
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = function (page) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = `${baseUrl}all-${page}.html`;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then((r) => r.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio("#article_list_content > li").each(function () {
|
||||
var _a;
|
||||
const novelName = loadedCheerio(this)
|
||||
.find("h3")
|
||||
.text()
|
||||
.replace(/\t+/g, "")
|
||||
.replace(/\n/g, " ");
|
||||
const novelCover = loadedCheerio(this).find("img").attr("data-src");
|
||||
const novelUrl = baseUrl + ((_a = loadedCheerio(this).find("a").attr("href")) === null || _a === void 0 ? void 0 : _a.slice(1));
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
var _a;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = novelUrl;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then((r) => r.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const novel = {
|
||||
url,
|
||||
chapters: [],
|
||||
};
|
||||
novel.name = loadedCheerio(".booknav2 > h1").text();
|
||||
novel.cover = loadedCheerio('meta[property="og:image"]').attr("content");
|
||||
novel.summary = loadedCheerio(".navtxt").text().trim();
|
||||
novel.author = loadedCheerio('p:contains("Author")')
|
||||
.text()
|
||||
.replace("Author:", "")
|
||||
.trim();
|
||||
novel.status = loadedCheerio('p:contains("Status")')
|
||||
.text()
|
||||
.replace("Status:", "")
|
||||
.replace("Active", "Ongoing")
|
||||
.trim();
|
||||
novel.genres = (_a = loadedCheerio('p:contains("Genre")')
|
||||
.text()) === null || _a === void 0 ? void 0 : _a.replace("Genre:", "").trim();
|
||||
let chapter = [];
|
||||
loadedCheerio("ul.chapterlist > li").each(function () {
|
||||
var _a;
|
||||
const chapterName = loadedCheerio(this).find("a").text().trim();
|
||||
const releaseDate = null;
|
||||
const chapterUrl = baseUrl + ((_a = loadedCheerio(this).find("a").attr("href")) === null || _a === void 0 ? void 0 : _a.slice(1));
|
||||
chapter.push({
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
});
|
||||
});
|
||||
novel.chapters = chapter;
|
||||
console.log(novel);
|
||||
return novel;
|
||||
});
|
||||
};
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = function (chapterUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const body = yield (0, fetch_1.fetchApi)(chapterUrl).then((r) => r.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio(".content").html();
|
||||
return chapterText;
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = function (searchTerm) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = `${baseUrl}index.php?s=so&module=book&keyword=${searchTerm}`;
|
||||
const body = yield (0, fetch_1.fetchApi)(url).then((r) => r.text());
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio("#article_list_content > li").each(function () {
|
||||
var _a;
|
||||
const novelName = loadedCheerio(this)
|
||||
.find("h3")
|
||||
.text()
|
||||
.replace(/\t+/g, "")
|
||||
.replace(/\n/g, " ");
|
||||
const novelCover = loadedCheerio(this).find("img").attr("data-src");
|
||||
const novelUrl = baseUrl + ((_a = loadedCheerio(this).find("a").attr("href")) === null || _a === void 0 ? void 0 : _a.slice(1));
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = function (url) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const headers = {
|
||||
Referer: baseUrl,
|
||||
};
|
||||
return yield (0, fetch_1.fetchFile)(url, { headers: headers });
|
||||
});
|
||||
};
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,152 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.icon = exports.version = exports.site = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
exports.id = "novelpub.com";
|
||||
exports.name = "NovelPub";
|
||||
exports.site = "https://www.novelpub.com/";
|
||||
exports.version = "1.0.0";
|
||||
exports.icon = "src/en/novelpub/icon.png";
|
||||
const baseUrl = exports.site;
|
||||
const headers = {
|
||||
Accept: "application/json",
|
||||
"Content-Type": "application/json",
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36",
|
||||
};
|
||||
const popularNovels = function (page) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let url = baseUrl + "browse/all/popular/all/" + page;
|
||||
const result = yield (0, fetch_1.fetchApi)(url, { method: "GET", headers });
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio(".novel-item.ads").remove();
|
||||
loadedCheerio(".novel-item").each(function () {
|
||||
var _a;
|
||||
const novelName = loadedCheerio(this)
|
||||
.find(".novel-title")
|
||||
.text()
|
||||
.trim();
|
||||
const novelCover = loadedCheerio(this).find("img").attr("data-src");
|
||||
const novelUrl = baseUrl +
|
||||
((_a = loadedCheerio(this)
|
||||
.find(".novel-title > a")
|
||||
.attr("href")) === null || _a === void 0 ? void 0 : _a.substring(1));
|
||||
const novel = { name: novelName, cover: novelCover, url: novelUrl };
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
var _a, _b;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = novelUrl;
|
||||
const result = yield (0, fetch_1.fetchApi)(url, { method: "GET", headers });
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novel = { url, genres: "" };
|
||||
novel.name = loadedCheerio("h1.novel-title").text().trim();
|
||||
novel.cover = loadedCheerio("figure.cover > img").attr("data-src");
|
||||
loadedCheerio("div.categories > ul > li").each(function () {
|
||||
novel.genres +=
|
||||
loadedCheerio(this)
|
||||
.text()
|
||||
.replace(/[\t\n]/g, "") + ",";
|
||||
});
|
||||
loadedCheerio("div.header-stats > span").each(function () {
|
||||
if (loadedCheerio(this).find("small").text() === "Status") {
|
||||
novel.status = loadedCheerio(this).find("strong").text();
|
||||
}
|
||||
});
|
||||
novel.genres = (_a = novel.genres) === null || _a === void 0 ? void 0 : _a.slice(0, -1);
|
||||
novel.author = loadedCheerio(".author > a > span").text();
|
||||
novel.summary = loadedCheerio(".summary > .content").text().trim();
|
||||
const delay = (ms) => new Promise((res) => setTimeout(res, ms));
|
||||
let lastPage = 1;
|
||||
lastPage = parseInt((_b = loadedCheerio("#novel > header > div.header-body.container > div.novel-info > div.header-stats > span:nth-child(1) > strong")
|
||||
.text()) === null || _b === void 0 ? void 0 : _b.trim());
|
||||
lastPage = Math.ceil(lastPage / 100);
|
||||
const getChapters = () => __awaiter(this, void 0, void 0, function* () {
|
||||
let novelChapters = [];
|
||||
for (let i = 1; i <= lastPage; i++) {
|
||||
const chaptersUrl = `${novelUrl}/chapters/page-${i}`;
|
||||
const chaptersRequest = yield (0, fetch_1.fetchApi)(chaptersUrl, {
|
||||
headers,
|
||||
});
|
||||
const chaptersHtml = yield chaptersRequest.text();
|
||||
loadedCheerio = (0, cheerio_1.load)(chaptersHtml);
|
||||
loadedCheerio(".chapter-list li").each(function () {
|
||||
var _a;
|
||||
const chapterName = loadedCheerio(this)
|
||||
.find(".chapter-title")
|
||||
.text()
|
||||
.trim();
|
||||
const releaseDate = loadedCheerio(this)
|
||||
.find(".chapter-update")
|
||||
.text()
|
||||
.trim();
|
||||
const chapterUrl = baseUrl +
|
||||
((_a = loadedCheerio(this)
|
||||
.find("a")
|
||||
.attr("href")) === null || _a === void 0 ? void 0 : _a.substring(1));
|
||||
novelChapters.push({
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
});
|
||||
});
|
||||
yield delay(1000);
|
||||
}
|
||||
return novelChapters;
|
||||
});
|
||||
novel.chapters = yield getChapters();
|
||||
return novel;
|
||||
});
|
||||
};
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = function (chapterUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = chapterUrl;
|
||||
const result = yield (0, fetch_1.fetchApi)(url, { method: "GET", headers });
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio("#chapter-container").html();
|
||||
return chapterText;
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
// They have API to search, pls update it, im quite lazy xD
|
||||
const searchNovels = function (searchTerm) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = `${baseUrl}lnwsearchlive?inputContent=${searchTerm}`;
|
||||
const result = yield (0, fetch_1.fetchApi)(url, { method: "GET", headers });
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
// let results = JSON.parse(loadedCheerio('body').text());
|
||||
// loadedCheerio = load(results.resultview);
|
||||
// loadedCheerio('.novel-item').each(function () {
|
||||
// const novelName = loadedCheerio(this).find('.novel-title').text().trim();
|
||||
// const novelCover = loadedCheerio(this).find('img').attr('src');
|
||||
// const novelUrl =
|
||||
// baseUrl + loadedCheerio(this).find('a').attr('href').substring(1);
|
||||
// const novel = { name: novelName, cover: novelCover, url: novelUrl };
|
||||
// novels.push(novel);
|
||||
// });
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.searchNovels = searchNovels;
|
||||
exports.fetchImage = fetch_1.fetchFile;
|
||||
@@ -0,0 +1,221 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.filters = exports.fetchImage = exports.searchNovels = exports.parseChapter = exports.parseNovelAndChapters = exports.popularNovels = exports.site = exports.icon = exports.version = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const filterInputs_1 = require("@libs/filterInputs");
|
||||
exports.id = "PandaMTL";
|
||||
exports.name = "PandaMTL";
|
||||
exports.version = "1.0.0";
|
||||
exports.icon = "src/en/wordpress/icon.png";
|
||||
exports.site = "https://www.pandamtl.com/";
|
||||
exports.protected = false;
|
||||
const pluginId = exports.id;
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = function (page, { filters }) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let link = `${baseUrl}series/?page=${page}`;
|
||||
if (filters) {
|
||||
if (Array.isArray(filters.genres) && filters.genres.length) {
|
||||
link += filters.genres.map((i) => `&genre[]=${i}`).join("");
|
||||
}
|
||||
if (Array.isArray(filters.type) && filters.type.length) {
|
||||
link += filters.type.map((i) => `&lang[]=${i}`).join("");
|
||||
}
|
||||
}
|
||||
link += "&status=" + ((filters === null || filters === void 0 ? void 0 : filters.status) ? filters === null || filters === void 0 ? void 0 : filters.status : "");
|
||||
link += "&order=" + ((filters === null || filters === void 0 ? void 0 : filters.order) ? filters === null || filters === void 0 ? void 0 : filters.order : "popular");
|
||||
const body = yield (0, fetch_1.fetchApi)(link, {}, pluginId).then((result) => result.text());
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const novels = [];
|
||||
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;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = novelUrl;
|
||||
const result = yield (0, fetch_1.fetchApi)(url, {}, pluginId);
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const novel = {
|
||||
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 = [];
|
||||
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;
|
||||
});
|
||||
};
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = function (chapterUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)(chapterUrl, {}, pluginId);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let chapterText = loadedCheerio(".epcontent").html();
|
||||
return chapterText;
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = function (searchTerm) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = `${baseUrl}?s=${searchTerm}`;
|
||||
const result = yield (0, fetch_1.fetchApi)(url, {}, pluginId);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const novels = [];
|
||||
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;
|
||||
});
|
||||
};
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = function (url) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const headers = {
|
||||
Referer: baseUrl,
|
||||
};
|
||||
return yield (0, fetch_1.fetchFile)(url, { headers: headers });
|
||||
});
|
||||
};
|
||||
exports.fetchImage = fetchImage;
|
||||
exports.filters = [
|
||||
{
|
||||
key: "order",
|
||||
label: "Sort By",
|
||||
values: [
|
||||
{ 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" },
|
||||
],
|
||||
inputType: filterInputs_1.FilterInputs.Picker,
|
||||
},
|
||||
{
|
||||
key: "status",
|
||||
label: "Status",
|
||||
values: [
|
||||
{ label: "All", value: "" },
|
||||
{ label: "Ongoing", value: "ongoing" },
|
||||
{ label: "Hiatus", value: "hiatus" },
|
||||
{ label: "Completed", value: "completed" },
|
||||
],
|
||||
inputType: filterInputs_1.FilterInputs.Picker,
|
||||
},
|
||||
{
|
||||
key: "type",
|
||||
label: "Type",
|
||||
values: [
|
||||
{ label: "Light Novel (KR)", value: "light-novel-kr" },
|
||||
{ label: "Web Novel", value: "web-novel" },
|
||||
],
|
||||
inputType: filterInputs_1.FilterInputs.Checkbox,
|
||||
},
|
||||
{
|
||||
key: "genres",
|
||||
label: "Genres",
|
||||
values: [
|
||||
{ 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" },
|
||||
],
|
||||
inputType: filterInputs_1.FilterInputs.Checkbox,
|
||||
},
|
||||
];
|
||||
Reference in New Issue
Block a user