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 = "ar-mtl";
|
||||
exports.name = "ArMTL [madara]";
|
||||
exports.icon = "multisrc/madara/icons/armtl.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://ar-mtl.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 = "arnovel";
|
||||
exports.name = "ArNovel [madara]";
|
||||
exports.icon = "multisrc/madara/icons/arnovel.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://arnovel.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 (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 = "hizomanga";
|
||||
exports.name = "HizoManga [madara]";
|
||||
exports.icon = "multisrc/madara/icons/hizomanga.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://hizomanga.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 + "serie" + '/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 + "/" + "serie" + "/" + 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 = "novel4up";
|
||||
exports.name = "Novel4Up [madara]";
|
||||
exports.icon = "multisrc/madara/icons/novel4up.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://novel4up.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 = "riwyat";
|
||||
exports.name = "Riwyat [madara]";
|
||||
exports.icon = "multisrc/madara/icons/riwyat.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://riwyat.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 = "teamxnovel";
|
||||
exports.name = "TeamXNovel [madara]";
|
||||
exports.icon = "multisrc/madara/icons/teamxnovel.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://teamxnovel.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,245 @@
|
||||
"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 = "kolnovel";
|
||||
exports.name = "KolNovel";
|
||||
exports.version = "1.0.0";
|
||||
exports.icon = "multisrc/wpmangastream/icons/kolnovel.png";
|
||||
exports.site = "https://kolnovel.com/";
|
||||
module.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.status : "");
|
||||
link += "&order=" + ((filters === null || filters === void 0 ? void 0 : filters.order) ? 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 parseNovelAndChapters(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 parseChapter(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 ignore = loadedCheerio(".epcontent > p").next().attr("class");
|
||||
loadedCheerio(`p.${ignore}`).remove();
|
||||
let chapterText = loadedCheerio(".epcontent").html();
|
||||
return chapterText;
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = function searchNovels(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 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;
|
||||
exports.filters = [
|
||||
{
|
||||
key: "order",
|
||||
label: "ترتيب حسب",
|
||||
values: [
|
||||
{ label: "الإعداد الأولي", value: "" },
|
||||
{ label: "A-Z", value: "title" },
|
||||
{ label: "Z-A", value: "titlereverse" },
|
||||
{ label: "أخر التحديثات", value: "update" },
|
||||
{ label: "أخر ما تم إضافته", value: "latest" },
|
||||
{ label: "الرائجة", value: "popular" },
|
||||
],
|
||||
inputType: filterInputs_1.FilterInputs.Picker,
|
||||
},
|
||||
{
|
||||
key: "status",
|
||||
label: "الحالة",
|
||||
values: [
|
||||
{ label: "All", value: "" },
|
||||
{ label: "Ongoing", value: "ongoing" },
|
||||
{ label: "Hiatus", value: "hiatus" },
|
||||
{ label: "Completed", value: "completed" },
|
||||
],
|
||||
inputType: filterInputs_1.FilterInputs.Picker,
|
||||
},
|
||||
{
|
||||
key: "type",
|
||||
label: "النوع",
|
||||
values: [
|
||||
{ label: "إنجليزية", value: "english" },
|
||||
{ label: "روايةلايت", value: "light-novel" },
|
||||
{ label: "روايةويب", value: "web-novel" },
|
||||
{ label: "صينية", value: "chinese" },
|
||||
{ label: "عربية", value: "arabic" },
|
||||
{ label: "كورية", value: "korean" },
|
||||
{ label: "يابانية", value: "japanese" },
|
||||
],
|
||||
inputType: filterInputs_1.FilterInputs.Checkbox,
|
||||
},
|
||||
{
|
||||
key: "genres",
|
||||
label: "تصنيف",
|
||||
values: [
|
||||
{ label: "Wuxia", value: "wuxia" },
|
||||
{ label: "Xianxia", value: "xianxia" },
|
||||
{ label: "XUANHUAN", value: "xuanhuan" },
|
||||
{ label: "أكشن", value: "action" },
|
||||
{ label: "إثارة", value: "excitement" },
|
||||
{ label: "إنتقالالىعالمأخر", value: "isekai" },
|
||||
{ label: "إيتشي", value: "etchi" },
|
||||
{ label: "الخيالالعلمي", value: "sci-fi" },
|
||||
{ label: "بوليسي", value: "policy" },
|
||||
{ label: "تاريخي", value: "historical" },
|
||||
{ label: "تحقيقات", value: "%d8%aa%d8%ad%d9%82%d9%8a%d9%82" },
|
||||
{ label: "تقمصشخصيات", value: "rpg" },
|
||||
{ label: "جريمة", value: "crime" },
|
||||
{ label: "جوسى", value: "josei" },
|
||||
{ label: "حريم", value: "harem" },
|
||||
{ label: "حياةمدرسية", value: "school-life" },
|
||||
{ label: "خيالي(فانتازيا)", value: "fantasy" },
|
||||
{ label: "دراما", value: "drama" },
|
||||
{ label: "رعب", value: "horror" },
|
||||
{ label: "رومانسي", value: "romantic" },
|
||||
{ label: "سحر", value: "magic" },
|
||||
{ label: "سينن", value: "senen" },
|
||||
{ label: "شريحةمنالحياة", value: "slice-of-life" },
|
||||
{ label: "شوجو", value: "shojo" },
|
||||
{ label: "شونين", value: "shonen" },
|
||||
{ label: "طبي", value: "medical" },
|
||||
{ label: "ظواهرخارقةللطبيعة", value: "supernatural" },
|
||||
{ label: "غموض", value: "mysteries" },
|
||||
{ label: "فنونالقتال", value: "martial-arts" },
|
||||
{ label: "قوىخارقة", value: "superpower" },
|
||||
{ label: "كوميدي", value: "comedy" },
|
||||
{ label: "مأساوي", value: "tragedy" },
|
||||
{ label: "مابعدالكارثة", value: "after-the-disaster" },
|
||||
{ label: "مغامرة", value: "adventure" },
|
||||
{ label: "ميكا", value: "mechanical" },
|
||||
{ label: "ناضج", value: "mature" },
|
||||
{ label: "نفسي", value: "psychological" },
|
||||
],
|
||||
inputType: filterInputs_1.FilterInputs.Checkbox,
|
||||
},
|
||||
];
|
||||
@@ -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,
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,113 @@
|
||||
"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 = "chireads.com";
|
||||
exports.name = "Chireads";
|
||||
exports.site = "https://chireads.com/";
|
||||
exports.version = "1.0.0";
|
||||
exports.icon = "src/fr/chireads/icon.png";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = function (page) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = `${baseUrl}category/translatedtales/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("#content li").each(function () {
|
||||
const novelName = loadedCheerio(this).find(".news-list-tit h5").text();
|
||||
const novelCover = loadedCheerio(this).find("img").attr("src");
|
||||
const novelUrl = loadedCheerio(this)
|
||||
.find(".news-list-tit 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);
|
||||
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(".inform-title").text().trim();
|
||||
novel.cover = loadedCheerio(".inform-product img").attr("src");
|
||||
novel.summary = loadedCheerio(".inform-inform-txt").text().trim();
|
||||
let chapters = [];
|
||||
loadedCheerio(".chapitre-table a").each(function () {
|
||||
const chapterName = loadedCheerio(this).text().trim();
|
||||
const releaseDate = null;
|
||||
const chapterUrl = loadedCheerio(this).attr("href");
|
||||
if (!chapterUrl)
|
||||
return;
|
||||
chapters.push({
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
});
|
||||
});
|
||||
novel.chapters = chapters;
|
||||
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("#content").html();
|
||||
return chapterText;
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = function (searchTerm) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = `${baseUrl}search?x=0&y=0&name=${searchTerm}`;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio("#content li").each(function () {
|
||||
const novelName = loadedCheerio(this).find(".news-list-tit h5").text();
|
||||
const novelCover = loadedCheerio(this).find("img").attr("src");
|
||||
const novelUrl = loadedCheerio(this)
|
||||
.find(".news-list-tit h5 a")
|
||||
.attr("href");
|
||||
if (!novelUrl)
|
||||
return;
|
||||
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 = "meionovel";
|
||||
exports.name = "MeioNovel [madara]";
|
||||
exports.icon = "multisrc/madara/icons/meionovel.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://meionovel.id/";
|
||||
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 = "morenovel";
|
||||
exports.name = "MoreNovel [madara]";
|
||||
exports.icon = "multisrc/madara/icons/morenovel.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://morenovel.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 (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 = "wbnovel";
|
||||
exports.name = "WBNovel [madara]";
|
||||
exports.icon = "multisrc/madara/icons/wbnovel.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://wbnovel.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,126 @@
|
||||
"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.version = exports.icon = 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 = "IDWN.id";
|
||||
exports.name = "IndoWebNovel";
|
||||
exports.site = "https://indowebnovel.id/id/";
|
||||
exports.icon = "src/id/indowebnovel/icon.png";
|
||||
exports.version = "1.0.0";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = function (page) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = `${baseUrl}daftar-novel/`;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio(".novellist-blc 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 || !novelName)
|
||||
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();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novel = {
|
||||
url,
|
||||
name: "",
|
||||
cover: "",
|
||||
author: "",
|
||||
status: "",
|
||||
genres: "",
|
||||
summary: "",
|
||||
chapters: [],
|
||||
};
|
||||
novel.name = loadedCheerio(".series-title").text().trim();
|
||||
novel.cover = loadedCheerio(".series-thumb > img").attr("src");
|
||||
novel.summary = loadedCheerio(".series-synops").text().trim();
|
||||
novel.status = loadedCheerio(".status").text().trim();
|
||||
const genres = [];
|
||||
loadedCheerio(".series-genres").each(function () {
|
||||
genres.push(loadedCheerio(this).find("a").text().trim());
|
||||
});
|
||||
novel.genres = genres.join(",");
|
||||
let chapters = [];
|
||||
loadedCheerio(".series-chapterlist li").each(function () {
|
||||
const chapterName = loadedCheerio(this).find("a").text().trim();
|
||||
const releaseDate = null;
|
||||
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);
|
||||
const chapterText = loadedCheerio(".reader").html();
|
||||
return chapterText;
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = function (searchTerm) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = `${baseUrl}daftar-novel/`;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio(".novellist-blc 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,
|
||||
};
|
||||
if (novelName.toLowerCase().includes(searchTerm.toLowerCase())) {
|
||||
novels.push(novel);
|
||||
}
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.searchNovels = searchNovels;
|
||||
exports.fetchImage = fetch_1.fetchFile;
|
||||
@@ -0,0 +1,135 @@
|
||||
"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.version = exports.icon = exports.site = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
exports.id = "novelringan.com";
|
||||
exports.name = "NovelRingan";
|
||||
exports.site = "https://novelringan.com/";
|
||||
exports.icon = "src/id/novelringan/icon.png";
|
||||
exports.version = "1.0.0";
|
||||
const baseUrl = exports.site;
|
||||
const coverUriPrefix = "https://i0.wp.com/novelringan.com/wp-content/uploads/";
|
||||
const popularNovels = function (page) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = `${baseUrl}/top-novel/page/${page}`;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const novels = [];
|
||||
loadedCheerio("article.post").each(function () {
|
||||
var _a;
|
||||
const novelName = (_a = loadedCheerio(this)
|
||||
.find(".entry-title")
|
||||
.text()) === null || _a === void 0 ? void 0 : _a.trim();
|
||||
const novelCover = coverUriPrefix + loadedCheerio(this).find("img").attr("data-sxrx");
|
||||
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) {
|
||||
var _a;
|
||||
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,
|
||||
name: "",
|
||||
cover: "",
|
||||
genres: "",
|
||||
author: "",
|
||||
status: novelStatus_1.NovelStatus.Unknown,
|
||||
summary: "",
|
||||
chapters: [],
|
||||
};
|
||||
novel.name = (_a = loadedCheerio(".entry-title").text()) === null || _a === void 0 ? void 0 : _a.trim();
|
||||
novel.cover =
|
||||
coverUriPrefix +
|
||||
loadedCheerio("img.ts-post-image").attr("data-sxrx");
|
||||
novel.summary = loadedCheerio("body > div.site-container > div > main > article > div > div.maininfo > span > p").text();
|
||||
let genreSelector = loadedCheerio("body > div.site-container > div > main > article > div > div.maininfo > span > ul > li:nth-child(4)").text();
|
||||
novel.genres = genreSelector.includes("Genre")
|
||||
? genreSelector.replace("Genre:", "").trim()
|
||||
: "";
|
||||
let statusSelector = loadedCheerio("body > div.site-container > div > main > article > div > div.maininfo > span > ul > li:nth-child(3)").text();
|
||||
novel.status = statusSelector.includes("Status")
|
||||
? statusSelector.replace("Status:", "").trim()
|
||||
: novelStatus_1.NovelStatus.Unknown;
|
||||
let chapters = [];
|
||||
loadedCheerio(".bxcl > ul > li").each(function () {
|
||||
const chapterName = loadedCheerio(this).find("a").text();
|
||||
const releaseDate = null;
|
||||
const chapterUrl = loadedCheerio(this).find("a").attr("href");
|
||||
if (!chapterUrl)
|
||||
return;
|
||||
const chapter = {
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
};
|
||||
chapters.push(chapter);
|
||||
});
|
||||
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();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.entry-content div[style="display:none"]').remove();
|
||||
const chapterText = loadedCheerio(".entry-content").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);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio("article.post").each(function () {
|
||||
const novelName = loadedCheerio(this).find(".entry-title").text();
|
||||
const novelCover = coverUriPrefix + loadedCheerio(this).find("img").attr("data-sxrx");
|
||||
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.searchNovels = searchNovels;
|
||||
exports.fetchImage = fetch_1.fetchFile;
|
||||
@@ -0,0 +1,140 @@
|
||||
"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.version = exports.icon = exports.site = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
exports.id = "sakura.id";
|
||||
exports.name = "SakuraNovel";
|
||||
exports.site = "https://sakuranovel.id/";
|
||||
exports.icon = "src/id/sakuranovel/icon.png";
|
||||
exports.version = "1.0.0";
|
||||
const pluginId = exports.id;
|
||||
const sourceName = exports.name;
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = function (page) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = `${baseUrl}advanced-search/page/${page}/?title&author&yearx&status&type&order=rating&country%5B0%5D=china&country%5B1%5D=jepang&country%5B2%5D=unknown`;
|
||||
const result = yield (0, fetch_1.fetchApi)(url, {}, pluginId);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio(".flexbox2-item").each(function () {
|
||||
const novelName = loadedCheerio(this)
|
||||
.find(".flexbox2-title span")
|
||||
.first()
|
||||
.text();
|
||||
const novelCover = loadedCheerio(this).find("img").attr("src");
|
||||
const novelUrl = loadedCheerio(this)
|
||||
.find(".flexbox2-content > 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 result = yield (0, fetch_1.fetchApi)(novelUrl, {}, pluginId);
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novel = {
|
||||
name: sourceName,
|
||||
url: novelUrl,
|
||||
};
|
||||
novel.name = loadedCheerio(".series-title h2").text().trim();
|
||||
novel.cover = loadedCheerio(".series-thumb img").attr("src");
|
||||
loadedCheerio(".series-infolist > li").each(function () {
|
||||
const detailName = loadedCheerio(this).find("b").text().trim();
|
||||
const detail = loadedCheerio(this).find("b").next().text().trim();
|
||||
switch (detailName) {
|
||||
case "Author":
|
||||
novel.author = detail;
|
||||
break;
|
||||
}
|
||||
});
|
||||
novel.status = loadedCheerio(".status").text().trim();
|
||||
novel.genres = loadedCheerio(".series-genres")
|
||||
.children("a")
|
||||
.map((i, el) => loadedCheerio(el).text())
|
||||
.toArray()
|
||||
.join(",");
|
||||
loadedCheerio(".series-synops div").remove();
|
||||
novel.summary = loadedCheerio(".series-synops").text().trim();
|
||||
let chapters = [];
|
||||
loadedCheerio(".series-chapterlist li").each(function () {
|
||||
const chapterName = loadedCheerio(this)
|
||||
.find("a span")
|
||||
.first()
|
||||
.text()
|
||||
.replace(/.*?(Chapter.|[0-9])/g, "$1")
|
||||
.replace(/Bahasa Indonesia/g, "")
|
||||
.replace(/\s+/g, " ")
|
||||
.trim();
|
||||
const releaseDate = loadedCheerio(this)
|
||||
.find("a span")
|
||||
.first()
|
||||
.next()
|
||||
.text();
|
||||
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 result = yield (0, fetch_1.fetchApi)(chapterUrl, {}, pluginId);
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
const chapterText = loadedCheerio(".readers").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();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio(".flexbox2-item").each(function () {
|
||||
const novelName = loadedCheerio(this)
|
||||
.find(".flexbox2-title span")
|
||||
.first()
|
||||
.text();
|
||||
const novelCover = loadedCheerio(this).find("img").attr("src");
|
||||
const novelUrl = loadedCheerio(this)
|
||||
.find(".flexbox2-content > a")
|
||||
.attr("href");
|
||||
if (!novelUrl)
|
||||
return;
|
||||
const novel = { name: novelName, cover: novelCover, url: novelUrl };
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.searchNovels = searchNovels;
|
||||
exports.fetchImage = fetch_1.fetchFile;
|
||||
@@ -0,0 +1,202 @@
|
||||
"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");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
// const novelStatus = require('@libs/novelStatus');
|
||||
// const isUrlAbsolute = require('@libs/isAbsoluteUrl');
|
||||
// const parseDate = require('@libs/parseDate');
|
||||
const pluginId = "yomou.syosetu";
|
||||
exports.id = pluginId;
|
||||
exports.name = "Syosetu";
|
||||
exports.icon = "src/jp/syosetu/icon.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https//yomou.syosetu.com/";
|
||||
exports.protected = false;
|
||||
const searchUrl = (pagenum, order) => {
|
||||
return `https://yomou.syosetu.com/search.php?order=${order || "hyoka"}${pagenum !== undefined
|
||||
? `&p=${pagenum <= 1 || pagenum > 100 ? "1" : pagenum}` // check if pagenum is between 1 and 100
|
||||
: "" // if isn't don't set ?p
|
||||
}`;
|
||||
};
|
||||
const popularNovels = function (pageNo) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
function getNovelsFromPage(pagenumber) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// load page
|
||||
const result = yield (0, fetch_1.fetchApi)(searchUrl(pagenumber));
|
||||
const body = yield result.text();
|
||||
// Cheerio it!
|
||||
const cheerioQuery = (0, cheerio_1.load)(body, { decodeEntities: false });
|
||||
let pageNovels = [];
|
||||
// find class=searchkekka_box
|
||||
cheerioQuery(".searchkekka_box").each(function (i, e) {
|
||||
// get div with link and name
|
||||
const novelDIV = cheerioQuery(this).find(".novel_h");
|
||||
// get link element
|
||||
const novelA = novelDIV.children()[0];
|
||||
// add new novel to array
|
||||
pageNovels.push({
|
||||
name: novelDIV.text(),
|
||||
url: novelA.attribs.href,
|
||||
cover: defaultCover_1.defaultCover,
|
||||
});
|
||||
});
|
||||
// return all novels from this page
|
||||
return pageNovels;
|
||||
});
|
||||
}
|
||||
const novels = yield getNovelsFromPage(pageNo);
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let chapters = [];
|
||||
const result = yield (0, fetch_1.fetchApi)(novelUrl);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body, { decodeEntities: false });
|
||||
// create novel object
|
||||
let novel = {
|
||||
url: novelUrl,
|
||||
name: loadedCheerio(".novel_title").text(),
|
||||
author: loadedCheerio(".novel_writername")
|
||||
.text()
|
||||
.replace("作者:", ""),
|
||||
cover: defaultCover_1.defaultCover,
|
||||
};
|
||||
// Get all the chapters
|
||||
const cqGetChapters = loadedCheerio(".novel_sublist2");
|
||||
if (cqGetChapters.length !== 0) {
|
||||
// has more than 1 chapter
|
||||
novel.summary = loadedCheerio("#novel_ex")
|
||||
.text()
|
||||
.replace(/<\s*br.*?>/g, "\n");
|
||||
cqGetChapters.each(function (i, e) {
|
||||
const chapterA = loadedCheerio(this).find("a");
|
||||
const [chapterName, releaseDate, chapterUrl] = [
|
||||
// set the variables
|
||||
chapterA.text(),
|
||||
loadedCheerio(this)
|
||||
.find("dt") // get title
|
||||
.text() // get text
|
||||
.replace(/(.)/g, "") // remove "(edited)" mark
|
||||
.trim(),
|
||||
"https://ncode.syosetu.com" + chapterA.attr("href"),
|
||||
];
|
||||
chapters.push({
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
});
|
||||
});
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Because there are oneshots on the site, they have to be treated with special care
|
||||
* that's what pisses me off in Shosetsu app. They have this extension,
|
||||
* but every oneshot is set as "there are no chapters" and all contents are thrown into the description!!
|
||||
*/
|
||||
// get summary for oneshot chapter
|
||||
const nameResult = yield (0, fetch_1.fetchApi)(searchUrl() + `&word=${novel.name}`);
|
||||
const nameBody = yield nameResult.text();
|
||||
const summaryQuery = (0, cheerio_1.load)(nameBody, {
|
||||
decodeEntities: false,
|
||||
});
|
||||
const foundText = summaryQuery(".searchkekka_box")
|
||||
.first()
|
||||
.find(".ex")
|
||||
.text()
|
||||
.replace(/\s{2,}/g, "\n");
|
||||
novel.summary = foundText;
|
||||
// add single chapter
|
||||
chapters.push({
|
||||
name: "Oneshot",
|
||||
releaseTime: loadedCheerio("head")
|
||||
.find("meta[name='WWWC']")
|
||||
.attr("content"),
|
||||
url: novelUrl, // set chapterUrl to oneshot so that chapterScraper knows it's a one-shot,
|
||||
});
|
||||
}
|
||||
novel.chapters = chapters;
|
||||
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();
|
||||
// create cheerioQuery
|
||||
const cheerioQuery = (0, cheerio_1.load)(body, {
|
||||
decodeEntities: false,
|
||||
});
|
||||
let chapterText = cheerioQuery("#novel_honbun") // get chapter text
|
||||
.html();
|
||||
return chapterText;
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = function (searchTerm) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let novels = [];
|
||||
// returns list of novels from given page
|
||||
function getNovelsFromPage(pagenumber) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// load page
|
||||
const result = yield (0, fetch_1.fetchApi)(searchUrl(pagenumber) + `&word=${searchTerm}`);
|
||||
const body = yield result.text();
|
||||
// Cheerio it!
|
||||
const cheerioQuery = (0, cheerio_1.load)(body, { decodeEntities: false });
|
||||
let pageNovels = [];
|
||||
// find class=searchkekka_box
|
||||
cheerioQuery(".searchkekka_box").each(function (i, e) {
|
||||
// get div with link and name
|
||||
const novelDIV = cheerioQuery(this).find(".novel_h");
|
||||
// get link element
|
||||
const novelA = novelDIV.children()[0];
|
||||
// add new novel to array
|
||||
pageNovels.push({
|
||||
name: novelDIV.text(),
|
||||
url: novelA.attribs.href,
|
||||
cover: defaultCover_1.defaultCover,
|
||||
});
|
||||
});
|
||||
// return all novels from this page
|
||||
return pageNovels;
|
||||
});
|
||||
}
|
||||
// counter of loaded pages
|
||||
// let pagesLoaded = 0;
|
||||
// do {
|
||||
// // always load first one
|
||||
// novels.push(...(await getNovelsFromPage(pagesLoaded + 1)));
|
||||
// pagesLoaded++;
|
||||
// } while (pagesLoaded < maxPageLoad && isNext); // check if we should load more
|
||||
novels = yield getNovelsFromPage(1);
|
||||
/** Use
|
||||
* novels.push(...(await getNovelsFromPage(pageNumber)))
|
||||
* if you want to load more
|
||||
*/
|
||||
// respond with novels!
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = function (url) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return yield (0, fetch_1.fetchFile)(url);
|
||||
});
|
||||
};
|
||||
exports.fetchImage = fetchImage;
|
||||
@@ -0,0 +1,301 @@
|
||||
"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 = "lightnovelbrasil";
|
||||
exports.name = "Light Novel Brasil";
|
||||
exports.version = "1.0.0";
|
||||
exports.icon = "multisrc/wpmangastream/icons/lightnovelbrasil.png";
|
||||
exports.site = "https://lightnovelbrasil.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.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 (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(".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, {}, pluginId);
|
||||
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 = `${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.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: 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: "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,
|
||||
},
|
||||
];
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,213 @@
|
||||
"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.filters = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
// import { parseMadaraDate } from "@libs/parseMadaraDate";
|
||||
// import { isUrlAbsolute } from '@libs/isAbsoluteUrl';
|
||||
// import { showToast } from "@libs/showToast";
|
||||
const filterInputs_1 = require("@libs/filterInputs");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
exports.id = "axel.znovel";
|
||||
exports.name = "Аксел";
|
||||
exports.icon = "";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://axel.znovel.space";
|
||||
exports.filters = [{ "key": "tags", "label": "Тэги", "values": [{ "label": "Богини", "value": 316 }, { "label": "Везучий главный герой", "value": 411 }, { "label": "Виртуальная реальность", "value": 744 }, { "label": "Высокомерный герой", "value": 56 }, { "label": "Герой-извращенец", "value": 521 }, { "label": "Главная героиня — женщина", "value": 277 }, { "label": "Главный герой — мужчина", "value": 419 }, { "label": "Дворяне", "value": 487 }, { "label": "Девочки-волшебницы", "value": 415 }, { "label": "Демоны", "value": 193 }, { "label": "Дружба", "value": 293 }, { "label": "Есть аниме-адаптация", "value": 10 }, { "label": "Есть видеоигра", "value": 13 }, { "label": "Есть манга-адаптация", "value": 14 }, { "label": "Игра на выживание", "value": 696 }, { "label": "Из грязи в князи", "value": 542 }, { "label": "Королевская особа", "value": 596 }, { "label": "Ленивый главный герой", "value": 389 }, { "label": "Маги", "value": 757 }, { "label": "Магические технологии", "value": 417 }], "inputType": filterInputs_1.FilterInputs.Checkbox }];
|
||||
exports["protected"] = false;
|
||||
const baseUrl = exports.site;
|
||||
const domain = baseUrl.split('//')[1];
|
||||
const popularNovels = function (page, { filters }) {
|
||||
var _a, _b, _c, _d, _e;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Projects',
|
||||
query: 'query Projects($hostname:String! $filter:SearchFilter $page:Int $limit:Int){projects(section:{fullUrl:$hostname}filter:$filter page:{pageSize:$limit,pageNumber:$page}){content{title url covers{url}}}}',
|
||||
variables: {
|
||||
filter: ((_b = (_a = filters === null || filters === void 0 ? void 0 : filters.tags) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0 > 0) ? { tags: filters === null || filters === void 0 ? void 0 : filters.tags } : {},
|
||||
hostname: domain,
|
||||
limit: 40,
|
||||
page,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novels = (_e = (_d = (_c = json.data) === null || _c === void 0 ? void 0 : _c.projects) === null || _d === void 0 ? void 0 : _d.content) === null || _e === void 0 ? void 0 : _e.map((novel) => {
|
||||
var _a;
|
||||
return ({
|
||||
name: novel.title,
|
||||
url: baseUrl + '/r/' + novel.url,
|
||||
cover: ((_a = novel.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + novel.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
});
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
var _a, _b;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Book',
|
||||
query: 'query Book($url:String){project(project:{fullUrl:$url}){title translationStatus url covers{url}persons(langs:["ru","en","*"]roles:["author","illustrator","original_story","original_design"]){role name{firstName lastName}}genres{nameRu nameEng}tags{nameRu nameEng}annotation{text}subprojects{content{title volumes{content{url shortName chapters{title publishDate url published}}}}}}}',
|
||||
variables: {
|
||||
hostname: domain,
|
||||
project: novelUrl,
|
||||
url: novelUrl,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
name: json.data.project.title,
|
||||
cover: ((_a = json.data.project.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + json.data.project.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
summary: (0, cheerio_1.load)((_b = json.data.project.annotation) === null || _b === void 0 ? void 0 : _b.text).text(),
|
||||
author: json.data.project.persons[0].name.firstName +
|
||||
' ' +
|
||||
json.data.project.persons[0].name.lastName,
|
||||
status: json.data.project.translationStatus === 'active'
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed,
|
||||
};
|
||||
let genres = []
|
||||
.concat(json.data.project.tags, json.data.project.genres)
|
||||
.map((item) => (item === null || item === void 0 ? void 0 : item.nameRu) || (item === null || item === void 0 ? void 0 : item.nameEng))
|
||||
.filter(item => item);
|
||||
if (genres.length > 0) {
|
||||
novel.genres = genres.join(',');
|
||||
}
|
||||
let novelChapters = [];
|
||||
json.data.project.subprojects.content.forEach((work) => work.volumes.content.forEach((volume) => volume.chapters.forEach((chapter) => (chapter === null || chapter === void 0 ? void 0 : chapter.published) &&
|
||||
novelChapters.push({
|
||||
name: volume.shortName + ' ' + chapter.title,
|
||||
url: novelUrl + '/' + volume.url + '/' + chapter.url,
|
||||
releaseTime: (0, dayjs_1.default)(chapter.publishDate).format('LLL'),
|
||||
}))));
|
||||
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)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'EReaderData',
|
||||
query: 'query EReaderData($url:String!,$chapterSelector:Selector!){project(project:{fullUrl:$url}){title url}chapter(chapter:$chapterSelector){title text{text}}}',
|
||||
variables: {
|
||||
chapterSelector: {
|
||||
fullUrl: chapterUrl,
|
||||
},
|
||||
url: chapterUrl,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
return (0, cheerio_1.load)(json.data.chapter.text.text).html();
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
var _a, _b, _c;
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Projects',
|
||||
query: 'query Projects($hostname:String! $filter:SearchFilter $page:Int $limit:Int){projects(section:{fullUrl:$hostname}filter:$filter page:{pageSize:$limit,pageNumber:$page}){content{title url covers{url}}}}',
|
||||
variables: {
|
||||
filter: {
|
||||
query: searchTerm,
|
||||
},
|
||||
hostname: domain,
|
||||
limit: 40,
|
||||
page: 1,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novels = [];
|
||||
(_c = (_b = (_a = json === null || json === void 0 ? void 0 : json.data) === null || _a === void 0 ? void 0 : _a.projects) === null || _b === void 0 ? void 0 : _b.content) === null || _c === void 0 ? void 0 : _c.forEach((novel) => {
|
||||
var _a;
|
||||
return novels.push({
|
||||
name: novel.title,
|
||||
url: baseUrl + '/r/' + novel.url,
|
||||
cover: ((_a = novel.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + novel.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
});
|
||||
});
|
||||
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,209 @@
|
||||
"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.filters = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
exports.id = "bel.novel";
|
||||
exports.name = "Белманга";
|
||||
exports.icon = "";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://bel.novel.tl";
|
||||
exports.filters = [];
|
||||
exports["protected"] = false;
|
||||
const baseUrl = exports.site;
|
||||
const domain = baseUrl.split('//')[1];
|
||||
const popularNovels = function (page, { filters }) {
|
||||
var _a, _b, _c, _d, _e;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Projects',
|
||||
query: 'query Projects($hostname:String! $filter:SearchFilter $page:Int $limit:Int){projects(section:{fullUrl:$hostname}filter:$filter page:{pageSize:$limit,pageNumber:$page}){content{title url covers{url}}}}',
|
||||
variables: {
|
||||
filter: ((_b = (_a = filters === null || filters === void 0 ? void 0 : filters.tags) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0 > 0) ? { tags: filters === null || filters === void 0 ? void 0 : filters.tags } : {},
|
||||
hostname: domain,
|
||||
limit: 40,
|
||||
page,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novels = (_e = (_d = (_c = json.data) === null || _c === void 0 ? void 0 : _c.projects) === null || _d === void 0 ? void 0 : _d.content) === null || _e === void 0 ? void 0 : _e.map((novel) => {
|
||||
var _a;
|
||||
return ({
|
||||
name: novel.title,
|
||||
url: baseUrl + '/r/' + novel.url,
|
||||
cover: ((_a = novel.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + novel.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
});
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
var _a, _b;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Book',
|
||||
query: 'query Book($url:String){project(project:{fullUrl:$url}){title translationStatus url covers{url}persons(langs:["ru","en","*"]roles:["author","illustrator","original_story","original_design"]){role name{firstName lastName}}genres{nameRu nameEng}tags{nameRu nameEng}annotation{text}subprojects{content{title volumes{content{url shortName chapters{title publishDate url published}}}}}}}',
|
||||
variables: {
|
||||
hostname: domain,
|
||||
project: novelUrl,
|
||||
url: novelUrl,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
name: json.data.project.title,
|
||||
cover: ((_a = json.data.project.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + json.data.project.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
summary: (0, cheerio_1.load)((_b = json.data.project.annotation) === null || _b === void 0 ? void 0 : _b.text).text(),
|
||||
author: json.data.project.persons[0].name.firstName +
|
||||
' ' +
|
||||
json.data.project.persons[0].name.lastName,
|
||||
status: json.data.project.translationStatus === 'active'
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed,
|
||||
};
|
||||
let genres = []
|
||||
.concat(json.data.project.tags, json.data.project.genres)
|
||||
.map((item) => (item === null || item === void 0 ? void 0 : item.nameRu) || (item === null || item === void 0 ? void 0 : item.nameEng))
|
||||
.filter(item => item);
|
||||
if (genres.length > 0) {
|
||||
novel.genres = genres.join(',');
|
||||
}
|
||||
let novelChapters = [];
|
||||
json.data.project.subprojects.content.forEach((work) => work.volumes.content.forEach((volume) => volume.chapters.forEach((chapter) => (chapter === null || chapter === void 0 ? void 0 : chapter.published) &&
|
||||
novelChapters.push({
|
||||
name: volume.shortName + ' ' + chapter.title,
|
||||
url: novelUrl + '/' + volume.url + '/' + chapter.url,
|
||||
releaseTime: (0, dayjs_1.default)(chapter.publishDate).format('LLL'),
|
||||
}))));
|
||||
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)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'EReaderData',
|
||||
query: 'query EReaderData($url:String!,$chapterSelector:Selector!){project(project:{fullUrl:$url}){title url}chapter(chapter:$chapterSelector){title text{text}}}',
|
||||
variables: {
|
||||
chapterSelector: {
|
||||
fullUrl: chapterUrl,
|
||||
},
|
||||
url: chapterUrl,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
return (0, cheerio_1.load)(json.data.chapter.text.text).html();
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
var _a, _b, _c;
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Projects',
|
||||
query: 'query Projects($hostname:String! $filter:SearchFilter $page:Int $limit:Int){projects(section:{fullUrl:$hostname}filter:$filter page:{pageSize:$limit,pageNumber:$page}){content{title url covers{url}}}}',
|
||||
variables: {
|
||||
filter: {
|
||||
query: searchTerm,
|
||||
},
|
||||
hostname: domain,
|
||||
limit: 40,
|
||||
page: 1,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novels = [];
|
||||
(_c = (_b = (_a = json === null || json === void 0 ? void 0 : json.data) === null || _a === void 0 ? void 0 : _a.projects) === null || _b === void 0 ? void 0 : _b.content) === null || _c === void 0 ? void 0 : _c.forEach((novel) => {
|
||||
var _a;
|
||||
return novels.push({
|
||||
name: novel.title,
|
||||
url: baseUrl + '/r/' + novel.url,
|
||||
cover: ((_a = novel.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + novel.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
});
|
||||
});
|
||||
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,210 @@
|
||||
"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.filters = 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 novelStatus_1 = require("@libs/novelStatus");
|
||||
const filterInputs_1 = require("@libs/filterInputs");
|
||||
exports.id = "jaomix.ru";
|
||||
exports.name = "Jaomix";
|
||||
exports.site = "https://jaomix.ru";
|
||||
exports.version = "1.0.0";
|
||||
exports.icon = "src/ru/jaomix/icon.png";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = function (page, { showLatestNovels, filters }) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let url = baseUrl + "/?searchrn&sortby=";
|
||||
url += showLatestNovels ? "upd" : (filters === null || filters === void 0 ? void 0 : filters.sort) || "count";
|
||||
if (filters) {
|
||||
if (Array.isArray(filters.type) && filters.type.length) {
|
||||
url += filters.type.map((i) => `&lang[]=${i}`).join("");
|
||||
}
|
||||
if (Array.isArray(filters.genres) && filters.genres.length) {
|
||||
url += filters.genres.map((i) => `&genre[]=${i}`).join("");
|
||||
}
|
||||
}
|
||||
url += `&page=${page}`;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
let body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio('div[class="block-home"] > div[class="one"]').each(function () {
|
||||
var _a;
|
||||
const name = loadedCheerio(this)
|
||||
.find('div[class="img-home"] > a')
|
||||
.attr("title");
|
||||
const cover = (_a = loadedCheerio(this)
|
||||
.find('div[class="img-home"] > a > img')
|
||||
.attr("src")) === null || _a === void 0 ? void 0 : _a.replace("-150x150", "");
|
||||
const url = loadedCheerio(this)
|
||||
.find('div[class="img-home"] > a')
|
||||
.attr("href");
|
||||
if (!name || !url)
|
||||
return;
|
||||
novels.push({ name, cover, url });
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
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();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
novel.name = loadedCheerio('div[class="desc-book"] > h1').text().trim();
|
||||
novel.cover = loadedCheerio('div[class="img-book"] > img').attr("src");
|
||||
novel.summary = loadedCheerio('div[id="desc-tab"]').text().trim();
|
||||
loadedCheerio("#info-book > p").each(function () {
|
||||
let text = loadedCheerio(this).text().replace(/,/g, "").split(" ");
|
||||
if (text[0] === "Автор:") {
|
||||
novel.author = text.splice(1).join(" ");
|
||||
}
|
||||
else if (text[0] === "Жанры:") {
|
||||
novel.genres = text.splice(1).join(",");
|
||||
}
|
||||
else if (text[0] === "Статус:") {
|
||||
novel.status = text.includes("продолжается")
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
}
|
||||
});
|
||||
const chapters = [];
|
||||
loadedCheerio(".download-chapter div.title").each(function () {
|
||||
chapters.push({
|
||||
name: loadedCheerio(this).find("a").attr("title"),
|
||||
releaseTime: loadedCheerio(this).find("time").text(),
|
||||
url: loadedCheerio(this).find("a").attr("href"),
|
||||
});
|
||||
});
|
||||
novel.chapters = chapters.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);
|
||||
loadedCheerio('div[class="adblock-service"]').remove();
|
||||
const chapterText = loadedCheerio('div[class="entry-content"]').html();
|
||||
return chapterText;
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = function (searchTerm) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = `${baseUrl}/?searchrn=${searchTerm}&but=Поиск по названию&sortby=upd`;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
let body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio('div[class="block-home"] > div[class="one"]').each(function () {
|
||||
var _a;
|
||||
const name = loadedCheerio(this)
|
||||
.find('div[class="img-home"] > a')
|
||||
.attr("title");
|
||||
const cover = (_a = loadedCheerio(this)
|
||||
.find('div[class="img-home"] > a > img')
|
||||
.attr("src")) === null || _a === void 0 ? void 0 : _a.replace("-150x150", "");
|
||||
const url = loadedCheerio(this)
|
||||
.find('div[class="img-home"] > a')
|
||||
.attr("href");
|
||||
if (!name || !url)
|
||||
return;
|
||||
novels.push({ name, cover, url });
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.searchNovels = searchNovels;
|
||||
exports.filters = [
|
||||
{
|
||||
key: "sort",
|
||||
label: "Сортировка",
|
||||
values: [
|
||||
{ label: "Имя", value: "alphabet" },
|
||||
{ label: "Просмотры", value: "count" },
|
||||
{ label: "Дате добавления", value: "new" },
|
||||
{ label: "Дате обновления", value: "upd" },
|
||||
],
|
||||
inputType: filterInputs_1.FilterInputs.Picker,
|
||||
},
|
||||
{
|
||||
key: "type",
|
||||
label: "Тип",
|
||||
values: [
|
||||
{ label: "Английский", value: "Английский" },
|
||||
{ label: "Китайский", value: "Китайский" },
|
||||
{ label: "Корейский", value: "Корейский" },
|
||||
{ label: "Японский", value: "Японский" },
|
||||
],
|
||||
inputType: filterInputs_1.FilterInputs.Checkbox,
|
||||
},
|
||||
{
|
||||
key: "genres",
|
||||
label: "Жанры",
|
||||
values: [
|
||||
{ label: "Боевые Искусства", value: "Боевые Искусства" },
|
||||
{ label: "Виртуальный Мир", value: "Виртуальный Мир" },
|
||||
{ label: "Гарем", value: "Гарем" },
|
||||
{ label: "Детектив", value: "Детектив" },
|
||||
{ label: "Драма", value: "Драма" },
|
||||
{ label: "Игра", value: "Игра" },
|
||||
{ label: "Истории из жизни", value: "Истории из жизни" },
|
||||
{ label: "Исторический", value: "Исторический" },
|
||||
{ label: "История", value: "История" },
|
||||
{ label: "Исэкай", value: "Исэкай" },
|
||||
{ label: "Комедия", value: "Комедия" },
|
||||
{ label: "Меха", value: "Меха" },
|
||||
{ label: "Мистика", value: "Мистика" },
|
||||
{ label: "Научная Фантастика", value: "Научная Фантастика" },
|
||||
{ label: "Повседневность", value: "Повседневность" },
|
||||
{ label: "Постапокалипсис", value: "Постапокалипсис" },
|
||||
{ label: "Приключения", value: "Приключения" },
|
||||
{ label: "Психология", value: "Психология" },
|
||||
{ label: "Романтика", value: "Романтика" },
|
||||
{ label: "Сверхъестественное", value: "Сверхъестественное" },
|
||||
{ label: "Сёнэн", value: "Сёнэн" },
|
||||
{ label: "Сёнэн-ай", value: "Сёнэн-ай" },
|
||||
{ label: "Спорт", value: "Спорт" },
|
||||
{ label: "Сэйнэн", value: "Сэйнэн" },
|
||||
{ label: "Сюаньхуа", value: "Сюаньхуа" },
|
||||
{ label: "Трагедия", value: "Трагедия" },
|
||||
{ label: "Триллер", value: "Триллер" },
|
||||
{ label: "Фантастика", value: "Фантастика" },
|
||||
{ label: "Фэнтези", value: "Фэнтези" },
|
||||
{ label: "Хоррор", value: "Хоррор" },
|
||||
{ label: "Школьная жизнь", value: "Школьная жизнь" },
|
||||
{ label: "Шоунен", value: "Шоунен" },
|
||||
{ label: "Экшн", value: "Экшн" },
|
||||
{ label: "Этти", value: "Этти" },
|
||||
{ label: "Юри", value: "Юри" },
|
||||
{ label: "Adult", value: "Adult" },
|
||||
{ label: "Ecchi", value: "Ecchi" },
|
||||
{ label: "Josei", value: "Josei" },
|
||||
{ label: "Lolicon", value: "Lolicon" },
|
||||
{ label: "Mature", value: "Mature" },
|
||||
{ label: "Shoujo", value: "Shoujo" },
|
||||
{ label: "Wuxia", value: "Wuxia" },
|
||||
{ label: "Xianxia", value: "Xianxia" },
|
||||
{ label: "Xuanhuan", value: "Xuanhuan" },
|
||||
{ label: "Yaoi", value: "Yaoi" },
|
||||
],
|
||||
inputType: filterInputs_1.FilterInputs.Checkbox,
|
||||
},
|
||||
];
|
||||
exports.fetchImage = fetch_1.fetchFile;
|
||||
@@ -0,0 +1,213 @@
|
||||
"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.filters = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
// import { parseMadaraDate } from "@libs/parseMadaraDate";
|
||||
// import { isUrlAbsolute } from '@libs/isAbsoluteUrl';
|
||||
// import { showToast } from "@libs/showToast";
|
||||
const filterInputs_1 = require("@libs/filterInputs");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
exports.id = "japit.novel";
|
||||
exports.name = "Japit Comics";
|
||||
exports.icon = "";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://japit.novel.tl";
|
||||
exports.filters = [{ "key": "tags", "label": "Тэги", "values": [{ "label": "Академия", "value": 5 }, { "label": "Андроиды", "value": 37 }, { "label": "Беззаботный герой", "value": 115 }, { "label": "Боги", "value": 318 }, { "label": "Богини", "value": 316 }, { "label": "Вампиры", "value": 742 }, { "label": "Везучий главный герой", "value": 411 }, { "label": "Влияние прошлого", "value": 517 }, { "label": "Внезапное обогащение", "value": 691 }, { "label": "Военные хроники", "value": 749 }, { "label": "Война", "value": 750 }, { "label": "Воспоминания прошлого", "value": 283 }, { "label": "Герои", "value": 341 }, { "label": "Героиня красавица", "value": 81 }, { "label": "Герой влюбляется первым", "value": 561 }, { "label": "Герой красавец", "value": 329 }, { "label": "Герой-бесстыдник", "value": 632 }, { "label": "Герой-извращенец", "value": 521 }, { "label": "Герой-трудяга", "value": 330 }, { "label": "R-15", "value": 570 }], "inputType": filterInputs_1.FilterInputs.Checkbox }];
|
||||
exports["protected"] = false;
|
||||
const baseUrl = exports.site;
|
||||
const domain = baseUrl.split('//')[1];
|
||||
const popularNovels = function (page, { filters }) {
|
||||
var _a, _b, _c, _d, _e;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Projects',
|
||||
query: 'query Projects($hostname:String! $filter:SearchFilter $page:Int $limit:Int){projects(section:{fullUrl:$hostname}filter:$filter page:{pageSize:$limit,pageNumber:$page}){content{title url covers{url}}}}',
|
||||
variables: {
|
||||
filter: ((_b = (_a = filters === null || filters === void 0 ? void 0 : filters.tags) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0 > 0) ? { tags: filters === null || filters === void 0 ? void 0 : filters.tags } : {},
|
||||
hostname: domain,
|
||||
limit: 40,
|
||||
page,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novels = (_e = (_d = (_c = json.data) === null || _c === void 0 ? void 0 : _c.projects) === null || _d === void 0 ? void 0 : _d.content) === null || _e === void 0 ? void 0 : _e.map((novel) => {
|
||||
var _a;
|
||||
return ({
|
||||
name: novel.title,
|
||||
url: baseUrl + '/r/' + novel.url,
|
||||
cover: ((_a = novel.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + novel.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
});
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
var _a, _b;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Book',
|
||||
query: 'query Book($url:String){project(project:{fullUrl:$url}){title translationStatus url covers{url}persons(langs:["ru","en","*"]roles:["author","illustrator","original_story","original_design"]){role name{firstName lastName}}genres{nameRu nameEng}tags{nameRu nameEng}annotation{text}subprojects{content{title volumes{content{url shortName chapters{title publishDate url published}}}}}}}',
|
||||
variables: {
|
||||
hostname: domain,
|
||||
project: novelUrl,
|
||||
url: novelUrl,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
name: json.data.project.title,
|
||||
cover: ((_a = json.data.project.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + json.data.project.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
summary: (0, cheerio_1.load)((_b = json.data.project.annotation) === null || _b === void 0 ? void 0 : _b.text).text(),
|
||||
author: json.data.project.persons[0].name.firstName +
|
||||
' ' +
|
||||
json.data.project.persons[0].name.lastName,
|
||||
status: json.data.project.translationStatus === 'active'
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed,
|
||||
};
|
||||
let genres = []
|
||||
.concat(json.data.project.tags, json.data.project.genres)
|
||||
.map((item) => (item === null || item === void 0 ? void 0 : item.nameRu) || (item === null || item === void 0 ? void 0 : item.nameEng))
|
||||
.filter(item => item);
|
||||
if (genres.length > 0) {
|
||||
novel.genres = genres.join(',');
|
||||
}
|
||||
let novelChapters = [];
|
||||
json.data.project.subprojects.content.forEach((work) => work.volumes.content.forEach((volume) => volume.chapters.forEach((chapter) => (chapter === null || chapter === void 0 ? void 0 : chapter.published) &&
|
||||
novelChapters.push({
|
||||
name: volume.shortName + ' ' + chapter.title,
|
||||
url: novelUrl + '/' + volume.url + '/' + chapter.url,
|
||||
releaseTime: (0, dayjs_1.default)(chapter.publishDate).format('LLL'),
|
||||
}))));
|
||||
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)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'EReaderData',
|
||||
query: 'query EReaderData($url:String!,$chapterSelector:Selector!){project(project:{fullUrl:$url}){title url}chapter(chapter:$chapterSelector){title text{text}}}',
|
||||
variables: {
|
||||
chapterSelector: {
|
||||
fullUrl: chapterUrl,
|
||||
},
|
||||
url: chapterUrl,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
return (0, cheerio_1.load)(json.data.chapter.text.text).html();
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
var _a, _b, _c;
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Projects',
|
||||
query: 'query Projects($hostname:String! $filter:SearchFilter $page:Int $limit:Int){projects(section:{fullUrl:$hostname}filter:$filter page:{pageSize:$limit,pageNumber:$page}){content{title url covers{url}}}}',
|
||||
variables: {
|
||||
filter: {
|
||||
query: searchTerm,
|
||||
},
|
||||
hostname: domain,
|
||||
limit: 40,
|
||||
page: 1,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novels = [];
|
||||
(_c = (_b = (_a = json === null || json === void 0 ? void 0 : json.data) === null || _a === void 0 ? void 0 : _a.projects) === null || _b === void 0 ? void 0 : _b.content) === null || _c === void 0 ? void 0 : _c.forEach((novel) => {
|
||||
var _a;
|
||||
return novels.push({
|
||||
name: novel.title,
|
||||
url: baseUrl + '/r/' + novel.url,
|
||||
cover: ((_a = novel.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + novel.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
});
|
||||
});
|
||||
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,213 @@
|
||||
"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.filters = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
// import { parseMadaraDate } from "@libs/parseMadaraDate";
|
||||
// import { isUrlAbsolute } from '@libs/isAbsoluteUrl';
|
||||
// import { showToast } from "@libs/showToast";
|
||||
const filterInputs_1 = require("@libs/filterInputs");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
exports.id = "kg.novel";
|
||||
exports.name = "Карманная галактика";
|
||||
exports.icon = "";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://kg.novel.tl";
|
||||
exports.filters = [{ "key": "tags", "label": "Тэги", "values": [{ "label": "Алхимия", "value": 27 }, { "label": "Андроиды", "value": 37 }, { "label": "Анти-рост персонажа", "value": 25 }, { "label": "Антигерой", "value": 43 }, { "label": "Апатичный главный герой", "value": 46 }, { "label": "Аристократия", "value": 51 }, { "label": "Асоциальный главный герой", "value": 42 }, { "label": "Ассасины", "value": 61 }, { "label": "Беззаботный герой", "value": 115 }, { "label": "Безработные", "value": 377 }, { "label": "Бессмертные", "value": 359 }, { "label": "Библиотека", "value": 393 }, { "label": "Боги", "value": 318 }, { "label": "Боевая академия", "value": 75 }, { "label": "Бывший герой", "value": 290 }, { "label": "Ведьмы", "value": 756 }, { "label": "Везучий главный герой", "value": 411 }, { "label": "Верные подданные", "value": 410 }, { "label": "Взросление персонажа", "value": 24 }, { "label": "R-15", "value": 570 }], "inputType": filterInputs_1.FilterInputs.Checkbox }];
|
||||
exports["protected"] = false;
|
||||
const baseUrl = exports.site;
|
||||
const domain = baseUrl.split('//')[1];
|
||||
const popularNovels = function (page, { filters }) {
|
||||
var _a, _b, _c, _d, _e;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Projects',
|
||||
query: 'query Projects($hostname:String! $filter:SearchFilter $page:Int $limit:Int){projects(section:{fullUrl:$hostname}filter:$filter page:{pageSize:$limit,pageNumber:$page}){content{title url covers{url}}}}',
|
||||
variables: {
|
||||
filter: ((_b = (_a = filters === null || filters === void 0 ? void 0 : filters.tags) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0 > 0) ? { tags: filters === null || filters === void 0 ? void 0 : filters.tags } : {},
|
||||
hostname: domain,
|
||||
limit: 40,
|
||||
page,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novels = (_e = (_d = (_c = json.data) === null || _c === void 0 ? void 0 : _c.projects) === null || _d === void 0 ? void 0 : _d.content) === null || _e === void 0 ? void 0 : _e.map((novel) => {
|
||||
var _a;
|
||||
return ({
|
||||
name: novel.title,
|
||||
url: baseUrl + '/r/' + novel.url,
|
||||
cover: ((_a = novel.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + novel.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
});
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
var _a, _b;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Book',
|
||||
query: 'query Book($url:String){project(project:{fullUrl:$url}){title translationStatus url covers{url}persons(langs:["ru","en","*"]roles:["author","illustrator","original_story","original_design"]){role name{firstName lastName}}genres{nameRu nameEng}tags{nameRu nameEng}annotation{text}subprojects{content{title volumes{content{url shortName chapters{title publishDate url published}}}}}}}',
|
||||
variables: {
|
||||
hostname: domain,
|
||||
project: novelUrl,
|
||||
url: novelUrl,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
name: json.data.project.title,
|
||||
cover: ((_a = json.data.project.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + json.data.project.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
summary: (0, cheerio_1.load)((_b = json.data.project.annotation) === null || _b === void 0 ? void 0 : _b.text).text(),
|
||||
author: json.data.project.persons[0].name.firstName +
|
||||
' ' +
|
||||
json.data.project.persons[0].name.lastName,
|
||||
status: json.data.project.translationStatus === 'active'
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed,
|
||||
};
|
||||
let genres = []
|
||||
.concat(json.data.project.tags, json.data.project.genres)
|
||||
.map((item) => (item === null || item === void 0 ? void 0 : item.nameRu) || (item === null || item === void 0 ? void 0 : item.nameEng))
|
||||
.filter(item => item);
|
||||
if (genres.length > 0) {
|
||||
novel.genres = genres.join(',');
|
||||
}
|
||||
let novelChapters = [];
|
||||
json.data.project.subprojects.content.forEach((work) => work.volumes.content.forEach((volume) => volume.chapters.forEach((chapter) => (chapter === null || chapter === void 0 ? void 0 : chapter.published) &&
|
||||
novelChapters.push({
|
||||
name: volume.shortName + ' ' + chapter.title,
|
||||
url: novelUrl + '/' + volume.url + '/' + chapter.url,
|
||||
releaseTime: (0, dayjs_1.default)(chapter.publishDate).format('LLL'),
|
||||
}))));
|
||||
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)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'EReaderData',
|
||||
query: 'query EReaderData($url:String!,$chapterSelector:Selector!){project(project:{fullUrl:$url}){title url}chapter(chapter:$chapterSelector){title text{text}}}',
|
||||
variables: {
|
||||
chapterSelector: {
|
||||
fullUrl: chapterUrl,
|
||||
},
|
||||
url: chapterUrl,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
return (0, cheerio_1.load)(json.data.chapter.text.text).html();
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
var _a, _b, _c;
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Projects',
|
||||
query: 'query Projects($hostname:String! $filter:SearchFilter $page:Int $limit:Int){projects(section:{fullUrl:$hostname}filter:$filter page:{pageSize:$limit,pageNumber:$page}){content{title url covers{url}}}}',
|
||||
variables: {
|
||||
filter: {
|
||||
query: searchTerm,
|
||||
},
|
||||
hostname: domain,
|
||||
limit: 40,
|
||||
page: 1,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novels = [];
|
||||
(_c = (_b = (_a = json === null || json === void 0 ? void 0 : json.data) === null || _a === void 0 ? void 0 : _a.projects) === null || _b === void 0 ? void 0 : _b.content) === null || _c === void 0 ? void 0 : _c.forEach((novel) => {
|
||||
var _a;
|
||||
return novels.push({
|
||||
name: novel.title,
|
||||
url: baseUrl + '/r/' + novel.url,
|
||||
cover: ((_a = novel.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + novel.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
});
|
||||
});
|
||||
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,213 @@
|
||||
"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.filters = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
// import { parseMadaraDate } from "@libs/parseMadaraDate";
|
||||
// import { isUrlAbsolute } from '@libs/isAbsoluteUrl';
|
||||
// import { showToast } from "@libs/showToast";
|
||||
const filterInputs_1 = require("@libs/filterInputs");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
exports.id = "kod.novel";
|
||||
exports.name = "K.O.D.";
|
||||
exports.icon = "";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://kod.novel.tl";
|
||||
exports.filters = [{ "key": "tags", "label": "Тэги", "values": [{ "label": "Актёрское искусство", "value": 7 }, { "label": "Забота о детях", "value": 127 }, { "label": "Управление бизнесом", "value": 109 }, { "label": "Шоу-бизнес", "value": 642 }], "inputType": filterInputs_1.FilterInputs.Checkbox }];
|
||||
exports["protected"] = false;
|
||||
const baseUrl = exports.site;
|
||||
const domain = baseUrl.split('//')[1];
|
||||
const popularNovels = function (page, { filters }) {
|
||||
var _a, _b, _c, _d, _e;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Projects',
|
||||
query: 'query Projects($hostname:String! $filter:SearchFilter $page:Int $limit:Int){projects(section:{fullUrl:$hostname}filter:$filter page:{pageSize:$limit,pageNumber:$page}){content{title url covers{url}}}}',
|
||||
variables: {
|
||||
filter: ((_b = (_a = filters === null || filters === void 0 ? void 0 : filters.tags) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0 > 0) ? { tags: filters === null || filters === void 0 ? void 0 : filters.tags } : {},
|
||||
hostname: domain,
|
||||
limit: 40,
|
||||
page,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novels = (_e = (_d = (_c = json.data) === null || _c === void 0 ? void 0 : _c.projects) === null || _d === void 0 ? void 0 : _d.content) === null || _e === void 0 ? void 0 : _e.map((novel) => {
|
||||
var _a;
|
||||
return ({
|
||||
name: novel.title,
|
||||
url: baseUrl + '/r/' + novel.url,
|
||||
cover: ((_a = novel.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + novel.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
});
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
var _a, _b;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Book',
|
||||
query: 'query Book($url:String){project(project:{fullUrl:$url}){title translationStatus url covers{url}persons(langs:["ru","en","*"]roles:["author","illustrator","original_story","original_design"]){role name{firstName lastName}}genres{nameRu nameEng}tags{nameRu nameEng}annotation{text}subprojects{content{title volumes{content{url shortName chapters{title publishDate url published}}}}}}}',
|
||||
variables: {
|
||||
hostname: domain,
|
||||
project: novelUrl,
|
||||
url: novelUrl,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
name: json.data.project.title,
|
||||
cover: ((_a = json.data.project.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + json.data.project.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
summary: (0, cheerio_1.load)((_b = json.data.project.annotation) === null || _b === void 0 ? void 0 : _b.text).text(),
|
||||
author: json.data.project.persons[0].name.firstName +
|
||||
' ' +
|
||||
json.data.project.persons[0].name.lastName,
|
||||
status: json.data.project.translationStatus === 'active'
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed,
|
||||
};
|
||||
let genres = []
|
||||
.concat(json.data.project.tags, json.data.project.genres)
|
||||
.map((item) => (item === null || item === void 0 ? void 0 : item.nameRu) || (item === null || item === void 0 ? void 0 : item.nameEng))
|
||||
.filter(item => item);
|
||||
if (genres.length > 0) {
|
||||
novel.genres = genres.join(',');
|
||||
}
|
||||
let novelChapters = [];
|
||||
json.data.project.subprojects.content.forEach((work) => work.volumes.content.forEach((volume) => volume.chapters.forEach((chapter) => (chapter === null || chapter === void 0 ? void 0 : chapter.published) &&
|
||||
novelChapters.push({
|
||||
name: volume.shortName + ' ' + chapter.title,
|
||||
url: novelUrl + '/' + volume.url + '/' + chapter.url,
|
||||
releaseTime: (0, dayjs_1.default)(chapter.publishDate).format('LLL'),
|
||||
}))));
|
||||
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)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'EReaderData',
|
||||
query: 'query EReaderData($url:String!,$chapterSelector:Selector!){project(project:{fullUrl:$url}){title url}chapter(chapter:$chapterSelector){title text{text}}}',
|
||||
variables: {
|
||||
chapterSelector: {
|
||||
fullUrl: chapterUrl,
|
||||
},
|
||||
url: chapterUrl,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
return (0, cheerio_1.load)(json.data.chapter.text.text).html();
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
var _a, _b, _c;
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Projects',
|
||||
query: 'query Projects($hostname:String! $filter:SearchFilter $page:Int $limit:Int){projects(section:{fullUrl:$hostname}filter:$filter page:{pageSize:$limit,pageNumber:$page}){content{title url covers{url}}}}',
|
||||
variables: {
|
||||
filter: {
|
||||
query: searchTerm,
|
||||
},
|
||||
hostname: domain,
|
||||
limit: 40,
|
||||
page: 1,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novels = [];
|
||||
(_c = (_b = (_a = json === null || json === void 0 ? void 0 : json.data) === null || _a === void 0 ? void 0 : _a.projects) === null || _b === void 0 ? void 0 : _b.content) === null || _c === void 0 ? void 0 : _c.forEach((novel) => {
|
||||
var _a;
|
||||
return novels.push({
|
||||
name: novel.title,
|
||||
url: baseUrl + '/r/' + novel.url,
|
||||
cover: ((_a = novel.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + novel.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
});
|
||||
});
|
||||
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,213 @@
|
||||
"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.filters = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
// import { parseMadaraDate } from "@libs/parseMadaraDate";
|
||||
// import { isUrlAbsolute } from '@libs/isAbsoluteUrl';
|
||||
// import { showToast } from "@libs/showToast";
|
||||
const filterInputs_1 = require("@libs/filterInputs");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
exports.id = "nightnovel";
|
||||
exports.name = "Nightnovel";
|
||||
exports.icon = "";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://nightnovel.online";
|
||||
exports.filters = [{ "key": "tags", "label": "Тэги", "values": [{ "label": "Альтернативная реальность", "value": 30 }, { "label": "Амнезия", "value": 31 }, { "label": "Анал", "value": 33 }, { "label": "Ангелы", "value": 38 }, { "label": "Аристократия", "value": 51 }, { "label": "Артефакты", "value": 58 }, { "label": "Ассасины", "value": 61 }, { "label": "Банды", "value": 302 }, { "label": "БДСМ", "value": 77 }, { "label": "Беременность", "value": 551 }, { "label": "Боги", "value": 318 }, { "label": "Богини", "value": 316 }, { "label": "Боевая академия", "value": 75 }, { "label": "Божественная сила", "value": 317 }, { "label": "Влияние прошлого", "value": 517 }, { "label": "Враги становятся союзниками", "value": 238 }, { "label": "Вынужденные условия проживания", "value": 287 }, { "label": "Герои", "value": 341 }, { "label": "Героиня красавица", "value": 81 }, { "label": "R-18", "value": 571 }], "inputType": filterInputs_1.FilterInputs.Checkbox }];
|
||||
exports["protected"] = false;
|
||||
const baseUrl = exports.site;
|
||||
const domain = baseUrl.split('//')[1];
|
||||
const popularNovels = function (page, { filters }) {
|
||||
var _a, _b, _c, _d, _e;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Projects',
|
||||
query: 'query Projects($hostname:String! $filter:SearchFilter $page:Int $limit:Int){projects(section:{fullUrl:$hostname}filter:$filter page:{pageSize:$limit,pageNumber:$page}){content{title url covers{url}}}}',
|
||||
variables: {
|
||||
filter: ((_b = (_a = filters === null || filters === void 0 ? void 0 : filters.tags) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0 > 0) ? { tags: filters === null || filters === void 0 ? void 0 : filters.tags } : {},
|
||||
hostname: domain,
|
||||
limit: 40,
|
||||
page,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novels = (_e = (_d = (_c = json.data) === null || _c === void 0 ? void 0 : _c.projects) === null || _d === void 0 ? void 0 : _d.content) === null || _e === void 0 ? void 0 : _e.map((novel) => {
|
||||
var _a;
|
||||
return ({
|
||||
name: novel.title,
|
||||
url: baseUrl + '/r/' + novel.url,
|
||||
cover: ((_a = novel.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + novel.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
});
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
var _a, _b;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Book',
|
||||
query: 'query Book($url:String){project(project:{fullUrl:$url}){title translationStatus url covers{url}persons(langs:["ru","en","*"]roles:["author","illustrator","original_story","original_design"]){role name{firstName lastName}}genres{nameRu nameEng}tags{nameRu nameEng}annotation{text}subprojects{content{title volumes{content{url shortName chapters{title publishDate url published}}}}}}}',
|
||||
variables: {
|
||||
hostname: domain,
|
||||
project: novelUrl,
|
||||
url: novelUrl,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
name: json.data.project.title,
|
||||
cover: ((_a = json.data.project.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + json.data.project.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
summary: (0, cheerio_1.load)((_b = json.data.project.annotation) === null || _b === void 0 ? void 0 : _b.text).text(),
|
||||
author: json.data.project.persons[0].name.firstName +
|
||||
' ' +
|
||||
json.data.project.persons[0].name.lastName,
|
||||
status: json.data.project.translationStatus === 'active'
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed,
|
||||
};
|
||||
let genres = []
|
||||
.concat(json.data.project.tags, json.data.project.genres)
|
||||
.map((item) => (item === null || item === void 0 ? void 0 : item.nameRu) || (item === null || item === void 0 ? void 0 : item.nameEng))
|
||||
.filter(item => item);
|
||||
if (genres.length > 0) {
|
||||
novel.genres = genres.join(',');
|
||||
}
|
||||
let novelChapters = [];
|
||||
json.data.project.subprojects.content.forEach((work) => work.volumes.content.forEach((volume) => volume.chapters.forEach((chapter) => (chapter === null || chapter === void 0 ? void 0 : chapter.published) &&
|
||||
novelChapters.push({
|
||||
name: volume.shortName + ' ' + chapter.title,
|
||||
url: novelUrl + '/' + volume.url + '/' + chapter.url,
|
||||
releaseTime: (0, dayjs_1.default)(chapter.publishDate).format('LLL'),
|
||||
}))));
|
||||
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)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'EReaderData',
|
||||
query: 'query EReaderData($url:String!,$chapterSelector:Selector!){project(project:{fullUrl:$url}){title url}chapter(chapter:$chapterSelector){title text{text}}}',
|
||||
variables: {
|
||||
chapterSelector: {
|
||||
fullUrl: chapterUrl,
|
||||
},
|
||||
url: chapterUrl,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
return (0, cheerio_1.load)(json.data.chapter.text.text).html();
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
var _a, _b, _c;
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Projects',
|
||||
query: 'query Projects($hostname:String! $filter:SearchFilter $page:Int $limit:Int){projects(section:{fullUrl:$hostname}filter:$filter page:{pageSize:$limit,pageNumber:$page}){content{title url covers{url}}}}',
|
||||
variables: {
|
||||
filter: {
|
||||
query: searchTerm,
|
||||
},
|
||||
hostname: domain,
|
||||
limit: 40,
|
||||
page: 1,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novels = [];
|
||||
(_c = (_b = (_a = json === null || json === void 0 ? void 0 : json.data) === null || _a === void 0 ? void 0 : _a.projects) === null || _b === void 0 ? void 0 : _b.content) === null || _c === void 0 ? void 0 : _c.forEach((novel) => {
|
||||
var _a;
|
||||
return novels.push({
|
||||
name: novel.title,
|
||||
url: baseUrl + '/r/' + novel.url,
|
||||
cover: ((_a = novel.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + novel.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
});
|
||||
});
|
||||
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,213 @@
|
||||
"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.filters = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
// import { parseMadaraDate } from "@libs/parseMadaraDate";
|
||||
// import { isUrlAbsolute } from '@libs/isAbsoluteUrl';
|
||||
// import { showToast } from "@libs/showToast";
|
||||
const filterInputs_1 = require("@libs/filterInputs");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
exports.id = "original.novel";
|
||||
exports.name = "Авторские работы";
|
||||
exports.icon = "";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://original.novel.tl";
|
||||
exports.filters = [{ "key": "tags", "label": "Тэги", "values": [{ "label": "Агрессивные персонажи", "value": 26 }, { "label": "Академия", "value": 5 }, { "label": "Андроиды", "value": 37 }, { "label": "Антимагия", "value": 41 }, { "label": "Аристократия", "value": 51 }, { "label": "Артефакты", "value": 58 }, { "label": "Брошенные дети", "value": 1 }, { "label": "Вероломные герои/плетение интриг", "value": 424 }, { "label": "Взросление персонажа", "value": 24 }, { "label": "Владелец уникального оружия", "value": 736 }, { "label": "Герой-извращенец", "value": 521 }, { "label": "Главный герой не человек", "value": 488 }, { "label": "Государственные интриги", "value": 212 }, { "label": "Душещипательная история", "value": 335 }, { "label": "Жестокие персонажи", "value": 4 }, { "label": "Зверолюди", "value": 39 }, { "label": "Знания из прошлой жизни", "value": 553 }, { "label": "Искусственный интеллект", "value": 59 }, { "label": "Конфликт в семье", "value": 261 }, { "label": "Королевства", "value": 382 }], "inputType": filterInputs_1.FilterInputs.Checkbox }];
|
||||
exports["protected"] = false;
|
||||
const baseUrl = exports.site;
|
||||
const domain = baseUrl.split('//')[1];
|
||||
const popularNovels = function (page, { filters }) {
|
||||
var _a, _b, _c, _d, _e;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Projects',
|
||||
query: 'query Projects($hostname:String! $filter:SearchFilter $page:Int $limit:Int){projects(section:{fullUrl:$hostname}filter:$filter page:{pageSize:$limit,pageNumber:$page}){content{title url covers{url}}}}',
|
||||
variables: {
|
||||
filter: ((_b = (_a = filters === null || filters === void 0 ? void 0 : filters.tags) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0 > 0) ? { tags: filters === null || filters === void 0 ? void 0 : filters.tags } : {},
|
||||
hostname: domain,
|
||||
limit: 40,
|
||||
page,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novels = (_e = (_d = (_c = json.data) === null || _c === void 0 ? void 0 : _c.projects) === null || _d === void 0 ? void 0 : _d.content) === null || _e === void 0 ? void 0 : _e.map((novel) => {
|
||||
var _a;
|
||||
return ({
|
||||
name: novel.title,
|
||||
url: baseUrl + '/r/' + novel.url,
|
||||
cover: ((_a = novel.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + novel.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
});
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
var _a, _b;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Book',
|
||||
query: 'query Book($url:String){project(project:{fullUrl:$url}){title translationStatus url covers{url}persons(langs:["ru","en","*"]roles:["author","illustrator","original_story","original_design"]){role name{firstName lastName}}genres{nameRu nameEng}tags{nameRu nameEng}annotation{text}subprojects{content{title volumes{content{url shortName chapters{title publishDate url published}}}}}}}',
|
||||
variables: {
|
||||
hostname: domain,
|
||||
project: novelUrl,
|
||||
url: novelUrl,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
name: json.data.project.title,
|
||||
cover: ((_a = json.data.project.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + json.data.project.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
summary: (0, cheerio_1.load)((_b = json.data.project.annotation) === null || _b === void 0 ? void 0 : _b.text).text(),
|
||||
author: json.data.project.persons[0].name.firstName +
|
||||
' ' +
|
||||
json.data.project.persons[0].name.lastName,
|
||||
status: json.data.project.translationStatus === 'active'
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed,
|
||||
};
|
||||
let genres = []
|
||||
.concat(json.data.project.tags, json.data.project.genres)
|
||||
.map((item) => (item === null || item === void 0 ? void 0 : item.nameRu) || (item === null || item === void 0 ? void 0 : item.nameEng))
|
||||
.filter(item => item);
|
||||
if (genres.length > 0) {
|
||||
novel.genres = genres.join(',');
|
||||
}
|
||||
let novelChapters = [];
|
||||
json.data.project.subprojects.content.forEach((work) => work.volumes.content.forEach((volume) => volume.chapters.forEach((chapter) => (chapter === null || chapter === void 0 ? void 0 : chapter.published) &&
|
||||
novelChapters.push({
|
||||
name: volume.shortName + ' ' + chapter.title,
|
||||
url: novelUrl + '/' + volume.url + '/' + chapter.url,
|
||||
releaseTime: (0, dayjs_1.default)(chapter.publishDate).format('LLL'),
|
||||
}))));
|
||||
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)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'EReaderData',
|
||||
query: 'query EReaderData($url:String!,$chapterSelector:Selector!){project(project:{fullUrl:$url}){title url}chapter(chapter:$chapterSelector){title text{text}}}',
|
||||
variables: {
|
||||
chapterSelector: {
|
||||
fullUrl: chapterUrl,
|
||||
},
|
||||
url: chapterUrl,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
return (0, cheerio_1.load)(json.data.chapter.text.text).html();
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
var _a, _b, _c;
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Projects',
|
||||
query: 'query Projects($hostname:String! $filter:SearchFilter $page:Int $limit:Int){projects(section:{fullUrl:$hostname}filter:$filter page:{pageSize:$limit,pageNumber:$page}){content{title url covers{url}}}}',
|
||||
variables: {
|
||||
filter: {
|
||||
query: searchTerm,
|
||||
},
|
||||
hostname: domain,
|
||||
limit: 40,
|
||||
page: 1,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novels = [];
|
||||
(_c = (_b = (_a = json === null || json === void 0 ? void 0 : json.data) === null || _a === void 0 ? void 0 : _a.projects) === null || _b === void 0 ? void 0 : _b.content) === null || _c === void 0 ? void 0 : _c.forEach((novel) => {
|
||||
var _a;
|
||||
return novels.push({
|
||||
name: novel.title,
|
||||
url: baseUrl + '/r/' + novel.url,
|
||||
cover: ((_a = novel.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + novel.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
});
|
||||
});
|
||||
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,213 @@
|
||||
"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.filters = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
// import { parseMadaraDate } from "@libs/parseMadaraDate";
|
||||
// import { isUrlAbsolute } from '@libs/isAbsoluteUrl';
|
||||
// import { showToast } from "@libs/showToast";
|
||||
const filterInputs_1 = require("@libs/filterInputs");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
exports.id = "red.novel";
|
||||
exports.name = "Север и Юг";
|
||||
exports.icon = "";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://red.novel.tl";
|
||||
exports.filters = [{ "key": "tags", "label": "Тэги", "values": [{ "label": "Героиня красавица", "value": 81 }, { "label": "Герой влюбляется первым", "value": 561 }, { "label": "Главный герой — мужчина", "value": 419 }, { "label": "Дружба", "value": 293 }, { "label": "Жизнь в одиночку", "value": 396 }, { "label": "Сложные семейные отношения", "value": 149 }], "inputType": filterInputs_1.FilterInputs.Checkbox }];
|
||||
exports["protected"] = false;
|
||||
const baseUrl = exports.site;
|
||||
const domain = baseUrl.split('//')[1];
|
||||
const popularNovels = function (page, { filters }) {
|
||||
var _a, _b, _c, _d, _e;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Projects',
|
||||
query: 'query Projects($hostname:String! $filter:SearchFilter $page:Int $limit:Int){projects(section:{fullUrl:$hostname}filter:$filter page:{pageSize:$limit,pageNumber:$page}){content{title url covers{url}}}}',
|
||||
variables: {
|
||||
filter: ((_b = (_a = filters === null || filters === void 0 ? void 0 : filters.tags) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0 > 0) ? { tags: filters === null || filters === void 0 ? void 0 : filters.tags } : {},
|
||||
hostname: domain,
|
||||
limit: 40,
|
||||
page,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novels = (_e = (_d = (_c = json.data) === null || _c === void 0 ? void 0 : _c.projects) === null || _d === void 0 ? void 0 : _d.content) === null || _e === void 0 ? void 0 : _e.map((novel) => {
|
||||
var _a;
|
||||
return ({
|
||||
name: novel.title,
|
||||
url: baseUrl + '/r/' + novel.url,
|
||||
cover: ((_a = novel.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + novel.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
});
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
var _a, _b;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Book',
|
||||
query: 'query Book($url:String){project(project:{fullUrl:$url}){title translationStatus url covers{url}persons(langs:["ru","en","*"]roles:["author","illustrator","original_story","original_design"]){role name{firstName lastName}}genres{nameRu nameEng}tags{nameRu nameEng}annotation{text}subprojects{content{title volumes{content{url shortName chapters{title publishDate url published}}}}}}}',
|
||||
variables: {
|
||||
hostname: domain,
|
||||
project: novelUrl,
|
||||
url: novelUrl,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
name: json.data.project.title,
|
||||
cover: ((_a = json.data.project.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + json.data.project.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
summary: (0, cheerio_1.load)((_b = json.data.project.annotation) === null || _b === void 0 ? void 0 : _b.text).text(),
|
||||
author: json.data.project.persons[0].name.firstName +
|
||||
' ' +
|
||||
json.data.project.persons[0].name.lastName,
|
||||
status: json.data.project.translationStatus === 'active'
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed,
|
||||
};
|
||||
let genres = []
|
||||
.concat(json.data.project.tags, json.data.project.genres)
|
||||
.map((item) => (item === null || item === void 0 ? void 0 : item.nameRu) || (item === null || item === void 0 ? void 0 : item.nameEng))
|
||||
.filter(item => item);
|
||||
if (genres.length > 0) {
|
||||
novel.genres = genres.join(',');
|
||||
}
|
||||
let novelChapters = [];
|
||||
json.data.project.subprojects.content.forEach((work) => work.volumes.content.forEach((volume) => volume.chapters.forEach((chapter) => (chapter === null || chapter === void 0 ? void 0 : chapter.published) &&
|
||||
novelChapters.push({
|
||||
name: volume.shortName + ' ' + chapter.title,
|
||||
url: novelUrl + '/' + volume.url + '/' + chapter.url,
|
||||
releaseTime: (0, dayjs_1.default)(chapter.publishDate).format('LLL'),
|
||||
}))));
|
||||
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)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'EReaderData',
|
||||
query: 'query EReaderData($url:String!,$chapterSelector:Selector!){project(project:{fullUrl:$url}){title url}chapter(chapter:$chapterSelector){title text{text}}}',
|
||||
variables: {
|
||||
chapterSelector: {
|
||||
fullUrl: chapterUrl,
|
||||
},
|
||||
url: chapterUrl,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
return (0, cheerio_1.load)(json.data.chapter.text.text).html();
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
var _a, _b, _c;
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Projects',
|
||||
query: 'query Projects($hostname:String! $filter:SearchFilter $page:Int $limit:Int){projects(section:{fullUrl:$hostname}filter:$filter page:{pageSize:$limit,pageNumber:$page}){content{title url covers{url}}}}',
|
||||
variables: {
|
||||
filter: {
|
||||
query: searchTerm,
|
||||
},
|
||||
hostname: domain,
|
||||
limit: 40,
|
||||
page: 1,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novels = [];
|
||||
(_c = (_b = (_a = json === null || json === void 0 ? void 0 : json.data) === null || _a === void 0 ? void 0 : _a.projects) === null || _b === void 0 ? void 0 : _b.content) === null || _c === void 0 ? void 0 : _c.forEach((novel) => {
|
||||
var _a;
|
||||
return novels.push({
|
||||
name: novel.title,
|
||||
url: baseUrl + '/r/' + novel.url,
|
||||
cover: ((_a = novel.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + novel.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
});
|
||||
});
|
||||
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,213 @@
|
||||
"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.filters = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
// import { parseMadaraDate } from "@libs/parseMadaraDate";
|
||||
// import { isUrlAbsolute } from '@libs/isAbsoluteUrl';
|
||||
// import { showToast } from "@libs/showToast";
|
||||
const filterInputs_1 = require("@libs/filterInputs");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
exports.id = "ruranobe";
|
||||
exports.name = "РуРанобэ";
|
||||
exports.icon = "";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://ruranobe.ru";
|
||||
exports.filters = [{ "key": "tags", "label": "Тэги", "values": [{ "label": "Автоматы", "value": 64 }, { "label": "Агрессивные персонажи", "value": 26 }, { "label": "Ад", "value": 338 }, { "label": "Адаптация манги", "value": 8 }, { "label": "Академия", "value": 5 }, { "label": "Алхимия", "value": 27 }, { "label": "Альтернативная реальность", "value": 30 }, { "label": "Амнезия", "value": 31 }, { "label": "Анабиоз", "value": 170 }, { "label": "Ангелы", "value": 38 }, { "label": "Андроиды", "value": 37 }, { "label": "Антигерой", "value": 43 }, { "label": "Антимагия", "value": 41 }, { "label": "Апатичный главный герой", "value": 46 }, { "label": "Апокалипсис", "value": 47 }, { "label": "Аристократия", "value": 51 }, { "label": "Артефакты", "value": 58 }, { "label": "Асоциальный главный герой", "value": 42 }, { "label": "R-15", "value": 570 }, { "label": "R-18", "value": 571 }], "inputType": filterInputs_1.FilterInputs.Checkbox }];
|
||||
exports["protected"] = false;
|
||||
const baseUrl = exports.site;
|
||||
const domain = baseUrl.split('//')[1];
|
||||
const popularNovels = function (page, { filters }) {
|
||||
var _a, _b, _c, _d, _e;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Projects',
|
||||
query: 'query Projects($hostname:String! $filter:SearchFilter $page:Int $limit:Int){projects(section:{fullUrl:$hostname}filter:$filter page:{pageSize:$limit,pageNumber:$page}){content{title url covers{url}}}}',
|
||||
variables: {
|
||||
filter: ((_b = (_a = filters === null || filters === void 0 ? void 0 : filters.tags) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0 > 0) ? { tags: filters === null || filters === void 0 ? void 0 : filters.tags } : {},
|
||||
hostname: domain,
|
||||
limit: 40,
|
||||
page,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novels = (_e = (_d = (_c = json.data) === null || _c === void 0 ? void 0 : _c.projects) === null || _d === void 0 ? void 0 : _d.content) === null || _e === void 0 ? void 0 : _e.map((novel) => {
|
||||
var _a;
|
||||
return ({
|
||||
name: novel.title,
|
||||
url: baseUrl + '/r/' + novel.url,
|
||||
cover: ((_a = novel.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + novel.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
});
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
var _a, _b;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Book',
|
||||
query: 'query Book($url:String){project(project:{fullUrl:$url}){title translationStatus url covers{url}persons(langs:["ru","en","*"]roles:["author","illustrator","original_story","original_design"]){role name{firstName lastName}}genres{nameRu nameEng}tags{nameRu nameEng}annotation{text}subprojects{content{title volumes{content{url shortName chapters{title publishDate url published}}}}}}}',
|
||||
variables: {
|
||||
hostname: domain,
|
||||
project: novelUrl,
|
||||
url: novelUrl,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
name: json.data.project.title,
|
||||
cover: ((_a = json.data.project.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + json.data.project.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
summary: (0, cheerio_1.load)((_b = json.data.project.annotation) === null || _b === void 0 ? void 0 : _b.text).text(),
|
||||
author: json.data.project.persons[0].name.firstName +
|
||||
' ' +
|
||||
json.data.project.persons[0].name.lastName,
|
||||
status: json.data.project.translationStatus === 'active'
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed,
|
||||
};
|
||||
let genres = []
|
||||
.concat(json.data.project.tags, json.data.project.genres)
|
||||
.map((item) => (item === null || item === void 0 ? void 0 : item.nameRu) || (item === null || item === void 0 ? void 0 : item.nameEng))
|
||||
.filter(item => item);
|
||||
if (genres.length > 0) {
|
||||
novel.genres = genres.join(',');
|
||||
}
|
||||
let novelChapters = [];
|
||||
json.data.project.subprojects.content.forEach((work) => work.volumes.content.forEach((volume) => volume.chapters.forEach((chapter) => (chapter === null || chapter === void 0 ? void 0 : chapter.published) &&
|
||||
novelChapters.push({
|
||||
name: volume.shortName + ' ' + chapter.title,
|
||||
url: novelUrl + '/' + volume.url + '/' + chapter.url,
|
||||
releaseTime: (0, dayjs_1.default)(chapter.publishDate).format('LLL'),
|
||||
}))));
|
||||
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)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'EReaderData',
|
||||
query: 'query EReaderData($url:String!,$chapterSelector:Selector!){project(project:{fullUrl:$url}){title url}chapter(chapter:$chapterSelector){title text{text}}}',
|
||||
variables: {
|
||||
chapterSelector: {
|
||||
fullUrl: chapterUrl,
|
||||
},
|
||||
url: chapterUrl,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
return (0, cheerio_1.load)(json.data.chapter.text.text).html();
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
var _a, _b, _c;
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Projects',
|
||||
query: 'query Projects($hostname:String! $filter:SearchFilter $page:Int $limit:Int){projects(section:{fullUrl:$hostname}filter:$filter page:{pageSize:$limit,pageNumber:$page}){content{title url covers{url}}}}',
|
||||
variables: {
|
||||
filter: {
|
||||
query: searchTerm,
|
||||
},
|
||||
hostname: domain,
|
||||
limit: 40,
|
||||
page: 1,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novels = [];
|
||||
(_c = (_b = (_a = json === null || json === void 0 ? void 0 : json.data) === null || _a === void 0 ? void 0 : _a.projects) === null || _b === void 0 ? void 0 : _b.content) === null || _c === void 0 ? void 0 : _c.forEach((novel) => {
|
||||
var _a;
|
||||
return novels.push({
|
||||
name: novel.title,
|
||||
url: baseUrl + '/r/' + novel.url,
|
||||
cover: ((_a = novel.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + novel.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
});
|
||||
});
|
||||
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,213 @@
|
||||
"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.filters = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
// import { parseMadaraDate } from "@libs/parseMadaraDate";
|
||||
// import { isUrlAbsolute } from '@libs/isAbsoluteUrl';
|
||||
// import { showToast } from "@libs/showToast";
|
||||
const filterInputs_1 = require("@libs/filterInputs");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
exports.id = "sferdrakon.novel";
|
||||
exports.name = "Уголок дракона";
|
||||
exports.icon = "";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://sferdrakon.novel.tl";
|
||||
exports.filters = [{ "key": "tags", "label": "Тэги", "values": [{ "label": "Главный герой — мужчина", "value": 419 }, { "label": "Демоны", "value": 193 }, { "label": "Драконы", "value": 218 }, { "label": "Есть аниме-адаптация", "value": 10 }, { "label": "Есть видеоигра", "value": 13 }, { "label": "Есть манга-адаптация", "value": 14 }, { "label": "Звероподобные", "value": 79 }, { "label": "Изнасилование", "value": 574 }, { "label": "Королевская особа", "value": 596 }, { "label": "Магия", "value": 412 }, { "label": "Магия призыва", "value": 694 }, { "label": "Наездники на драконах", "value": 216 }, { "label": "Рыцари", "value": 383 }, { "label": "Цундере", "value": 728 }, { "label": "Эльфы", "value": 235 }], "inputType": filterInputs_1.FilterInputs.Checkbox }];
|
||||
exports["protected"] = false;
|
||||
const baseUrl = exports.site;
|
||||
const domain = baseUrl.split('//')[1];
|
||||
const popularNovels = function (page, { filters }) {
|
||||
var _a, _b, _c, _d, _e;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Projects',
|
||||
query: 'query Projects($hostname:String! $filter:SearchFilter $page:Int $limit:Int){projects(section:{fullUrl:$hostname}filter:$filter page:{pageSize:$limit,pageNumber:$page}){content{title url covers{url}}}}',
|
||||
variables: {
|
||||
filter: ((_b = (_a = filters === null || filters === void 0 ? void 0 : filters.tags) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0 > 0) ? { tags: filters === null || filters === void 0 ? void 0 : filters.tags } : {},
|
||||
hostname: domain,
|
||||
limit: 40,
|
||||
page,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novels = (_e = (_d = (_c = json.data) === null || _c === void 0 ? void 0 : _c.projects) === null || _d === void 0 ? void 0 : _d.content) === null || _e === void 0 ? void 0 : _e.map((novel) => {
|
||||
var _a;
|
||||
return ({
|
||||
name: novel.title,
|
||||
url: baseUrl + '/r/' + novel.url,
|
||||
cover: ((_a = novel.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + novel.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
});
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
var _a, _b;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Book',
|
||||
query: 'query Book($url:String){project(project:{fullUrl:$url}){title translationStatus url covers{url}persons(langs:["ru","en","*"]roles:["author","illustrator","original_story","original_design"]){role name{firstName lastName}}genres{nameRu nameEng}tags{nameRu nameEng}annotation{text}subprojects{content{title volumes{content{url shortName chapters{title publishDate url published}}}}}}}',
|
||||
variables: {
|
||||
hostname: domain,
|
||||
project: novelUrl,
|
||||
url: novelUrl,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
name: json.data.project.title,
|
||||
cover: ((_a = json.data.project.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + json.data.project.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
summary: (0, cheerio_1.load)((_b = json.data.project.annotation) === null || _b === void 0 ? void 0 : _b.text).text(),
|
||||
author: json.data.project.persons[0].name.firstName +
|
||||
' ' +
|
||||
json.data.project.persons[0].name.lastName,
|
||||
status: json.data.project.translationStatus === 'active'
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed,
|
||||
};
|
||||
let genres = []
|
||||
.concat(json.data.project.tags, json.data.project.genres)
|
||||
.map((item) => (item === null || item === void 0 ? void 0 : item.nameRu) || (item === null || item === void 0 ? void 0 : item.nameEng))
|
||||
.filter(item => item);
|
||||
if (genres.length > 0) {
|
||||
novel.genres = genres.join(',');
|
||||
}
|
||||
let novelChapters = [];
|
||||
json.data.project.subprojects.content.forEach((work) => work.volumes.content.forEach((volume) => volume.chapters.forEach((chapter) => (chapter === null || chapter === void 0 ? void 0 : chapter.published) &&
|
||||
novelChapters.push({
|
||||
name: volume.shortName + ' ' + chapter.title,
|
||||
url: novelUrl + '/' + volume.url + '/' + chapter.url,
|
||||
releaseTime: (0, dayjs_1.default)(chapter.publishDate).format('LLL'),
|
||||
}))));
|
||||
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)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'EReaderData',
|
||||
query: 'query EReaderData($url:String!,$chapterSelector:Selector!){project(project:{fullUrl:$url}){title url}chapter(chapter:$chapterSelector){title text{text}}}',
|
||||
variables: {
|
||||
chapterSelector: {
|
||||
fullUrl: chapterUrl,
|
||||
},
|
||||
url: chapterUrl,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
return (0, cheerio_1.load)(json.data.chapter.text.text).html();
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
var _a, _b, _c;
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Projects',
|
||||
query: 'query Projects($hostname:String! $filter:SearchFilter $page:Int $limit:Int){projects(section:{fullUrl:$hostname}filter:$filter page:{pageSize:$limit,pageNumber:$page}){content{title url covers{url}}}}',
|
||||
variables: {
|
||||
filter: {
|
||||
query: searchTerm,
|
||||
},
|
||||
hostname: domain,
|
||||
limit: 40,
|
||||
page: 1,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novels = [];
|
||||
(_c = (_b = (_a = json === null || json === void 0 ? void 0 : json.data) === null || _a === void 0 ? void 0 : _a.projects) === null || _b === void 0 ? void 0 : _b.content) === null || _c === void 0 ? void 0 : _c.forEach((novel) => {
|
||||
var _a;
|
||||
return novels.push({
|
||||
name: novel.title,
|
||||
url: baseUrl + '/r/' + novel.url,
|
||||
cover: ((_a = novel.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + novel.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
});
|
||||
});
|
||||
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,213 @@
|
||||
"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.filters = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
// import { parseMadaraDate } from "@libs/parseMadaraDate";
|
||||
// import { isUrlAbsolute } from '@libs/isAbsoluteUrl';
|
||||
// import { showToast } from "@libs/showToast";
|
||||
const filterInputs_1 = require("@libs/filterInputs");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
exports.id = "si.novel";
|
||||
exports.name = "Сказочные истории";
|
||||
exports.icon = "";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://si.novel.tl";
|
||||
exports.filters = [{ "key": "tags", "label": "Тэги", "values": [{ "label": "Аристократия", "value": 51 }, { "label": "Война", "value": 750 }, { "label": "Главная героиня — женщина", "value": 277 }, { "label": "Драконы", "value": 218 }, { "label": "Древний Китай", "value": 34 }, { "label": "Жестокие персонажи", "value": 4 }, { "label": "Злобные благородные девы", "value": 743 }, { "label": "Комедийный подтекст", "value": 147 }, { "label": "Культивация", "value": 171 }, { "label": "Магия", "value": 412 }, { "label": "Отомэ-игры", "value": 504 }, { "label": "Перерождение в другом мире", "value": 580 }, { "label": "Перерождение в другом мире", "value": 720 }, { "label": "Повелитель демонов", "value": 191 }, { "label": "Попаданец в другой мир", "value": 723 }, { "label": "Смерть", "value": 185 }, { "label": "Средневековье", "value": 436 }, { "label": "Фэнтези", "value": 267 }, { "label": "Харизматичный протагонист", "value": 120 }, { "label": "Хитрый главный герой", "value": 173 }], "inputType": filterInputs_1.FilterInputs.Checkbox }];
|
||||
exports["protected"] = false;
|
||||
const baseUrl = exports.site;
|
||||
const domain = baseUrl.split('//')[1];
|
||||
const popularNovels = function (page, { filters }) {
|
||||
var _a, _b, _c, _d, _e;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Projects',
|
||||
query: 'query Projects($hostname:String! $filter:SearchFilter $page:Int $limit:Int){projects(section:{fullUrl:$hostname}filter:$filter page:{pageSize:$limit,pageNumber:$page}){content{title url covers{url}}}}',
|
||||
variables: {
|
||||
filter: ((_b = (_a = filters === null || filters === void 0 ? void 0 : filters.tags) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0 > 0) ? { tags: filters === null || filters === void 0 ? void 0 : filters.tags } : {},
|
||||
hostname: domain,
|
||||
limit: 40,
|
||||
page,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novels = (_e = (_d = (_c = json.data) === null || _c === void 0 ? void 0 : _c.projects) === null || _d === void 0 ? void 0 : _d.content) === null || _e === void 0 ? void 0 : _e.map((novel) => {
|
||||
var _a;
|
||||
return ({
|
||||
name: novel.title,
|
||||
url: baseUrl + '/r/' + novel.url,
|
||||
cover: ((_a = novel.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + novel.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
});
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
var _a, _b;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Book',
|
||||
query: 'query Book($url:String){project(project:{fullUrl:$url}){title translationStatus url covers{url}persons(langs:["ru","en","*"]roles:["author","illustrator","original_story","original_design"]){role name{firstName lastName}}genres{nameRu nameEng}tags{nameRu nameEng}annotation{text}subprojects{content{title volumes{content{url shortName chapters{title publishDate url published}}}}}}}',
|
||||
variables: {
|
||||
hostname: domain,
|
||||
project: novelUrl,
|
||||
url: novelUrl,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
name: json.data.project.title,
|
||||
cover: ((_a = json.data.project.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + json.data.project.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
summary: (0, cheerio_1.load)((_b = json.data.project.annotation) === null || _b === void 0 ? void 0 : _b.text).text(),
|
||||
author: json.data.project.persons[0].name.firstName +
|
||||
' ' +
|
||||
json.data.project.persons[0].name.lastName,
|
||||
status: json.data.project.translationStatus === 'active'
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed,
|
||||
};
|
||||
let genres = []
|
||||
.concat(json.data.project.tags, json.data.project.genres)
|
||||
.map((item) => (item === null || item === void 0 ? void 0 : item.nameRu) || (item === null || item === void 0 ? void 0 : item.nameEng))
|
||||
.filter(item => item);
|
||||
if (genres.length > 0) {
|
||||
novel.genres = genres.join(',');
|
||||
}
|
||||
let novelChapters = [];
|
||||
json.data.project.subprojects.content.forEach((work) => work.volumes.content.forEach((volume) => volume.chapters.forEach((chapter) => (chapter === null || chapter === void 0 ? void 0 : chapter.published) &&
|
||||
novelChapters.push({
|
||||
name: volume.shortName + ' ' + chapter.title,
|
||||
url: novelUrl + '/' + volume.url + '/' + chapter.url,
|
||||
releaseTime: (0, dayjs_1.default)(chapter.publishDate).format('LLL'),
|
||||
}))));
|
||||
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)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'EReaderData',
|
||||
query: 'query EReaderData($url:String!,$chapterSelector:Selector!){project(project:{fullUrl:$url}){title url}chapter(chapter:$chapterSelector){title text{text}}}',
|
||||
variables: {
|
||||
chapterSelector: {
|
||||
fullUrl: chapterUrl,
|
||||
},
|
||||
url: chapterUrl,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
return (0, cheerio_1.load)(json.data.chapter.text.text).html();
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
var _a, _b, _c;
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Projects',
|
||||
query: 'query Projects($hostname:String! $filter:SearchFilter $page:Int $limit:Int){projects(section:{fullUrl:$hostname}filter:$filter page:{pageSize:$limit,pageNumber:$page}){content{title url covers{url}}}}',
|
||||
variables: {
|
||||
filter: {
|
||||
query: searchTerm,
|
||||
},
|
||||
hostname: domain,
|
||||
limit: 40,
|
||||
page: 1,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novels = [];
|
||||
(_c = (_b = (_a = json === null || json === void 0 ? void 0 : json.data) === null || _a === void 0 ? void 0 : _a.projects) === null || _b === void 0 ? void 0 : _b.content) === null || _c === void 0 ? void 0 : _c.forEach((novel) => {
|
||||
var _a;
|
||||
return novels.push({
|
||||
name: novel.title,
|
||||
url: baseUrl + '/r/' + novel.url,
|
||||
cover: ((_a = novel.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + novel.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
});
|
||||
});
|
||||
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,213 @@
|
||||
"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.filters = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
// import { parseMadaraDate } from "@libs/parseMadaraDate";
|
||||
// import { isUrlAbsolute } from '@libs/isAbsoluteUrl';
|
||||
// import { showToast } from "@libs/showToast";
|
||||
const filterInputs_1 = require("@libs/filterInputs");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
exports.id = "snailulitka.novel";
|
||||
exports.name = "Snailulitka";
|
||||
exports.icon = "";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://snailulitka.novel.tl";
|
||||
exports.filters = [{ "key": "tags", "label": "Тэги", "values": [{ "label": "Алхимия", "value": 27 }, { "label": "Ассасины", "value": 61 }, { "label": "Бедный главный герой", "value": 541 }, { "label": "Богачи", "value": 753 }, { "label": "Виртуальная реальность", "value": 744 }, { "label": "Война", "value": 750 }, { "label": "Геймеры", "value": 301 }, { "label": "Героиня красавица", "value": 81 }, { "label": "Герой красавец", "value": 329 }, { "label": "Гильдии", "value": 324 }, { "label": "Главный герой - гений", "value": 308 }, { "label": "Главный герой — знаменитость", "value": 263 }, { "label": "Главный герой — мужчина", "value": 419 }, { "label": "Дворфы", "value": 224 }, { "label": "Драконы", "value": 218 }, { "label": "Есть маньхуа-адаптация", "value": 15 }, { "label": "Игровая рейтинговая система", "value": 300 }, { "label": "Книги навыков", "value": 654 }, { "label": "Лекари", "value": 334 }, { "label": "Месть", "value": 588 }], "inputType": filterInputs_1.FilterInputs.Checkbox }];
|
||||
exports["protected"] = false;
|
||||
const baseUrl = exports.site;
|
||||
const domain = baseUrl.split('//')[1];
|
||||
const popularNovels = function (page, { filters }) {
|
||||
var _a, _b, _c, _d, _e;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Projects',
|
||||
query: 'query Projects($hostname:String! $filter:SearchFilter $page:Int $limit:Int){projects(section:{fullUrl:$hostname}filter:$filter page:{pageSize:$limit,pageNumber:$page}){content{title url covers{url}}}}',
|
||||
variables: {
|
||||
filter: ((_b = (_a = filters === null || filters === void 0 ? void 0 : filters.tags) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0 > 0) ? { tags: filters === null || filters === void 0 ? void 0 : filters.tags } : {},
|
||||
hostname: domain,
|
||||
limit: 40,
|
||||
page,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novels = (_e = (_d = (_c = json.data) === null || _c === void 0 ? void 0 : _c.projects) === null || _d === void 0 ? void 0 : _d.content) === null || _e === void 0 ? void 0 : _e.map((novel) => {
|
||||
var _a;
|
||||
return ({
|
||||
name: novel.title,
|
||||
url: baseUrl + '/r/' + novel.url,
|
||||
cover: ((_a = novel.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + novel.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
});
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
var _a, _b;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Book',
|
||||
query: 'query Book($url:String){project(project:{fullUrl:$url}){title translationStatus url covers{url}persons(langs:["ru","en","*"]roles:["author","illustrator","original_story","original_design"]){role name{firstName lastName}}genres{nameRu nameEng}tags{nameRu nameEng}annotation{text}subprojects{content{title volumes{content{url shortName chapters{title publishDate url published}}}}}}}',
|
||||
variables: {
|
||||
hostname: domain,
|
||||
project: novelUrl,
|
||||
url: novelUrl,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
name: json.data.project.title,
|
||||
cover: ((_a = json.data.project.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + json.data.project.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
summary: (0, cheerio_1.load)((_b = json.data.project.annotation) === null || _b === void 0 ? void 0 : _b.text).text(),
|
||||
author: json.data.project.persons[0].name.firstName +
|
||||
' ' +
|
||||
json.data.project.persons[0].name.lastName,
|
||||
status: json.data.project.translationStatus === 'active'
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed,
|
||||
};
|
||||
let genres = []
|
||||
.concat(json.data.project.tags, json.data.project.genres)
|
||||
.map((item) => (item === null || item === void 0 ? void 0 : item.nameRu) || (item === null || item === void 0 ? void 0 : item.nameEng))
|
||||
.filter(item => item);
|
||||
if (genres.length > 0) {
|
||||
novel.genres = genres.join(',');
|
||||
}
|
||||
let novelChapters = [];
|
||||
json.data.project.subprojects.content.forEach((work) => work.volumes.content.forEach((volume) => volume.chapters.forEach((chapter) => (chapter === null || chapter === void 0 ? void 0 : chapter.published) &&
|
||||
novelChapters.push({
|
||||
name: volume.shortName + ' ' + chapter.title,
|
||||
url: novelUrl + '/' + volume.url + '/' + chapter.url,
|
||||
releaseTime: (0, dayjs_1.default)(chapter.publishDate).format('LLL'),
|
||||
}))));
|
||||
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)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'EReaderData',
|
||||
query: 'query EReaderData($url:String!,$chapterSelector:Selector!){project(project:{fullUrl:$url}){title url}chapter(chapter:$chapterSelector){title text{text}}}',
|
||||
variables: {
|
||||
chapterSelector: {
|
||||
fullUrl: chapterUrl,
|
||||
},
|
||||
url: chapterUrl,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
return (0, cheerio_1.load)(json.data.chapter.text.text).html();
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
var _a, _b, _c;
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Projects',
|
||||
query: 'query Projects($hostname:String! $filter:SearchFilter $page:Int $limit:Int){projects(section:{fullUrl:$hostname}filter:$filter page:{pageSize:$limit,pageNumber:$page}){content{title url covers{url}}}}',
|
||||
variables: {
|
||||
filter: {
|
||||
query: searchTerm,
|
||||
},
|
||||
hostname: domain,
|
||||
limit: 40,
|
||||
page: 1,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novels = [];
|
||||
(_c = (_b = (_a = json === null || json === void 0 ? void 0 : json.data) === null || _a === void 0 ? void 0 : _a.projects) === null || _b === void 0 ? void 0 : _b.content) === null || _c === void 0 ? void 0 : _c.forEach((novel) => {
|
||||
var _a;
|
||||
return novels.push({
|
||||
name: novel.title,
|
||||
url: baseUrl + '/r/' + novel.url,
|
||||
cover: ((_a = novel.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + novel.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
});
|
||||
});
|
||||
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,213 @@
|
||||
"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.filters = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
// import { parseMadaraDate } from "@libs/parseMadaraDate";
|
||||
// import { isUrlAbsolute } from '@libs/isAbsoluteUrl';
|
||||
// import { showToast } from "@libs/showToast";
|
||||
const filterInputs_1 = require("@libs/filterInputs");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
exports.id = "tsundoku.novel";
|
||||
exports.name = "TsundokuTrans";
|
||||
exports.icon = "";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://tsundoku.novel.tl";
|
||||
exports.filters = [{ "key": "tags", "label": "Тэги", "values": [{ "label": "Боги", "value": 318 }, { "label": "Боевая академия", "value": 75 }, { "label": "Вампиры", "value": 742 }, { "label": "Влияние прошлого", "value": 517 }, { "label": "Война", "value": 750 }, { "label": "Главная героиня — женщина", "value": 277 }, { "label": "Главный герой — мужчина", "value": 419 }, { "label": "Демоны", "value": 193 }, { "label": "Драконы", "value": 218 }, { "label": "Королевская особа", "value": 596 }, { "label": "Коррупция", "value": 157 }, { "label": "Магия", "value": 412 }, { "label": "Мастер подземелий", "value": 222 }, { "label": "Мечи и магия", "value": 697 }, { "label": "Мечники", "value": 698 }, { "label": "Монстры", "value": 454 }, { "label": "Недооцененный главный герой", "value": 734 }, { "label": "От слабого к сильному", "value": 752 }, { "label": "R-15", "value": 570 }, { "label": "R-18", "value": 571 }], "inputType": filterInputs_1.FilterInputs.Checkbox }];
|
||||
exports["protected"] = false;
|
||||
const baseUrl = exports.site;
|
||||
const domain = baseUrl.split('//')[1];
|
||||
const popularNovels = function (page, { filters }) {
|
||||
var _a, _b, _c, _d, _e;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Projects',
|
||||
query: 'query Projects($hostname:String! $filter:SearchFilter $page:Int $limit:Int){projects(section:{fullUrl:$hostname}filter:$filter page:{pageSize:$limit,pageNumber:$page}){content{title url covers{url}}}}',
|
||||
variables: {
|
||||
filter: ((_b = (_a = filters === null || filters === void 0 ? void 0 : filters.tags) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0 > 0) ? { tags: filters === null || filters === void 0 ? void 0 : filters.tags } : {},
|
||||
hostname: domain,
|
||||
limit: 40,
|
||||
page,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novels = (_e = (_d = (_c = json.data) === null || _c === void 0 ? void 0 : _c.projects) === null || _d === void 0 ? void 0 : _d.content) === null || _e === void 0 ? void 0 : _e.map((novel) => {
|
||||
var _a;
|
||||
return ({
|
||||
name: novel.title,
|
||||
url: baseUrl + '/r/' + novel.url,
|
||||
cover: ((_a = novel.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + novel.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
});
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
var _a, _b;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Book',
|
||||
query: 'query Book($url:String){project(project:{fullUrl:$url}){title translationStatus url covers{url}persons(langs:["ru","en","*"]roles:["author","illustrator","original_story","original_design"]){role name{firstName lastName}}genres{nameRu nameEng}tags{nameRu nameEng}annotation{text}subprojects{content{title volumes{content{url shortName chapters{title publishDate url published}}}}}}}',
|
||||
variables: {
|
||||
hostname: domain,
|
||||
project: novelUrl,
|
||||
url: novelUrl,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
name: json.data.project.title,
|
||||
cover: ((_a = json.data.project.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + json.data.project.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
summary: (0, cheerio_1.load)((_b = json.data.project.annotation) === null || _b === void 0 ? void 0 : _b.text).text(),
|
||||
author: json.data.project.persons[0].name.firstName +
|
||||
' ' +
|
||||
json.data.project.persons[0].name.lastName,
|
||||
status: json.data.project.translationStatus === 'active'
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed,
|
||||
};
|
||||
let genres = []
|
||||
.concat(json.data.project.tags, json.data.project.genres)
|
||||
.map((item) => (item === null || item === void 0 ? void 0 : item.nameRu) || (item === null || item === void 0 ? void 0 : item.nameEng))
|
||||
.filter(item => item);
|
||||
if (genres.length > 0) {
|
||||
novel.genres = genres.join(',');
|
||||
}
|
||||
let novelChapters = [];
|
||||
json.data.project.subprojects.content.forEach((work) => work.volumes.content.forEach((volume) => volume.chapters.forEach((chapter) => (chapter === null || chapter === void 0 ? void 0 : chapter.published) &&
|
||||
novelChapters.push({
|
||||
name: volume.shortName + ' ' + chapter.title,
|
||||
url: novelUrl + '/' + volume.url + '/' + chapter.url,
|
||||
releaseTime: (0, dayjs_1.default)(chapter.publishDate).format('LLL'),
|
||||
}))));
|
||||
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)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'EReaderData',
|
||||
query: 'query EReaderData($url:String!,$chapterSelector:Selector!){project(project:{fullUrl:$url}){title url}chapter(chapter:$chapterSelector){title text{text}}}',
|
||||
variables: {
|
||||
chapterSelector: {
|
||||
fullUrl: chapterUrl,
|
||||
},
|
||||
url: chapterUrl,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
return (0, cheerio_1.load)(json.data.chapter.text.text).html();
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
var _a, _b, _c;
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Projects',
|
||||
query: 'query Projects($hostname:String! $filter:SearchFilter $page:Int $limit:Int){projects(section:{fullUrl:$hostname}filter:$filter page:{pageSize:$limit,pageNumber:$page}){content{title url covers{url}}}}',
|
||||
variables: {
|
||||
filter: {
|
||||
query: searchTerm,
|
||||
},
|
||||
hostname: domain,
|
||||
limit: 40,
|
||||
page: 1,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novels = [];
|
||||
(_c = (_b = (_a = json === null || json === void 0 ? void 0 : json.data) === null || _a === void 0 ? void 0 : _a.projects) === null || _b === void 0 ? void 0 : _b.content) === null || _c === void 0 ? void 0 : _c.forEach((novel) => {
|
||||
var _a;
|
||||
return novels.push({
|
||||
name: novel.title,
|
||||
url: baseUrl + '/r/' + novel.url,
|
||||
cover: ((_a = novel.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + novel.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
});
|
||||
});
|
||||
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,213 @@
|
||||
"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.filters = exports.site = exports.version = exports.icon = exports.name = exports.id = void 0;
|
||||
const cheerio_1 = require("cheerio");
|
||||
const dayjs_1 = __importDefault(require("dayjs"));
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
// import { parseMadaraDate } from "@libs/parseMadaraDate";
|
||||
// import { isUrlAbsolute } from '@libs/isAbsoluteUrl';
|
||||
// import { showToast } from "@libs/showToast";
|
||||
const filterInputs_1 = require("@libs/filterInputs");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
exports.id = "ukr.novel";
|
||||
exports.name = "Переклади українською мовою";
|
||||
exports.icon = "";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://ukr.novel.tl";
|
||||
exports.filters = [{ "key": "tags", "label": "Тэги", "values": [{ "label": "Альтернативная реальность", "value": 30 }, { "label": "Апатичный главный герой", "value": 46 }, { "label": "Асоциальный главный герой", "value": 42 }, { "label": "Владелец уникального оружия", "value": 736 }, { "label": "Гарем рабов", "value": 656 }, { "label": "Герои", "value": 341 }, { "label": "Героиня красавица", "value": 81 }, { "label": "Герой использует щит", "value": 636 }, { "label": "Герой-трудяга", "value": 330 }, { "label": "Главный герой — мужчина", "value": 419 }, { "label": "Глухой к любви герой", "value": 194 }, { "label": "Демоны", "value": 193 }, { "label": "Друзья детства", "value": 128 }, { "label": "Есть аниме-адаптация", "value": 10 }, { "label": "Есть манга-адаптация", "value": 14 }, { "label": "Есть CD дорама-адаптация", "value": 12 }, { "label": "Зверолюди", "value": 39 }, { "label": "Магия", "value": 412 }, { "label": "Магия призыва", "value": 694 }, { "label": "От слабого к сильному", "value": 752 }], "inputType": filterInputs_1.FilterInputs.Checkbox }];
|
||||
exports["protected"] = false;
|
||||
const baseUrl = exports.site;
|
||||
const domain = baseUrl.split('//')[1];
|
||||
const popularNovels = function (page, { filters }) {
|
||||
var _a, _b, _c, _d, _e;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Projects',
|
||||
query: 'query Projects($hostname:String! $filter:SearchFilter $page:Int $limit:Int){projects(section:{fullUrl:$hostname}filter:$filter page:{pageSize:$limit,pageNumber:$page}){content{title url covers{url}}}}',
|
||||
variables: {
|
||||
filter: ((_b = (_a = filters === null || filters === void 0 ? void 0 : filters.tags) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0 > 0) ? { tags: filters === null || filters === void 0 ? void 0 : filters.tags } : {},
|
||||
hostname: domain,
|
||||
limit: 40,
|
||||
page,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novels = (_e = (_d = (_c = json.data) === null || _c === void 0 ? void 0 : _c.projects) === null || _d === void 0 ? void 0 : _d.content) === null || _e === void 0 ? void 0 : _e.map((novel) => {
|
||||
var _a;
|
||||
return ({
|
||||
name: novel.title,
|
||||
url: baseUrl + '/r/' + novel.url,
|
||||
cover: ((_a = novel.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + novel.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
});
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
var _a, _b;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Book',
|
||||
query: 'query Book($url:String){project(project:{fullUrl:$url}){title translationStatus url covers{url}persons(langs:["ru","en","*"]roles:["author","illustrator","original_story","original_design"]){role name{firstName lastName}}genres{nameRu nameEng}tags{nameRu nameEng}annotation{text}subprojects{content{title volumes{content{url shortName chapters{title publishDate url published}}}}}}}',
|
||||
variables: {
|
||||
hostname: domain,
|
||||
project: novelUrl,
|
||||
url: novelUrl,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
name: json.data.project.title,
|
||||
cover: ((_a = json.data.project.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + json.data.project.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
summary: (0, cheerio_1.load)((_b = json.data.project.annotation) === null || _b === void 0 ? void 0 : _b.text).text(),
|
||||
author: json.data.project.persons[0].name.firstName +
|
||||
' ' +
|
||||
json.data.project.persons[0].name.lastName,
|
||||
status: json.data.project.translationStatus === 'active'
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed,
|
||||
};
|
||||
let genres = []
|
||||
.concat(json.data.project.tags, json.data.project.genres)
|
||||
.map((item) => (item === null || item === void 0 ? void 0 : item.nameRu) || (item === null || item === void 0 ? void 0 : item.nameEng))
|
||||
.filter(item => item);
|
||||
if (genres.length > 0) {
|
||||
novel.genres = genres.join(',');
|
||||
}
|
||||
let novelChapters = [];
|
||||
json.data.project.subprojects.content.forEach((work) => work.volumes.content.forEach((volume) => volume.chapters.forEach((chapter) => (chapter === null || chapter === void 0 ? void 0 : chapter.published) &&
|
||||
novelChapters.push({
|
||||
name: volume.shortName + ' ' + chapter.title,
|
||||
url: novelUrl + '/' + volume.url + '/' + chapter.url,
|
||||
releaseTime: (0, dayjs_1.default)(chapter.publishDate).format('LLL'),
|
||||
}))));
|
||||
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)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'EReaderData',
|
||||
query: 'query EReaderData($url:String!,$chapterSelector:Selector!){project(project:{fullUrl:$url}){title url}chapter(chapter:$chapterSelector){title text{text}}}',
|
||||
variables: {
|
||||
chapterSelector: {
|
||||
fullUrl: chapterUrl,
|
||||
},
|
||||
url: chapterUrl,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
return (0, cheerio_1.load)(json.data.chapter.text.text).html();
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = (searchTerm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
var _a, _b, _c;
|
||||
const result = yield (0, fetch_1.fetchApi)('https://api.novel.tl/api/site/v2/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Accept-Language': 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Content-Type': 'application/json',
|
||||
'Alt-Used': 'api.novel.tl',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
},
|
||||
referrer: baseUrl,
|
||||
body: JSON.stringify({
|
||||
operationName: 'Projects',
|
||||
query: 'query Projects($hostname:String! $filter:SearchFilter $page:Int $limit:Int){projects(section:{fullUrl:$hostname}filter:$filter page:{pageSize:$limit,pageNumber:$page}){content{title url covers{url}}}}',
|
||||
variables: {
|
||||
filter: {
|
||||
query: searchTerm,
|
||||
},
|
||||
hostname: domain,
|
||||
limit: 40,
|
||||
page: 1,
|
||||
},
|
||||
}),
|
||||
});
|
||||
const json = yield result.json();
|
||||
const novels = [];
|
||||
(_c = (_b = (_a = json === null || json === void 0 ? void 0 : json.data) === null || _a === void 0 ? void 0 : _a.projects) === null || _b === void 0 ? void 0 : _b.content) === null || _c === void 0 ? void 0 : _c.forEach((novel) => {
|
||||
var _a;
|
||||
return novels.push({
|
||||
name: novel.title,
|
||||
url: baseUrl + '/r/' + novel.url,
|
||||
cover: ((_a = novel.covers[0]) === null || _a === void 0 ? void 0 : _a.url)
|
||||
? baseUrl + novel.covers[0].url
|
||||
: defaultCover_1.defaultCover,
|
||||
});
|
||||
});
|
||||
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,121 @@
|
||||
"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 = "HasuTL";
|
||||
exports.name = "Hasu Translations";
|
||||
exports.site = "https://hasutl.wordpress.com/";
|
||||
exports.version = "1.0.0";
|
||||
exports.icon = "src/es/hasutl/icon.png";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = function (page) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let url = baseUrl + "light-novels-activas/";
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio("div.wp-block-columns").each(function () {
|
||||
const novelName = loadedCheerio(this).find(".wp-block-button").text();
|
||||
const novelCover = loadedCheerio(this).find("img").attr("src");
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find(".wp-block-button > 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();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novel = {
|
||||
url,
|
||||
};
|
||||
novel.url = novelUrl;
|
||||
novel.name = loadedCheerio(".post-header").text();
|
||||
novel.cover = loadedCheerio(".featured-media > img").attr("src");
|
||||
let novelSummary = loadedCheerio(".post-content").find("p").html();
|
||||
novel.summary = novelSummary;
|
||||
let novelChapters = [];
|
||||
loadedCheerio(".wp-block-media-text__content")
|
||||
.find("a")
|
||||
.each(function () {
|
||||
const chapterName = loadedCheerio(this).text().trim();
|
||||
const releaseDate = null;
|
||||
let chapterUrl = loadedCheerio(this).attr("href");
|
||||
if (!chapterUrl)
|
||||
return;
|
||||
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();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let chapterText = loadedCheerio(".post-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);
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio(".post-container ").each(function () {
|
||||
const novelName = loadedCheerio(this).find(".post-header").text();
|
||||
if (!novelName.includes("Cap") &&
|
||||
!novelName.includes("Vol") &&
|
||||
!novelName.includes("Light Novels")) {
|
||||
const novelCover = loadedCheerio(this).find("img").attr("src");
|
||||
let novelUrl = loadedCheerio(this).find("a").attr("href");
|
||||
if (!novelUrl)
|
||||
return;
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
}
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.searchNovels = searchNovels;
|
||||
exports.fetchImage = fetch_1.fetchFile;
|
||||
@@ -0,0 +1,157 @@
|
||||
"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 = "ligera.com";
|
||||
exports.name = "Novelas Ligera";
|
||||
exports.site = "https://novelasligera.com/";
|
||||
exports.version = "1.0.0";
|
||||
exports.icon = "src/es/novelasligera/icon.png";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = function (page) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let url = baseUrl;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio(".elementor-column").each(function () {
|
||||
const novelName = loadedCheerio(this)
|
||||
.find(".widget-image-caption.wp-caption-text")
|
||||
.text();
|
||||
if (novelName) {
|
||||
const novelCover = loadedCheerio(this)
|
||||
.find("a > img")
|
||||
.attr("data-lazy-src");
|
||||
let 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 = baseUrl + "novela/" + novelUrl;
|
||||
// console.log(url);
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novel = { url };
|
||||
novel.name = loadedCheerio("h1").text();
|
||||
novel.cover = loadedCheerio(".elementor-widget-container")
|
||||
.find("img")
|
||||
.attr("src");
|
||||
loadedCheerio(".elementor-row")
|
||||
.find("p")
|
||||
.each(function () {
|
||||
if (loadedCheerio(this).text().includes("Autor:")) {
|
||||
novel.author = loadedCheerio(this)
|
||||
.text()
|
||||
.replace("Autor:", "")
|
||||
.trim();
|
||||
}
|
||||
if (loadedCheerio(this).text().includes("Estado:")) {
|
||||
novel.status = loadedCheerio(this)
|
||||
.text()
|
||||
.replace("Estado: ", "")
|
||||
.trim();
|
||||
}
|
||||
if (loadedCheerio(this).text().includes("Género:")) {
|
||||
loadedCheerio(this).find("span").remove();
|
||||
novel.genres = loadedCheerio(this)
|
||||
.text()
|
||||
.replace(/,\s/g, ",");
|
||||
}
|
||||
});
|
||||
novel.summary = loadedCheerio(".elementor-text-editor.elementor-clearfix").text();
|
||||
let novelChapters = [];
|
||||
loadedCheerio(".elementor-accordion-item").remove();
|
||||
loadedCheerio(".elementor-tab-content")
|
||||
.find("li")
|
||||
.each(function () {
|
||||
const chapterName = loadedCheerio(this).text();
|
||||
const releaseDate = null;
|
||||
const chapterUrl = loadedCheerio(this).find("a").attr("href");
|
||||
if (!chapterUrl)
|
||||
return;
|
||||
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;
|
||||
// console.log(url);
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio(".osny-nightmode.osny-nightmode--left").remove();
|
||||
loadedCheerio(".code-block.code-block-1").remove();
|
||||
loadedCheerio(".adsb30").remove();
|
||||
loadedCheerio(".saboxplugin-wrap").remove();
|
||||
loadedCheerio(".wp-post-navigation").remove();
|
||||
let chapterText = loadedCheerio(".entry-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";
|
||||
// console.log(url);
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio(".inside-article").each(function () {
|
||||
const novelCover = loadedCheerio(this).find("img").attr("src");
|
||||
let novelUrl = loadedCheerio(this).find("a").attr("href");
|
||||
let novelName;
|
||||
if (novelUrl) {
|
||||
novelName = novelUrl.replace(/-/g, " ").replace(/^./, function (x) {
|
||||
return x.toUpperCase();
|
||||
});
|
||||
}
|
||||
novelUrl += "/";
|
||||
if (!novelName || !novelUrl)
|
||||
return;
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
novels = [Object.assign({}, novels[1])];
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.searchNovels = searchNovels;
|
||||
exports.fetchImage = fetch_1.fetchFile;
|
||||
@@ -0,0 +1,146 @@
|
||||
"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 fetch_1 = require("@libs/fetch");
|
||||
const cheerio_1 = require("cheerio");
|
||||
const novelStatus_1 = require("@libs/novelStatus");
|
||||
const defaultCover_1 = require("@libs/defaultCover");
|
||||
exports.id = "TNL.com";
|
||||
exports.name = "TuNovelaLigera";
|
||||
exports.site = "https://tunovelaligera.com/";
|
||||
exports.version = "1.0.0";
|
||||
exports.icon = "src/es/tunovelaligera/icon.png";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = function (page) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let url = baseUrl + "novelas/page/" + page + "/?m_orderby=rating";
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio(".page-item-detail").each(function () {
|
||||
const novelName = loadedCheerio(this).find(".h5 > a").text();
|
||||
const novelCover = loadedCheerio(this).find("img").attr("src");
|
||||
let 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);
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novel = {
|
||||
url,
|
||||
};
|
||||
loadedCheerio(".manga-title-badges").remove();
|
||||
novel.name = loadedCheerio(".post-title > h1").text().trim();
|
||||
let novelCover = loadedCheerio(".summary_image > a > img");
|
||||
novel.cover =
|
||||
novelCover.attr("data-src") ||
|
||||
novelCover.attr("src") ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio(".post-content_item").each(function () {
|
||||
const detailName = loadedCheerio(this)
|
||||
.find(".summary-heading > h5")
|
||||
.text()
|
||||
.trim();
|
||||
const detail = loadedCheerio(this)
|
||||
.find(".summary-content")
|
||||
.text()
|
||||
.trim();
|
||||
switch (detailName) {
|
||||
case "Generos":
|
||||
novel.genres = detail.replace(/, /g, ",");
|
||||
break;
|
||||
case "Autores":
|
||||
novel.author = detail;
|
||||
break;
|
||||
case "Estado":
|
||||
novel.status =
|
||||
detail.includes("OnGoing") ||
|
||||
detail.includes("Updating")
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
novel.summary = loadedCheerio("div.summary__content > p").text().trim();
|
||||
let novelChapters = [];
|
||||
loadedCheerio(".lcp_catlist li").each(function () {
|
||||
const chapterName = loadedCheerio(this)
|
||||
.find("a")
|
||||
.text()
|
||||
.replace(/[\t\n]/g, "")
|
||||
.trim();
|
||||
const releaseDate = loadedCheerio(this).find("span").text().trim();
|
||||
let chapterUrl = loadedCheerio(this).find("a").attr("href");
|
||||
if (!chapterUrl)
|
||||
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);
|
||||
let chapterText = loadedCheerio("#hola_siguiente").next().text();
|
||||
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);
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio(".c-tabs-item__content").each(function () {
|
||||
const novelName = loadedCheerio(this).find(".h4 > a").text();
|
||||
const novelCover = loadedCheerio(this).find("img").attr("src");
|
||||
let novelUrl = loadedCheerio(this).find(".h4 > a").attr("href");
|
||||
if (!novelUrl)
|
||||
return;
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
novels.push(novel);
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.searchNovels = searchNovels;
|
||||
exports.fetchImage = fetch_1.fetchFile;
|
||||
@@ -0,0 +1,160 @@
|
||||
"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 fetch_1 = require("@libs/fetch");
|
||||
const cheerio_1 = require("cheerio");
|
||||
exports.id = "yuukitls.com";
|
||||
exports.name = "Yuuki Tls";
|
||||
exports.site = "https://yuukitls.com/";
|
||||
exports.version = "1.0.0";
|
||||
exports.icon = "src/es/yuukitls/icon.png";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = function (page) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let url = baseUrl;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio(".quadmenu-navbar-collapse ul li:nth-child(2)")
|
||||
.find("li")
|
||||
.each(function () {
|
||||
const novelName = loadedCheerio(this)
|
||||
.text()
|
||||
.replace(/[\s\n]+/g, " ");
|
||||
const novelCover = loadedCheerio(this).find("img").attr("src");
|
||||
let 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();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novel = {
|
||||
url,
|
||||
};
|
||||
novel.name = loadedCheerio("h1.entry-title")
|
||||
.text()
|
||||
.replace(/[\t\n]/g, "")
|
||||
.trim();
|
||||
novel.cover = loadedCheerio('img[loading="lazy"]').attr("src");
|
||||
loadedCheerio(".entry-content")
|
||||
.find("div")
|
||||
.each(function () {
|
||||
if (loadedCheerio(this).text().includes("Escritor:")) {
|
||||
novel.author = loadedCheerio(this)
|
||||
.text()
|
||||
.replace("Escritor: ", "")
|
||||
.trim();
|
||||
}
|
||||
if (loadedCheerio(this).text().includes("Género:")) {
|
||||
novel.genres = loadedCheerio(this)
|
||||
.text()
|
||||
.replace(/Género: |\s/g, "");
|
||||
}
|
||||
if (loadedCheerio(this).text().includes("Sinopsis:")) {
|
||||
novel.summary = loadedCheerio(this).next().text();
|
||||
}
|
||||
});
|
||||
let novelChapters = [];
|
||||
if (loadedCheerio(".entry-content").find("li").length) {
|
||||
loadedCheerio(".entry-content")
|
||||
.find("li")
|
||||
.each(function () {
|
||||
let chapterUrl = loadedCheerio(this).find("a").attr("href");
|
||||
if (chapterUrl && chapterUrl.includes(baseUrl)) {
|
||||
const chapterName = loadedCheerio(this).text();
|
||||
const releaseDate = null;
|
||||
const chapter = {
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
};
|
||||
novelChapters.push(chapter);
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
loadedCheerio(".entry-content")
|
||||
.find("p")
|
||||
.each(function () {
|
||||
let chapterUrl = loadedCheerio(this).find("a").attr("href");
|
||||
if (chapterUrl && chapterUrl.includes(baseUrl)) {
|
||||
const chapterName = loadedCheerio(this).text();
|
||||
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 url = chapterUrl;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let chapterText = loadedCheerio(".entry-content").html();
|
||||
return chapterText;
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = function (searchTerm) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
searchTerm = searchTerm.toLowerCase();
|
||||
let url = baseUrl;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio(".menu-item-2869")
|
||||
.find(".menu-item.menu-item-type-post_type.menu-item-object-post")
|
||||
.each(function () {
|
||||
const novelName = loadedCheerio(this).text();
|
||||
const novelCover = loadedCheerio(this).find("img").attr("src");
|
||||
let 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));
|
||||
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 = "turkcelightnovels";
|
||||
exports.name = "TurkceLightNovels [madara]";
|
||||
exports.icon = "multisrc/madara/icons/turkcelightnovels.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://turkcelightnovels.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 + "light-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 + "/" + "light-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 = "webnoveloku";
|
||||
exports.name = "WebNovelOku [madara]";
|
||||
exports.icon = "multisrc/madara/icons/webnoveloku.png";
|
||||
exports.version = "1.0.0";
|
||||
exports.site = "https://www.webnoveloku.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,142 @@
|
||||
"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 = "epiknovel.com";
|
||||
exports.name = "EpikNovel";
|
||||
exports.site = "https://www.epiknovel.com/";
|
||||
exports.version = "1.0.0";
|
||||
exports.icon = "src/tr/epiknovel/icon.png";
|
||||
const baseUrl = exports.site;
|
||||
const popularNovels = function (page) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let url = baseUrl + "seri-listesi?Sayfa=" + page;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novels = [];
|
||||
loadedCheerio("div.col-lg-12.col-md-12").each(function () {
|
||||
const novelName = loadedCheerio(this).find("h3").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);
|
||||
});
|
||||
// console.log(novels);
|
||||
return novels;
|
||||
});
|
||||
};
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = function (novelUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = novelUrl;
|
||||
// console.log(url);
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let novel = { url };
|
||||
novel.name = loadedCheerio("h1#tables").text().trim();
|
||||
novel.cover = loadedCheerio("img.manga-cover").attr("src");
|
||||
novel.summary = loadedCheerio("#wrapper > div.row > div.col-md-9 > div:nth-child(6) > p:nth-child(3)")
|
||||
.text()
|
||||
.trim();
|
||||
novel.status = loadedCheerio("#wrapper > div.row > div.col-md-9 > div.row > div.col-md-9 > h4:nth-child(3) > a")
|
||||
.text()
|
||||
.trim();
|
||||
novel.author = loadedCheerio("#NovelInfo > p:nth-child(4)")
|
||||
.text()
|
||||
.replace(/Publisher:|\s/g, "")
|
||||
.trim();
|
||||
let novelChapters = [];
|
||||
loadedCheerio("table").find("tr").first().remove();
|
||||
loadedCheerio("table")
|
||||
.find("tr")
|
||||
.each(function () {
|
||||
const releaseDate = loadedCheerio(this)
|
||||
.find("td:nth-child(3)")
|
||||
.text();
|
||||
let chapterName = loadedCheerio(this)
|
||||
.find("td:nth-child(1) > a")
|
||||
.text();
|
||||
if (loadedCheerio(this).find("td:nth-child(1) > span").length >
|
||||
0) {
|
||||
chapterName = "🔒 " + chapterName;
|
||||
}
|
||||
const chapterUrl = loadedCheerio(this)
|
||||
.find(" td:nth-child(1) > a")
|
||||
.attr("href");
|
||||
if (!chapterUrl)
|
||||
return;
|
||||
novelChapters.push({
|
||||
name: chapterName,
|
||||
url: chapterUrl,
|
||||
releaseTime: releaseDate,
|
||||
});
|
||||
});
|
||||
novel.chapters = novelChapters;
|
||||
// console.log(novel);
|
||||
return novel;
|
||||
});
|
||||
};
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = function (chapterUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = chapterUrl;
|
||||
// console.log(url);
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
let chapterName, chapterText;
|
||||
if (result.url === "https://www.epiknovel.com/login") {
|
||||
chapterName = "";
|
||||
chapterText = "Premium Chapter";
|
||||
}
|
||||
else {
|
||||
chapterName = loadedCheerio("#icerik > center > h4 > b").text();
|
||||
chapterText = loadedCheerio("div#icerik").html();
|
||||
}
|
||||
return chapterText;
|
||||
});
|
||||
};
|
||||
exports.parseChapter = parseChapter;
|
||||
const searchNovels = function (searchTerm) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = baseUrl + "seri-listesi?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("div.col-lg-12.col-md-12").each(function () {
|
||||
const novelName = loadedCheerio(this).find("h3").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;
|
||||
exports.fetchImage = fetch_1.fetchFile;
|
||||
@@ -0,0 +1,248 @@
|
||||
"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 = "lshnovel";
|
||||
exports.name = "Liebe Schnee Hiver Novel";
|
||||
exports.version = "1.0.0";
|
||||
exports.icon = "multisrc/wpmangastream/icons/lshnovel.png";
|
||||
exports.site = "https://lshnovel.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.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 (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(".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, {}, pluginId);
|
||||
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 = `${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.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: baseUrl,
|
||||
};
|
||||
return yield (0, fetch_1.fetchFile)(url, { headers: headers });
|
||||
});
|
||||
};
|
||||
exports.fetchImage = fetchImage;
|
||||
exports.filters = [
|
||||
{
|
||||
key: "order",
|
||||
label: "Önerilen",
|
||||
values: [
|
||||
{ label: "Varsayılan", value: "" },
|
||||
{ label: "A-Z", value: "title" },
|
||||
{ label: "Z-A", value: "titlereverse" },
|
||||
{ label: "Son Yüklemeler", value: "update" },
|
||||
{ label: "Son Eklenenler", value: "latest" },
|
||||
{ label: "Bestimiz", value: "popular" },
|
||||
],
|
||||
inputType: filterInputs_1.FilterInputs.Picker,
|
||||
},
|
||||
{
|
||||
key: "status",
|
||||
label: "Statü",
|
||||
values: [
|
||||
{ label: "Tümü", value: "" },
|
||||
{ label: "Ongoing", value: "ongoing" },
|
||||
{ label: "Hiatus", value: "hiatus" },
|
||||
{ label: "Completed", value: "completed" },
|
||||
],
|
||||
inputType: filterInputs_1.FilterInputs.Picker,
|
||||
},
|
||||
{
|
||||
key: "type",
|
||||
label: "Tür",
|
||||
values: [
|
||||
{ label: "Çeviri Novel", value: "ceviri-novel" },
|
||||
{ label: "Liz-Chan", value: "liz-chan" },
|
||||
{ label: "Manhwa", value: "manhwa" },
|
||||
{ label: "Orijinal Novel", value: "orijinal-novel" },
|
||||
{ label: "Web Novel", value: "web-novel" },
|
||||
],
|
||||
inputType: filterInputs_1.FilterInputs.Checkbox,
|
||||
},
|
||||
{
|
||||
key: "genres",
|
||||
label: "Kategori",
|
||||
values: [
|
||||
{ label: "+18", value: "18" },
|
||||
{ label: "Action", value: "action" },
|
||||
{ label: "Adult", value: "adult" },
|
||||
{ label: "Aksiyon", value: "aksiyon" },
|
||||
{ label: "BL", value: "bl" },
|
||||
{ label: "Comedy", value: "comedy" },
|
||||
{ label: "Doğaüstü", value: "dogaustu" },
|
||||
{ label: "Dram", value: "dram" },
|
||||
{ label: "Drama", value: "drama" },
|
||||
{ label: "Ecchi", value: "ecchi" },
|
||||
{ label: "Fantastik", value: "fantastik" },
|
||||
{ label: "Fantasy", value: "fantasy" },
|
||||
{ label: "Gizem", value: "gizem" },
|
||||
{ label: "Harem", value: "harem" },
|
||||
{ label: "Historical", value: "historical" },
|
||||
{ label: "Josei", value: "josei" },
|
||||
{ label: "Macera", value: "macera" },
|
||||
{ label: "Manhwa", value: "manhwa" },
|
||||
{ label: "Martial Arts", value: "martial-arts" },
|
||||
{ label: "Mature", value: "mature" },
|
||||
{ label: "Novel", value: "novel" },
|
||||
{ label: "Okul", value: "okul" },
|
||||
{ label: "Psikolojik", value: "psikolojik" },
|
||||
{ label: "Psychological", value: "psychological" },
|
||||
{ label: "Reverse Harem", value: "reverse-harem" },
|
||||
{ label: "Romance", value: "romance" },
|
||||
{ label: "Romantik", value: "romantik" },
|
||||
{ label: "Shoujo", value: "shoujo" },
|
||||
{ label: "Slice Of Life", value: "slice-of-life" },
|
||||
{ label: "Smut", value: "smut" },
|
||||
{ label: "Supernatural", value: "supernatural" },
|
||||
{ label: "Tarihi", value: "tarihi" },
|
||||
{ label: "Tragedy", value: "tragedy" },
|
||||
{ label: "Yaoi", value: "yaoi" },
|
||||
],
|
||||
inputType: filterInputs_1.FilterInputs.Checkbox,
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,163 @@
|
||||
"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");
|
||||
const fetch_1 = require("@libs/fetch");
|
||||
// import dayjs from "dayjs";
|
||||
// import { FilterInputs } from "@libs/filterInputs";
|
||||
// import { NovelStatus } from "@libs/novelStatus";
|
||||
const isAbsoluteUrl_1 = require("@libs/isAbsoluteUrl");
|
||||
// import { parseMadaraDate } from "@libs/parseMadaraDate";
|
||||
const pluginId = "ln.hako";
|
||||
const baseUrl = "https://ln.hako.vn";
|
||||
exports.id = pluginId; // string and must be unique
|
||||
exports.name = "Hako";
|
||||
exports.icon = "src/vi/hakolightnovel/icon.png"; // The relative path to the icon without @icons . For example: 'src/vi/hakolightnovel/icon.png'
|
||||
exports.version = "1.0.0"; // xx.xx.xx
|
||||
exports.site = baseUrl; // the link to the site
|
||||
exports["protected"] = true;
|
||||
const popularNovels = (pageNo) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novels = [];
|
||||
const link = baseUrl + "/danh-sach?truyendich=1&sapxep=topthang&page=" + pageNo;
|
||||
const result = yield (0, fetch_1.fetchApi)(link);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio("main.row > .thumb-item-flow").each(function () {
|
||||
let url = loadedCheerio(this)
|
||||
.find("div.thumb_attr.series-title > a")
|
||||
.attr("href");
|
||||
if (url && !(0, isAbsoluteUrl_1.isUrlAbsolute)(url)) {
|
||||
url = baseUrl + url;
|
||||
}
|
||||
if (url) {
|
||||
const name = loadedCheerio(this)
|
||||
.find(".series-title")
|
||||
.text()
|
||||
.trim();
|
||||
let cover = loadedCheerio(this)
|
||||
.find(".img-in-ratio")
|
||||
.attr("data-bg");
|
||||
if (cover && !(0, isAbsoluteUrl_1.isUrlAbsolute)(cover)) {
|
||||
cover = baseUrl + cover;
|
||||
}
|
||||
const novel = {
|
||||
name,
|
||||
url,
|
||||
cover,
|
||||
};
|
||||
novels.push(novel);
|
||||
}
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.popularNovels = popularNovels;
|
||||
const parseNovelAndChapters = (novelUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const novel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
const result = yield (0, fetch_1.fetchApi)(novelUrl);
|
||||
const body = yield result.text();
|
||||
let loadedCheerio = (0, cheerio_1.load)(body);
|
||||
novel.name = loadedCheerio(".series-name").text();
|
||||
const background = loadedCheerio(".series-cover > .a6-ratio > div").attr("style") || "";
|
||||
const novelCover = background.substring(background.indexOf("http"), background.length - 2);
|
||||
novel.cover = novelCover
|
||||
? (0, isAbsoluteUrl_1.isUrlAbsolute)(novelCover)
|
||||
? novelCover
|
||||
: baseUrl + novelCover
|
||||
: "";
|
||||
novel.summary = loadedCheerio(".summary-content").text().trim();
|
||||
novel.author = loadedCheerio("#mainpart > div:nth-child(2) > div > div:nth-child(1) > section > main > div.top-part > div > div.col-12.col-md-9 > div.series-information > div:nth-child(2) > span.info-value > a")
|
||||
.text()
|
||||
.trim();
|
||||
novel.genres = loadedCheerio(".series-gernes")
|
||||
.text()
|
||||
.trim()
|
||||
.replace(/ +/g, " ")
|
||||
.split("\n")
|
||||
.filter((e) => e.trim())
|
||||
.join(", ");
|
||||
novel.status = loadedCheerio("#mainpart > div:nth-child(2) > div > div:nth-child(1) > section > main > div.top-part > div > div.col-12.col-md-9 > div.series-information > div:nth-child(4) > span.info-value > a")
|
||||
.text()
|
||||
.trim();
|
||||
const chapters = [];
|
||||
loadedCheerio(".list-chapters li").each(function () {
|
||||
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(".chapter-name")
|
||||
.text()
|
||||
.trim();
|
||||
const releaseTime = loadedCheerio(this)
|
||||
.find(".chapter-time")
|
||||
.text();
|
||||
const chapter = {
|
||||
name: chapterName,
|
||||
releaseTime: releaseTime,
|
||||
url: chapterUrl,
|
||||
};
|
||||
chapters.push(chapter);
|
||||
}
|
||||
});
|
||||
novel.chapters = chapters;
|
||||
return novel;
|
||||
});
|
||||
exports.parseNovelAndChapters = parseNovelAndChapters;
|
||||
const parseChapter = (chapterUrl) => __awaiter(void 0, 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 url = baseUrl + "/tim-kiem?keywords=" + searchTerm;
|
||||
const result = yield (0, fetch_1.fetchApi)(url);
|
||||
const body = yield result.text();
|
||||
const loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio("div.row > .thumb-item-flow").each(function () {
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find("div.thumb_attr.series-title > a")
|
||||
.attr("href");
|
||||
if (novelUrl && !(0, isAbsoluteUrl_1.isUrlAbsolute)(novelUrl)) {
|
||||
novelUrl = baseUrl + novelUrl;
|
||||
}
|
||||
if (novelUrl) {
|
||||
const novelName = loadedCheerio(this).find(".series-title").text();
|
||||
let novelCover = loadedCheerio(this)
|
||||
.find(".img-in-ratio")
|
||||
.attr("data-bg");
|
||||
if (novelCover && !(0, isAbsoluteUrl_1.isUrlAbsolute)(novelCover)) {
|
||||
novelCover = baseUrl + novelCover;
|
||||
}
|
||||
novels.push({
|
||||
name: novelName,
|
||||
url: novelUrl,
|
||||
cover: novelCover,
|
||||
});
|
||||
}
|
||||
});
|
||||
return novels;
|
||||
});
|
||||
exports.searchNovels = searchNovels;
|
||||
const fetchImage = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const headers = {
|
||||
Referer: "https://ln.hako.vn",
|
||||
};
|
||||
return yield (0, fetch_1.fetchFile)(url, { headers: headers });
|
||||
});
|
||||
exports.fetchImage = fetchImage;
|
||||
Reference in New Issue
Block a user