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:
nyagami
2023-08-17 10:19:45 +07:00
committed by GitHub
parent e444031c25
commit e602df44c8
306 changed files with 58843 additions and 14008 deletions
+205
View File
@@ -0,0 +1,205 @@
import { load as parseHTML } from "cheerio";
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus"
import { parseMadaraDate } from "@libs/parseMadaraDate";
import dayjs from "dayjs";
export const id = "boxnovel";
export const name = "BoxNovel [madara]";
export const icon = "multisrc/madara/icons/boxnovel.png";
export const version = "1.0.0";
export const site = "https://boxnovel.com/";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
const novels: Novel.Item[] = [];
const sortOrder = showLatestNovels
? '?m_orderby=latest'
: '/?m_orderby=rating';
let url = site + "novel" + '/page/' + pageNo + sortOrder;
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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: Novel.Item = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters = async (
novelUrl
) => {
const novel: Novel.instance = {
url: novelUrl,
};
const body = await fetchApi(novelUrl).then(res => res.text());
let loadedCheerio = parseHTML(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;
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.Ongoing
: 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 = await fetchApi(
baseUrl + 'wp-admin/admin-ajax.php',
{
method: 'POST',
body: JSON.stringify(body),
})
.then(res => res.text());
} else {
html = await fetchApi(
baseUrl + 'ajax/chapters/',
{ method: 'POST' })
.then(res => res.text());
}
if (html !== '0') {
loadedCheerio = parseHTML(html);
}
const chapters: Chapter.Item[] = [];
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 = parseMadaraDate(releaseDate);
} else {
/**
* Insert current date
*/
releaseDate = dayjs().format('LL');
}
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = chapters.reverse();
return novel;
};
export const parseChapter: Plugin.parseChapter = async (chapterUrl) => {
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
const body = await fetchApi(chapterUrl).then(res => res.text());
const loadedCheerio = parseHTML(body);
const chapterText =
loadedCheerio('.text-left').html() ||
loadedCheerio('.text-right').html() ||
loadedCheerio('.entry-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url);
};
+205
View File
@@ -0,0 +1,205 @@
import { load as parseHTML } from "cheerio";
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus"
import { parseMadaraDate } from "@libs/parseMadaraDate";
import dayjs from "dayjs";
export const id = "clicknovel";
export const name = "ClickNovel [madara]";
export const icon = "multisrc/madara/icons/clicknovel.png";
export const version = "1.0.0";
export const site = "https://clicknovel.net/";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
const novels: Novel.Item[] = [];
const sortOrder = showLatestNovels
? '?m_orderby=latest'
: '/?m_orderby=rating';
let url = site + "novel" + '/page/' + pageNo + sortOrder;
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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: Novel.Item = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters = async (
novelUrl
) => {
const novel: Novel.instance = {
url: novelUrl,
};
const body = await fetchApi(novelUrl).then(res => res.text());
let loadedCheerio = parseHTML(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;
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.Ongoing
: 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 = await fetchApi(
baseUrl + 'wp-admin/admin-ajax.php',
{
method: 'POST',
body: JSON.stringify(body),
})
.then(res => res.text());
} else {
html = await fetchApi(
baseUrl + 'ajax/chapters/',
{ method: 'POST' })
.then(res => res.text());
}
if (html !== '0') {
loadedCheerio = parseHTML(html);
}
const chapters: Chapter.Item[] = [];
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 = parseMadaraDate(releaseDate);
} else {
/**
* Insert current date
*/
releaseDate = dayjs().format('LL');
}
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = chapters.reverse();
return novel;
};
export const parseChapter: Plugin.parseChapter = async (chapterUrl) => {
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
const body = await fetchApi(chapterUrl).then(res => res.text());
const loadedCheerio = parseHTML(body);
const chapterText =
loadedCheerio('.text-left').html() ||
loadedCheerio('.text-right').html() ||
loadedCheerio('.entry-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url);
};
+205
View File
@@ -0,0 +1,205 @@
import { load as parseHTML } from "cheerio";
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus"
import { parseMadaraDate } from "@libs/parseMadaraDate";
import dayjs from "dayjs";
export const id = "cratenovel";
export const name = "CrateNovel [madara]";
export const icon = "multisrc/madara/icons/cratenovel.png";
export const version = "1.0.0";
export const site = "https://cratenovel.com/";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
const novels: Novel.Item[] = [];
const sortOrder = showLatestNovels
? '?m_orderby=latest'
: '/?m_orderby=rating';
let url = site + "novel" + '/page/' + pageNo + sortOrder;
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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: Novel.Item = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters = async (
novelUrl
) => {
const novel: Novel.instance = {
url: novelUrl,
};
const body = await fetchApi(novelUrl).then(res => res.text());
let loadedCheerio = parseHTML(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;
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.Ongoing
: 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 = await fetchApi(
baseUrl + 'wp-admin/admin-ajax.php',
{
method: 'POST',
body: JSON.stringify(body),
})
.then(res => res.text());
} else {
html = await fetchApi(
baseUrl + 'ajax/chapters/',
{ method: 'POST' })
.then(res => res.text());
}
if (html !== '0') {
loadedCheerio = parseHTML(html);
}
const chapters: Chapter.Item[] = [];
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 = parseMadaraDate(releaseDate);
} else {
/**
* Insert current date
*/
releaseDate = dayjs().format('LL');
}
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = chapters.reverse();
return novel;
};
export const parseChapter: Plugin.parseChapter = async (chapterUrl) => {
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
const body = await fetchApi(chapterUrl).then(res => res.text());
const loadedCheerio = parseHTML(body);
const chapterText =
loadedCheerio('.text-left').html() ||
loadedCheerio('.text-right').html() ||
loadedCheerio('.entry-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url);
};
+205
View File
@@ -0,0 +1,205 @@
import { load as parseHTML } from "cheerio";
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus"
import { parseMadaraDate } from "@libs/parseMadaraDate";
import dayjs from "dayjs";
export const id = "daonovel";
export const name = "DaoNovel [madara]";
export const icon = "multisrc/madara/icons/daonovel.png";
export const version = "1.0.0";
export const site = "https://daonovel.com/";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
const novels: Novel.Item[] = [];
const sortOrder = showLatestNovels
? '?m_orderby=latest'
: '/?m_orderby=rating';
let url = site + "novels-list" + '/page/' + pageNo + sortOrder;
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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: Novel.Item = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters = async (
novelUrl
) => {
const novel: Novel.instance = {
url: novelUrl,
};
const body = await fetchApi(novelUrl).then(res => res.text());
let loadedCheerio = parseHTML(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;
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.Ongoing
: 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 = await fetchApi(
baseUrl + 'wp-admin/admin-ajax.php',
{
method: 'POST',
body: JSON.stringify(body),
})
.then(res => res.text());
} else {
html = await fetchApi(
baseUrl + 'ajax/chapters/',
{ method: 'POST' })
.then(res => res.text());
}
if (html !== '0') {
loadedCheerio = parseHTML(html);
}
const chapters: Chapter.Item[] = [];
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 = parseMadaraDate(releaseDate);
} else {
/**
* Insert current date
*/
releaseDate = dayjs().format('LL');
}
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = chapters.reverse();
return novel;
};
export const parseChapter: Plugin.parseChapter = async (chapterUrl) => {
const url = baseUrl + "/" + "novels" + "/" + chapterUrl;
const body = await fetchApi(chapterUrl).then(res => res.text());
const loadedCheerio = parseHTML(body);
const chapterText =
loadedCheerio('.text-left').html() ||
loadedCheerio('.text-right').html() ||
loadedCheerio('.entry-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url);
};
+205
View File
@@ -0,0 +1,205 @@
import { load as parseHTML } from "cheerio";
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus"
import { parseMadaraDate } from "@libs/parseMadaraDate";
import dayjs from "dayjs";
export const id = "fanTLS";
export const name = "Fans Translations [madara]";
export const icon = "multisrc/madara/icons/fanstranslations.png";
export const version = "1.0.0";
export const site = "https://fanstranslations.com/";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
const novels: Novel.Item[] = [];
const sortOrder = showLatestNovels
? '?m_orderby=latest'
: '/?m_orderby=rating';
let url = site + "novel" + '/page/' + pageNo + sortOrder;
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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: Novel.Item = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters = async (
novelUrl
) => {
const novel: Novel.instance = {
url: novelUrl,
};
const body = await fetchApi(novelUrl).then(res => res.text());
let loadedCheerio = parseHTML(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;
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.Ongoing
: 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 = await fetchApi(
baseUrl + 'wp-admin/admin-ajax.php',
{
method: 'POST',
body: JSON.stringify(body),
})
.then(res => res.text());
} else {
html = await fetchApi(
baseUrl + 'ajax/chapters/',
{ method: 'POST' })
.then(res => res.text());
}
if (html !== '0') {
loadedCheerio = parseHTML(html);
}
const chapters: Chapter.Item[] = [];
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 = parseMadaraDate(releaseDate);
} else {
/**
* Insert current date
*/
releaseDate = dayjs().format('LL');
}
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = chapters.reverse();
return novel;
};
export const parseChapter: Plugin.parseChapter = async (chapterUrl) => {
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
const body = await fetchApi(chapterUrl).then(res => res.text());
const loadedCheerio = parseHTML(body);
const chapterText =
loadedCheerio('.text-left').html() ||
loadedCheerio('.text-right').html() ||
loadedCheerio('.entry-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url);
};
+205
View File
@@ -0,0 +1,205 @@
import { load as parseHTML } from "cheerio";
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus"
import { parseMadaraDate } from "@libs/parseMadaraDate";
import dayjs from "dayjs";
export const id = "1stkissnovel";
export const name = "FirstKissNovel [madara]";
export const icon = "multisrc/madara/icons/firstkissnovel.png";
export const version = "1.0.0";
export const site = "https://1stkissnovel.org/";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
const novels: Novel.Item[] = [];
const sortOrder = showLatestNovels
? '?m_orderby=latest'
: '/?m_orderby=rating';
let url = site + "novel" + '/page/' + pageNo + sortOrder;
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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: Novel.Item = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters = async (
novelUrl
) => {
const novel: Novel.instance = {
url: novelUrl,
};
const body = await fetchApi(novelUrl).then(res => res.text());
let loadedCheerio = parseHTML(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;
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.Ongoing
: 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 = await fetchApi(
baseUrl + 'wp-admin/admin-ajax.php',
{
method: 'POST',
body: JSON.stringify(body),
})
.then(res => res.text());
} else {
html = await fetchApi(
baseUrl + 'ajax/chapters/',
{ method: 'POST' })
.then(res => res.text());
}
if (html !== '0') {
loadedCheerio = parseHTML(html);
}
const chapters: Chapter.Item[] = [];
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 = parseMadaraDate(releaseDate);
} else {
/**
* Insert current date
*/
releaseDate = dayjs().format('LL');
}
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = chapters.reverse();
return novel;
};
export const parseChapter: Plugin.parseChapter = async (chapterUrl) => {
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
const body = await fetchApi(chapterUrl).then(res => res.text());
const loadedCheerio = parseHTML(body);
const chapterText =
loadedCheerio('.text-left').html() ||
loadedCheerio('.text-right').html() ||
loadedCheerio('.entry-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url);
};
+205
View File
@@ -0,0 +1,205 @@
import { load as parseHTML } from "cheerio";
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus"
import { parseMadaraDate } from "@libs/parseMadaraDate";
import dayjs from "dayjs";
export const id = "freenovel.me";
export const name = "FreeNovelMe [madara]";
export const icon = "multisrc/madara/icons/freenovelme.png";
export const version = "1.0.0";
export const site = "https://freenovel.me/";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
const novels: Novel.Item[] = [];
const sortOrder = showLatestNovels
? '?m_orderby=latest'
: '/?m_orderby=rating';
let url = site + "novel" + '/page/' + pageNo + sortOrder;
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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: Novel.Item = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters = async (
novelUrl
) => {
const novel: Novel.instance = {
url: novelUrl,
};
const body = await fetchApi(novelUrl).then(res => res.text());
let loadedCheerio = parseHTML(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;
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.Ongoing
: 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 = await fetchApi(
baseUrl + 'wp-admin/admin-ajax.php',
{
method: 'POST',
body: JSON.stringify(body),
})
.then(res => res.text());
} else {
html = await fetchApi(
baseUrl + 'ajax/chapters/',
{ method: 'POST' })
.then(res => res.text());
}
if (html !== '0') {
loadedCheerio = parseHTML(html);
}
const chapters: Chapter.Item[] = [];
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 = parseMadaraDate(releaseDate);
} else {
/**
* Insert current date
*/
releaseDate = dayjs().format('LL');
}
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = chapters.reverse();
return novel;
};
export const parseChapter: Plugin.parseChapter = async (chapterUrl) => {
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
const body = await fetchApi(chapterUrl).then(res => res.text());
const loadedCheerio = parseHTML(body);
const chapterText =
loadedCheerio('.text-left').html() ||
loadedCheerio('.text-right').html() ||
loadedCheerio('.entry-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url);
};
+205
View File
@@ -0,0 +1,205 @@
import { load as parseHTML } from "cheerio";
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus"
import { parseMadaraDate } from "@libs/parseMadaraDate";
import dayjs from "dayjs";
export const id = "guavaread";
export const name = "Guavaread [madara]";
export const icon = "multisrc/madara/icons/guavaread.png";
export const version = "1.0.0";
export const site = "https://guavaread.com/";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
const novels: Novel.Item[] = [];
const sortOrder = showLatestNovels
? '?m_orderby=latest'
: '/?m_orderby=rating';
let url = site + "novel" + '/page/' + pageNo + sortOrder;
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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: Novel.Item = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters = async (
novelUrl
) => {
const novel: Novel.instance = {
url: novelUrl,
};
const body = await fetchApi(novelUrl).then(res => res.text());
let loadedCheerio = parseHTML(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;
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.Ongoing
: 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 = await fetchApi(
baseUrl + 'wp-admin/admin-ajax.php',
{
method: 'POST',
body: JSON.stringify(body),
})
.then(res => res.text());
} else {
html = await fetchApi(
baseUrl + 'ajax/chapters/',
{ method: 'POST' })
.then(res => res.text());
}
if (html !== '0') {
loadedCheerio = parseHTML(html);
}
const chapters: Chapter.Item[] = [];
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 = parseMadaraDate(releaseDate);
} else {
/**
* Insert current date
*/
releaseDate = dayjs().format('LL');
}
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = chapters.reverse();
return novel;
};
export const parseChapter: Plugin.parseChapter = async (chapterUrl) => {
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
const body = await fetchApi(chapterUrl).then(res => res.text());
const loadedCheerio = parseHTML(body);
const chapterText =
loadedCheerio('.text-left').html() ||
loadedCheerio('.text-right').html() ||
loadedCheerio('.entry-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url);
};
+205
View File
@@ -0,0 +1,205 @@
import { load as parseHTML } from "cheerio";
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus"
import { parseMadaraDate } from "@libs/parseMadaraDate";
import dayjs from "dayjs";
export const id = "lnheaven";
export const name = "LightNovelHeaven [madara]";
export const icon = "multisrc/madara/icons/lightnovelheaven.png";
export const version = "1.0.0";
export const site = "https://lightnovelheaven.com/";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
const novels: Novel.Item[] = [];
const sortOrder = showLatestNovels
? '?m_orderby=latest'
: '/?m_orderby=rating';
let url = site + "series" + '/page/' + pageNo + sortOrder;
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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: Novel.Item = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters = async (
novelUrl
) => {
const novel: Novel.instance = {
url: novelUrl,
};
const body = await fetchApi(novelUrl).then(res => res.text());
let loadedCheerio = parseHTML(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;
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.Ongoing
: 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 = await fetchApi(
baseUrl + 'wp-admin/admin-ajax.php',
{
method: 'POST',
body: JSON.stringify(body),
})
.then(res => res.text());
} else {
html = await fetchApi(
baseUrl + 'ajax/chapters/',
{ method: 'POST' })
.then(res => res.text());
}
if (html !== '0') {
loadedCheerio = parseHTML(html);
}
const chapters: Chapter.Item[] = [];
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 = parseMadaraDate(releaseDate);
} else {
/**
* Insert current date
*/
releaseDate = dayjs().format('LL');
}
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = chapters.reverse();
return novel;
};
export const parseChapter: Plugin.parseChapter = async (chapterUrl) => {
const url = baseUrl + "/" + "series" + "/" + chapterUrl;
const body = await fetchApi(chapterUrl).then(res => res.text());
const loadedCheerio = parseHTML(body);
const chapterText =
loadedCheerio('.text-left').html() ||
loadedCheerio('.text-right').html() ||
loadedCheerio('.entry-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url);
};
+168
View File
@@ -0,0 +1,168 @@
import { load as parseHTML } from "cheerio";
import { isUrlAbsolute } from "@libs/isAbsoluteUrl";
import { fetchApi, fetchFile } from "@libs/fetch";
import { Chapter, Novel, Plugin } from "@typings/plugin";
export const id = "LNR.org";
export const name = "LightNovelReader";
export const icon = "src/en/lightnovelreader/icon.png";
export const version = "1.0.0";
export const site = "https://lightnovelreader.org";
exports.protected = false;
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async function (page) {
const url = baseUrl + "/ranking/top-rated/" + page;
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = parseHTML(body);
const novels: Novel.Item[] = [];
loadedCheerio(".category-items.ranking-category.cm-list > ul > li").each(
function () {
let novelUrl = loadedCheerio(this).find("a").attr("href");
if (novelUrl && !isUrlAbsolute(novelUrl)) {
novelUrl = baseUrl + novelUrl;
}
if (novelUrl) {
const novelName = loadedCheerio(this)
.find(".category-name a")
.text()
.trim();
let novelCover = loadedCheerio(this)
.find(".category-img img")
.attr("src");
if (novelCover && !isUrlAbsolute(novelCover)) {
novelCover = baseUrl + novelCover;
}
const novel = {
url: novelUrl,
name: novelName,
cover: novelCover,
};
novels.push(novel);
}
}
);
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters =
async function (novelUrl) {
const url = novelUrl;
const result = await fetchApi(url);
const body = await result.text();
let loadedCheerio = parseHTML(body);
const novel: Novel.instance = {
url: novelUrl,
chapters: [],
};
novel.name = loadedCheerio(".section-header-title > h2").text();
let novelCover = loadedCheerio(".novels-detail img").attr("src");
novel.cover = novelCover
? isUrlAbsolute(novelCover)
? novelCover
: baseUrl + novelCover
: undefined;
novel.summary = loadedCheerio(
"div.container > div > div.col-12.col-xl-9 > div > div:nth-child(5) > div"
)
.text()
.trim();
novel.author = loadedCheerio(
"div.novels-detail-right > ul > li:nth-child(6) > .novels-detail-right-in-right > a"
)
.text()
.trim();
novel.genres = loadedCheerio(
"body > section:nth-child(4) > div > div > div.col-12.col-xl-9 > div > div:nth-child(2) > div > div.novels-detail-right > ul > li:nth-child(3) > div.novels-detail-right-in-right"
)
.text()
.trim();
novel.status = loadedCheerio(
"div.novels-detail-right > ul > li:nth-child(2) > .novels-detail-right-in-right"
)
.text()
.trim();
loadedCheerio(".cm-tabs-content > ul > li").each(function () {
let chapterUrl = loadedCheerio(this).find("a").attr("href");
if (chapterUrl && !isUrlAbsolute(chapterUrl)) {
chapterUrl = baseUrl + chapterUrl;
}
if (chapterUrl) {
const chapterName = loadedCheerio(this).find("a").text().trim();
const releaseDate = null;
const chapter: Chapter.Item = {
name: chapterName,
releaseTime: releaseDate,
url: chapterUrl,
};
novel.chapters?.push(chapter);
}
});
return novel;
};
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
const url = chapterUrl;
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = parseHTML(body);
const chapterText = loadedCheerio("#chapterText").html() || "";
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async function (searchTerm) {
const url =
baseUrl + `/search/autocomplete?dataType=json&query=${searchTerm}`;
const result = await fetchApi(url);
const body = await result.json();
const data = body?.results || [];
const novels: Novel.Item[] = [];
data.forEach((item) => {
let novelUrl = item.link;
let novelName = item.original_title;
let novelCover = item.image;
novels.push({
url: novelUrl,
name: novelName,
cover: novelCover,
});
});
return novels;
};
export const fetchImage: Plugin.fetchImage = async function (url) {
return await fetchFile(url, {});
};
-178
View File
@@ -1,178 +0,0 @@
const cheerio = require('cheerio');
const languages = require('@libs/languages');
const isUrlAbsolute = require('@libs/isAbsoluteUrl');
const fetchApi = require('@libs/fetchApi');
const fetchFile = require('@libs/fetchFile');
const pluginId = 'LNR.org';
const baseUrl = 'https://lightnovelreader.org';
async function popularNovels(page) {
const url = baseUrl + '/ranking/top-rated/' + page;
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = cheerio.load(body);
const novels = [];
loadedCheerio('.category-items.ranking-category.cm-list > ul > li').each(
function () {
let novelUrl = loadedCheerio(this).find('a').attr('href');
if (novelUrl && !isUrlAbsolute(novelUrl)) {
novelUrl = baseUrl + novelUrl;
}
if (novelUrl) {
const novelName = loadedCheerio(this)
.find('.category-name a')
.text()
.trim();
let novelCover = loadedCheerio(this)
.find('.category-img img')
.attr('src');
if (novelCover && !isUrlAbsolute(novelCover)) {
novelCover = baseUrl + novelCover;
}
const novel = {
url: novelUrl,
name: novelName,
cover: novelCover,
};
novels.push(novel);
}
},
);
return novels;
};
async function parseNovelAndChapters (novelUrl) {
const url = novelUrl;
const result = await fetchApi(url);
const body = await result.text();
let loadedCheerio = cheerio.load(body);
const novel = {
url: novelUrl,
chapters: [],
};
novel.name = loadedCheerio('.section-header-title > h2').text();
let novelCover = loadedCheerio('.novels-detail img').attr('src');
novel.cover = novelCover
? isUrlAbsolute(novelCover)
? novelCover
: baseUrl + novelCover
: undefined;
novel.summary = loadedCheerio(
'div.container > div > div.col-12.col-xl-9 > div > div:nth-child(5) > div',
)
.text()
.trim();
novel.author = loadedCheerio(
'div.novels-detail-right > ul > li:nth-child(6) > .novels-detail-right-in-right > a',
)
.text()
.trim();
novel.genres = loadedCheerio(
'body > section:nth-child(4) > div > div > div.col-12.col-xl-9 > div > div:nth-child(2) > div > div.novels-detail-right > ul > li:nth-child(3) > div.novels-detail-right-in-right',
)
.text()
.trim()
novel.status = loadedCheerio(
'div.novels-detail-right > ul > li:nth-child(2) > .novels-detail-right-in-right',
)
.text()
.trim();
loadedCheerio('.cm-tabs-content > ul > li').each(function () {
let chapterUrl = loadedCheerio(this).find('a').attr('href');
if (chapterUrl && !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,
};
novel.chapters.push(chapter);
}
});
return novel;
};
async function parseChapter(chapterUrl) {
const url = chapterUrl;
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = cheerio.load(body);
const chapterText = loadedCheerio('#chapterText').html() || '';
return chapterText;
};
async function searchNovels (searchTerm) {
const url = baseUrl + `/search/autocomplete?dataType=json&query=${searchTerm}`;
const result = await fetchApi(url);
const body = await result.json();
const data = body.results || [];
const novels = [];
data.forEach(item => {
let novelUrl = item.link;
let novelName = item.original_title
let novelCover = item.image;
novels.push({
url: novelUrl,
name: novelName,
cover: novelCover,
});
});
return novels;
};
async function fetchImage (url) {
return await fetchFile(url, {});
}
module.exports = {
id: pluginId,
name: 'LightNovelReader',
icon: 'src/en/lightnovelreader/icon.png',
version: '1.0.0',
site: baseUrl,
lang: languages.English,
description: 'This is description for plugin',
protected: false,
fetchImage,
popularNovels,
parseNovelAndChapters,
parseChapter,
searchNovels,
}
+198
View File
@@ -0,0 +1,198 @@
import { load as parseHTML } from "cheerio";
// import dayjs from 'dayjs';
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
// 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";
export const id = "Ltnovel.com";
export const name = "Ltnovel.com";
export const icon = "multisrc/readwn/icon/ltnovel.png";
export const version = "1.0.0";
export const site = "https://www.ltnovel.com/";
// export const filters: Filter[] = [];
exports["protected"] = false;
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async function (
page,
{ filters, showLatestNovels }
) {
const novels: Novel.Item[] = [];
const pageNo = page - 1;
const url = baseUrl + 'list/all/all-onclick-' + pageNo +'.html';
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = parseHTML(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;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters =
async function (novelUrl) {
const result = await fetchApi(novelUrl);
const body = await result.text();
let loadedCheerio = parseHTML(body);
const novel: Novel.instance = {
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: Chapter.Item[] = [];
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 () {
const chapterName = loadedCheerio(this)
.find('a .chapter-title')
.text()
.trim();
const chapterUrl = baseUrl + loadedCheerio(this).find('a').attr('href')?.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;
};
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
const result = await fetchApi(chapterUrl);
const body = await result.text();
const loadedCheerio = parseHTML(body);
const chapterText = loadedCheerio('.chapter-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const searchUrl = baseUrl + 'e/search/index.php';
const result = await 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 = await result.text();
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url, {});
};
+205
View File
@@ -0,0 +1,205 @@
import { load as parseHTML } from "cheerio";
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus"
import { parseMadaraDate } from "@libs/parseMadaraDate";
import dayjs from "dayjs";
export const id = "lunarletters";
export const name = "LunarLetters [madara]";
export const icon = "multisrc/madara/icons/lunarletters.png";
export const version = "1.0.0";
export const site = "https://www.lunarletters.com/";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
const novels: Novel.Item[] = [];
const sortOrder = showLatestNovels
? '?m_orderby=latest'
: '/?m_orderby=rating';
let url = site + "series" + '/page/' + pageNo + sortOrder;
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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: Novel.Item = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters = async (
novelUrl
) => {
const novel: Novel.instance = {
url: novelUrl,
};
const body = await fetchApi(novelUrl).then(res => res.text());
let loadedCheerio = parseHTML(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;
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.Ongoing
: 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 = await fetchApi(
baseUrl + 'wp-admin/admin-ajax.php',
{
method: 'POST',
body: JSON.stringify(body),
})
.then(res => res.text());
} else {
html = await fetchApi(
baseUrl + 'ajax/chapters/',
{ method: 'POST' })
.then(res => res.text());
}
if (html !== '0') {
loadedCheerio = parseHTML(html);
}
const chapters: Chapter.Item[] = [];
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 = parseMadaraDate(releaseDate);
} else {
/**
* Insert current date
*/
releaseDate = dayjs().format('LL');
}
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = chapters.reverse();
return novel;
};
export const parseChapter: Plugin.parseChapter = async (chapterUrl) => {
const url = baseUrl + "/" + "series" + "/" + chapterUrl;
const body = await fetchApi(chapterUrl).then(res => res.text());
const loadedCheerio = parseHTML(body);
const chapterText =
loadedCheerio('.text-left').html() ||
loadedCheerio('.text-right').html() ||
loadedCheerio('.entry-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url);
};
+205
View File
@@ -0,0 +1,205 @@
import { load as parseHTML } from "cheerio";
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus"
import { parseMadaraDate } from "@libs/parseMadaraDate";
import dayjs from "dayjs";
export const id = "mtlnovel.club";
export const name = "MTLNovel.Club [madara]";
export const icon = "multisrc/madara/icons/mtlnovel.club.png";
export const version = "1.0.0";
export const site = "https://mtlnovel.club/";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
const novels: Novel.Item[] = [];
const sortOrder = showLatestNovels
? '?m_orderby=latest'
: '/?m_orderby=rating';
let url = site + "novel" + '/page/' + pageNo + sortOrder;
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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: Novel.Item = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters = async (
novelUrl
) => {
const novel: Novel.instance = {
url: novelUrl,
};
const body = await fetchApi(novelUrl).then(res => res.text());
let loadedCheerio = parseHTML(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;
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.Ongoing
: 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 = await fetchApi(
baseUrl + 'wp-admin/admin-ajax.php',
{
method: 'POST',
body: JSON.stringify(body),
})
.then(res => res.text());
} else {
html = await fetchApi(
baseUrl + 'ajax/chapters/',
{ method: 'POST' })
.then(res => res.text());
}
if (html !== '0') {
loadedCheerio = parseHTML(html);
}
const chapters: Chapter.Item[] = [];
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 = parseMadaraDate(releaseDate);
} else {
/**
* Insert current date
*/
releaseDate = dayjs().format('LL');
}
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = chapters.reverse();
return novel;
};
export const parseChapter: Plugin.parseChapter = async (chapterUrl) => {
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
const body = await fetchApi(chapterUrl).then(res => res.text());
const loadedCheerio = parseHTML(body);
const chapterText =
loadedCheerio('.text-left').html() ||
loadedCheerio('.text-right').html() ||
loadedCheerio('.entry-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url);
};
+205
View File
@@ -0,0 +1,205 @@
import { load as parseHTML } from "cheerio";
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus"
import { parseMadaraDate } from "@libs/parseMadaraDate";
import dayjs from "dayjs";
export const id = "mtl-novel";
export const name = "MTL-Novel [madara]";
export const icon = "multisrc/madara/icons/mtl-novel.png";
export const version = "1.0.0";
export const site = "https://mtl-novel.com/";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
const novels: Novel.Item[] = [];
const sortOrder = showLatestNovels
? '?m_orderby=latest'
: '/?m_orderby=rating';
let url = site + "novel" + '/page/' + pageNo + sortOrder;
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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: Novel.Item = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters = async (
novelUrl
) => {
const novel: Novel.instance = {
url: novelUrl,
};
const body = await fetchApi(novelUrl).then(res => res.text());
let loadedCheerio = parseHTML(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;
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.Ongoing
: 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 = await fetchApi(
baseUrl + 'wp-admin/admin-ajax.php',
{
method: 'POST',
body: JSON.stringify(body),
})
.then(res => res.text());
} else {
html = await fetchApi(
baseUrl + 'ajax/chapters/',
{ method: 'POST' })
.then(res => res.text());
}
if (html !== '0') {
loadedCheerio = parseHTML(html);
}
const chapters: Chapter.Item[] = [];
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 = parseMadaraDate(releaseDate);
} else {
/**
* Insert current date
*/
releaseDate = dayjs().format('LL');
}
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = chapters.reverse();
return novel;
};
export const parseChapter: Plugin.parseChapter = async (chapterUrl) => {
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
const body = await fetchApi(chapterUrl).then(res => res.text());
const loadedCheerio = parseHTML(body);
const chapterText =
loadedCheerio('.text-left').html() ||
loadedCheerio('.text-right').html() ||
loadedCheerio('.entry-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url);
};
+205
View File
@@ -0,0 +1,205 @@
import { load as parseHTML } from "cheerio";
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus"
import { parseMadaraDate } from "@libs/parseMadaraDate";
import dayjs from "dayjs";
export const id = "mostnovel";
export const name = "MostNovel [madara]";
export const icon = "multisrc/madara/icons/mostnovel.png";
export const version = "1.0.0";
export const site = "https://mostnovel.com/";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
const novels: Novel.Item[] = [];
const sortOrder = showLatestNovels
? '?m_orderby=latest'
: '/?m_orderby=rating';
let url = site + "manga" + '/page/' + pageNo + sortOrder;
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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: Novel.Item = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters = async (
novelUrl
) => {
const novel: Novel.instance = {
url: novelUrl,
};
const body = await fetchApi(novelUrl).then(res => res.text());
let loadedCheerio = parseHTML(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;
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.Ongoing
: 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 = await fetchApi(
baseUrl + 'wp-admin/admin-ajax.php',
{
method: 'POST',
body: JSON.stringify(body),
})
.then(res => res.text());
} else {
html = await fetchApi(
baseUrl + 'ajax/chapters/',
{ method: 'POST' })
.then(res => res.text());
}
if (html !== '0') {
loadedCheerio = parseHTML(html);
}
const chapters: Chapter.Item[] = [];
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 = parseMadaraDate(releaseDate);
} else {
/**
* Insert current date
*/
releaseDate = dayjs().format('LL');
}
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = chapters.reverse();
return novel;
};
export const parseChapter: Plugin.parseChapter = async (chapterUrl) => {
const url = baseUrl + "/" + "manga" + "/" + chapterUrl;
const body = await fetchApi(chapterUrl).then(res => res.text());
const loadedCheerio = parseHTML(body);
const chapterText =
loadedCheerio('.text-left').html() ||
loadedCheerio('.text-right').html() ||
loadedCheerio('.entry-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url);
};
+205
View File
@@ -0,0 +1,205 @@
import { load as parseHTML } from "cheerio";
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus"
import { parseMadaraDate } from "@libs/parseMadaraDate";
import dayjs from "dayjs";
export const id = "mysticalmerries";
export const name = "MysticalSeries [madara]";
export const icon = "multisrc/madara/icons/mysticalseries.png";
export const version = "1.0.0";
export const site = "https://mysticalmerries.com/";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
const novels: Novel.Item[] = [];
const sortOrder = showLatestNovels
? '?m_orderby=latest'
: '/?m_orderby=rating';
let url = site + "series" + '/page/' + pageNo + sortOrder;
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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: Novel.Item = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters = async (
novelUrl
) => {
const novel: Novel.instance = {
url: novelUrl,
};
const body = await fetchApi(novelUrl).then(res => res.text());
let loadedCheerio = parseHTML(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;
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.Ongoing
: 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 = await fetchApi(
baseUrl + 'wp-admin/admin-ajax.php',
{
method: 'POST',
body: JSON.stringify(body),
})
.then(res => res.text());
} else {
html = await fetchApi(
baseUrl + 'ajax/chapters/',
{ method: 'POST' })
.then(res => res.text());
}
if (html !== '0') {
loadedCheerio = parseHTML(html);
}
const chapters: Chapter.Item[] = [];
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 = parseMadaraDate(releaseDate);
} else {
/**
* Insert current date
*/
releaseDate = dayjs().format('LL');
}
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = chapters.reverse();
return novel;
};
export const parseChapter: Plugin.parseChapter = async (chapterUrl) => {
const url = baseUrl + "/" + "series" + "/" + chapterUrl;
const body = await fetchApi(chapterUrl).then(res => res.text());
const loadedCheerio = parseHTML(body);
const chapterText =
loadedCheerio('.text-left').html() ||
loadedCheerio('.text-right').html() ||
loadedCheerio('.entry-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url);
};
@@ -0,0 +1,205 @@
import { load as parseHTML } from "cheerio";
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus"
import { parseMadaraDate } from "@libs/parseMadaraDate";
import dayjs from "dayjs";
export const id = "neosekaiTLS";
export const name = "NeoSekai Translations [madara]";
export const icon = "multisrc/madara/icons/neosekaitranslations.png";
export const version = "1.0.0";
export const site = "https://www.neosekaitranslations.com/";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
const novels: Novel.Item[] = [];
const sortOrder = showLatestNovels
? '?m_orderby=latest'
: '/?m_orderby=rating';
let url = site + "novel" + '/page/' + pageNo + sortOrder;
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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: Novel.Item = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters = async (
novelUrl
) => {
const novel: Novel.instance = {
url: novelUrl,
};
const body = await fetchApi(novelUrl).then(res => res.text());
let loadedCheerio = parseHTML(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;
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.Ongoing
: 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 = await fetchApi(
baseUrl + 'wp-admin/admin-ajax.php',
{
method: 'POST',
body: JSON.stringify(body),
})
.then(res => res.text());
} else {
html = await fetchApi(
baseUrl + 'ajax/chapters/',
{ method: 'POST' })
.then(res => res.text());
}
if (html !== '0') {
loadedCheerio = parseHTML(html);
}
const chapters: Chapter.Item[] = [];
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 = parseMadaraDate(releaseDate);
} else {
/**
* Insert current date
*/
releaseDate = dayjs().format('LL');
}
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = chapters.reverse();
return novel;
};
export const parseChapter: Plugin.parseChapter = async (chapterUrl) => {
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
const body = await fetchApi(chapterUrl).then(res => res.text());
const loadedCheerio = parseHTML(body);
const chapterText =
loadedCheerio('.text-left').html() ||
loadedCheerio('.text-right').html() ||
loadedCheerio('.entry-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url);
};
@@ -0,0 +1,205 @@
import { load as parseHTML } from "cheerio";
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus"
import { parseMadaraDate } from "@libs/parseMadaraDate";
import dayjs from "dayjs";
export const id = "nocturneTLS";
export const name = "Nocturne Translations [madara]";
export const icon = "multisrc/madara/icons/nocturnetranslations.png";
export const version = "1.0.0";
export const site = "https://nocturnetls.net/";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
const novels: Novel.Item[] = [];
const sortOrder = showLatestNovels
? '?m_orderby=latest'
: '/?m_orderby=rating';
let url = site + "novels" + '/page/' + pageNo + sortOrder;
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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: Novel.Item = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters = async (
novelUrl
) => {
const novel: Novel.instance = {
url: novelUrl,
};
const body = await fetchApi(novelUrl).then(res => res.text());
let loadedCheerio = parseHTML(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;
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.Ongoing
: 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 = await fetchApi(
baseUrl + 'wp-admin/admin-ajax.php',
{
method: 'POST',
body: JSON.stringify(body),
})
.then(res => res.text());
} else {
html = await fetchApi(
baseUrl + 'ajax/chapters/',
{ method: 'POST' })
.then(res => res.text());
}
if (html !== '0') {
loadedCheerio = parseHTML(html);
}
const chapters: Chapter.Item[] = [];
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 = parseMadaraDate(releaseDate);
} else {
/**
* Insert current date
*/
releaseDate = dayjs().format('LL');
}
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = chapters.reverse();
return novel;
};
export const parseChapter: Plugin.parseChapter = async (chapterUrl) => {
const url = baseUrl + "/" + "novels" + "/" + chapterUrl;
const body = await fetchApi(chapterUrl).then(res => res.text());
const loadedCheerio = parseHTML(body);
const chapterText =
loadedCheerio('.text-left').html() ||
loadedCheerio('.text-right').html() ||
loadedCheerio('.entry-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url);
};
@@ -0,0 +1,205 @@
import { load as parseHTML } from "cheerio";
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus"
import { parseMadaraDate } from "@libs/parseMadaraDate";
import dayjs from "dayjs";
export const id = "noobchanTL";
export const name = "Noobchan Translation [madara]";
export const icon = "multisrc/madara/icons/noobchantranslation.png";
export const version = "1.0.0";
export const site = "https://noobchan.xyz/";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
const novels: Novel.Item[] = [];
const sortOrder = showLatestNovels
? '?m_orderby=latest'
: '/?m_orderby=rating';
let url = site + "novel" + '/page/' + pageNo + sortOrder;
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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: Novel.Item = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters = async (
novelUrl
) => {
const novel: Novel.instance = {
url: novelUrl,
};
const body = await fetchApi(novelUrl).then(res => res.text());
let loadedCheerio = parseHTML(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;
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.Ongoing
: 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 = await fetchApi(
baseUrl + 'wp-admin/admin-ajax.php',
{
method: 'POST',
body: JSON.stringify(body),
})
.then(res => res.text());
} else {
html = await fetchApi(
baseUrl + 'ajax/chapters/',
{ method: 'POST' })
.then(res => res.text());
}
if (html !== '0') {
loadedCheerio = parseHTML(html);
}
const chapters: Chapter.Item[] = [];
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 = parseMadaraDate(releaseDate);
} else {
/**
* Insert current date
*/
releaseDate = dayjs().format('LL');
}
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = chapters.reverse();
return novel;
};
export const parseChapter: Plugin.parseChapter = async (chapterUrl) => {
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
const body = await fetchApi(chapterUrl).then(res => res.text());
const loadedCheerio = parseHTML(body);
const chapterText =
loadedCheerio('.text-left').html() ||
loadedCheerio('.text-right').html() ||
loadedCheerio('.entry-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url);
};
-167
View File
@@ -1,167 +0,0 @@
const cheerio = require('cheerio');
const fetchApi = require('@libs/fetchApi');
const languages = require('@libs/languages');
const fetchFile = require('@libs/fetchFile');
const pluginId = 'NF.me';
const sourceName = 'NovelFull.me';
const baseUrl = 'https://novelfull.me/';
async function popularNovels (page) {
const url = `${baseUrl}popular?page=${page}`;
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = cheerio.load(body);
let novels = [];
loadedCheerio('.book-item').each(function () {
const novelName = loadedCheerio(this).find('.title').text();
const novelCover =
'https:' + loadedCheerio(this).find('img').attr('data-src');
const novelUrl =
baseUrl + loadedCheerio(this).find('.title a').attr('href').substring(1);
const novel = { name: novelName, cover: novelCover, url: novelUrl };
novels.push(novel);
});
return novels;
};
async function parseNovelAndChapters (novelUrl) {
const url = novelUrl;
const result = await fetchApi(url);
const body = await result.text();
let loadedCheerio = cheerio.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 = 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()
?.trim();
novel.genres = 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()
?.replace('Genres :', '')
.replace(/[\s\n]+/g, ' ')
.trim();
let chapters = [];
const chaptersUrl =
novelUrl.replace(baseUrl, 'https://novelfull.me/api/novels/') +
'/chapters?source=detail';
const chaptersRequest = await fetchApi(chaptersUrl);
const chaptersHtml = await chaptersRequest.text();
loadedCheerio = cheerio.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');
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = chapters.reverse();
return novel;
};
async function parseChapter (chapterUrl) {
const url = chapterUrl;
const result = await fetchApi(url);
const body = await result.text();
let loadedCheerio = cheerio.load(body);
loadedCheerio('#listen-chapter').remove();
loadedCheerio('#google_translate_element').remove();
const chapterText = loadedCheerio('.chapter__content').html();
return chapterText;
};
async function searchNovels (searchTerm) {
const url = `${baseUrl}search?status=all&sort=views&q=${searchTerm}`;
const result = await fetchApi(url);
const body = await result.text();
let loadedCheerio = cheerio.load(body);
let novels = [];
loadedCheerio('.book-item').each(function () {
const novelName = loadedCheerio(this).find('.title').text();
const novelCover =
'https:' + loadedCheerio(this).find('img').attr('data-src');
const novelUrl =
baseUrl + loadedCheerio(this).find('.title a').attr('href').substring(1);
const novel = {name: novelName, cover: novelCover, url: novelUrl };
novels.push(novel);
});
return novels;
};
module.exports = {
id: pluginId,
name: sourceName,
site: baseUrl,
lang: languages.English,
version: '1.0.0',
icon: 'src/en/novelfullme/icon.png',
popularNovels,
parseNovelAndChapters,
parseChapter,
searchNovels,
fetchImage: fetchFile,
};
+165
View File
@@ -0,0 +1,165 @@
import { load as parseHTML } from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import { Chapter, Novel, Plugin } from "@typings/plugin";
export const id = "NF.me";
export const name = "NovelFull.me";
export const site = "https://novelfull.me/";
export const version = "1.0.0";
export const icon = "src/en/novelfullme/icon.png";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async function (page) {
const url = `${baseUrl}popular?page=${page}`;
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = parseHTML(body);
let novels: Novel.Item[] = [];
loadedCheerio(".book-item").each(function () {
const novelName = loadedCheerio(this).find(".title").text();
const novelCover =
"https:" + loadedCheerio(this).find("img").attr("data-src");
const novelUrl =
baseUrl +
loadedCheerio(this).find(".title a").attr("href")?.substring(1);
const novel = { name: novelName, cover: novelCover, url: novelUrl };
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters =
async function (novelUrl) {
const url = novelUrl;
const result = await fetchApi(url);
const body = await result.text();
let loadedCheerio = parseHTML(body);
let novel: Novel.instance = {
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 = 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()
?.trim();
novel.genres = 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()
?.replace("Genres :", "")
.replace(/[\s\n]+/g, " ")
.trim();
let chapters: Chapter.Item[] = [];
const chaptersUrl =
novelUrl.replace(baseUrl, "https://novelfull.me/api/novels/") +
"/chapters?source=detail";
const chaptersRequest = await fetchApi(chaptersUrl);
const chaptersHtml = await chaptersRequest.text();
loadedCheerio = parseHTML(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;
};
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
const url = chapterUrl;
const result = await fetchApi(url);
const body = await result.text();
let loadedCheerio = parseHTML(body);
loadedCheerio("#listen-chapter").remove();
loadedCheerio("#google_translate_element").remove();
const chapterText = loadedCheerio(".chapter__content").html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async function (searchTerm) {
const url = `${baseUrl}search?status=all&sort=views&q=${searchTerm}`;
const result = await fetchApi(url);
const body = await result.text();
let loadedCheerio = parseHTML(body);
let novels: Novel.Item[] = [];
loadedCheerio(".book-item").each(function () {
const novelName = loadedCheerio(this).find(".title").text();
const novelCover =
"https:" + loadedCheerio(this).find("img").attr("data-src");
const novelUrl =
baseUrl +
loadedCheerio(this).find(".title a").attr("href")?.substring(1);
const novel = { name: novelName, cover: novelCover, url: novelUrl };
novels.push(novel);
});
return novels;
};
export const fetchImage: Plugin.fetchImage = fetchFile;
+205
View File
@@ -0,0 +1,205 @@
import { load as parseHTML } from "cheerio";
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus"
import { parseMadaraDate } from "@libs/parseMadaraDate";
import dayjs from "dayjs";
export const id = "novelmultiverse";
export const name = "NovelMultiverse [madara]";
export const icon = "multisrc/madara/icons/novelmultiverse.png";
export const version = "1.0.0";
export const site = "https://www.novelmultiverse.com/";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
const novels: Novel.Item[] = [];
const sortOrder = showLatestNovels
? '?m_orderby=latest'
: '/?m_orderby=rating';
let url = site + "novel" + '/page/' + pageNo + sortOrder;
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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: Novel.Item = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters = async (
novelUrl
) => {
const novel: Novel.instance = {
url: novelUrl,
};
const body = await fetchApi(novelUrl).then(res => res.text());
let loadedCheerio = parseHTML(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;
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.Ongoing
: 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 = await fetchApi(
baseUrl + 'wp-admin/admin-ajax.php',
{
method: 'POST',
body: JSON.stringify(body),
})
.then(res => res.text());
} else {
html = await fetchApi(
baseUrl + 'ajax/chapters/',
{ method: 'POST' })
.then(res => res.text());
}
if (html !== '0') {
loadedCheerio = parseHTML(html);
}
const chapters: Chapter.Item[] = [];
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 = parseMadaraDate(releaseDate);
} else {
/**
* Insert current date
*/
releaseDate = dayjs().format('LL');
}
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = chapters.reverse();
return novel;
};
export const parseChapter: Plugin.parseChapter = async (chapterUrl) => {
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
const body = await fetchApi(chapterUrl).then(res => res.text());
const loadedCheerio = parseHTML(body);
const chapterText =
loadedCheerio('.text-left').html() ||
loadedCheerio('.text-right').html() ||
loadedCheerio('.entry-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url);
};
-120
View File
@@ -1,120 +0,0 @@
const cheerio = require('cheerio');
const fetchApi = require('@libs/fetchApi');
const fetchFile = require('@libs/fetchFile');
const languages = require('@libs/languages');
const pluginId = 'NO.net';
const sourceName = 'novelsOnline';
const baseUrl = 'https://novelsonline.net';
async function searchNovels (searchTerm) {
const result = await 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 $ = cheerio.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);
};
async function parseNovelAndChapters (novelUrl){
let novel = {
url: novelUrl,
chapters: [],
};
const result = await fetchApi(novelUrl).then(res => res.text());
let $ = cheerio.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;
};
async function popularNovels (page) {
return { novels: [] }; /** TO DO */
};
async function parseChapter (chapterUrl) {
const result = await fetchApi(chapterUrl).then(res => res.text());
let loadedCheerio = cheerio.load(result);
const chapterText = loadedCheerio('#contentall').html() || '';
return chapterText;
};
module.exports = {
id: pluginId,
name: sourceName,
site: baseUrl,
lang: languages.English,
icon: 'src/coverNotAvailable.jpg',
version: '1.0.0',
popularNovels,
parseNovelAndChapters,
parseChapter,
searchNovels,
fetchImage: fetchFile,
};
+111
View File
@@ -0,0 +1,111 @@
import { load as parseHTML } from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import { Chapter, Novel, Plugin } from "@typings/plugin";
export const id = "NO.net";
export const name = "novelsOnline";
export const site = "https://novelsonline.net";
export const icon = "src/coverNotAvailable.jpg";
export const version = "1.0.0";
const pluginId = id;
export const searchNovels: Plugin.searchNovels = async function (searchTerm) {
const result = await 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 $ = parseHTML(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);
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters =
async function (novelUrl) {
let novel: Novel.instance = {
url: novelUrl,
chapters: [],
};
const result = await fetchApi(novelUrl).then((res) => res.text());
let $ = parseHTML(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,
} as Chapter.Item;
})
.get();
return novel;
};
export const popularNovels: Plugin.popularNovels = async function (page) {
return []; /** TO DO */
};
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
const result = await fetchApi(chapterUrl).then((res) => res.text());
let loadedCheerio = parseHTML(result);
const chapterText = loadedCheerio("#contentall").html() || "";
return chapterText;
};
export const fetchImage: Plugin.fetchImage = fetchFile;
+205
View File
@@ -0,0 +1,205 @@
import { load as parseHTML } from "cheerio";
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus"
import { parseMadaraDate } from "@libs/parseMadaraDate";
import dayjs from "dayjs";
export const id = "novelr18";
export const name = "NovelR18 [madara]";
export const icon = "multisrc/madara/icons/novelr18.png";
export const version = "1.0.0";
export const site = "https://novelr18.com/";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
const novels: Novel.Item[] = [];
const sortOrder = showLatestNovels
? '?m_orderby=latest'
: '/?m_orderby=rating';
let url = site + "novel" + '/page/' + pageNo + sortOrder;
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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: Novel.Item = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters = async (
novelUrl
) => {
const novel: Novel.instance = {
url: novelUrl,
};
const body = await fetchApi(novelUrl).then(res => res.text());
let loadedCheerio = parseHTML(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;
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.Ongoing
: 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 = await fetchApi(
baseUrl + 'wp-admin/admin-ajax.php',
{
method: 'POST',
body: JSON.stringify(body),
})
.then(res => res.text());
} else {
html = await fetchApi(
baseUrl + 'ajax/chapters/',
{ method: 'POST' })
.then(res => res.text());
}
if (html !== '0') {
loadedCheerio = parseHTML(html);
}
const chapters: Chapter.Item[] = [];
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 = parseMadaraDate(releaseDate);
} else {
/**
* Insert current date
*/
releaseDate = dayjs().format('LL');
}
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = chapters.reverse();
return novel;
};
export const parseChapter: Plugin.parseChapter = async (chapterUrl) => {
const url = baseUrl + "/" + "manga" + "/" + chapterUrl;
const body = await fetchApi(chapterUrl).then(res => res.text());
const loadedCheerio = parseHTML(body);
const chapterText =
loadedCheerio('.text-left').html() ||
loadedCheerio('.text-right').html() ||
loadedCheerio('.entry-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url);
};
+205
View File
@@ -0,0 +1,205 @@
import { load as parseHTML } from "cheerio";
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus"
import { parseMadaraDate } from "@libs/parseMadaraDate";
import dayjs from "dayjs";
export const id = "novelTL";
export const name = "NovelTranslate [madara]";
export const icon = "multisrc/madara/icons/noveltranslate.png";
export const version = "1.0.0";
export const site = "https://noveltranslate.com/";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
const novels: Novel.Item[] = [];
const sortOrder = showLatestNovels
? '?m_orderby=latest'
: '/?m_orderby=rating';
let url = site + "all-novels" + '/page/' + pageNo + sortOrder;
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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: Novel.Item = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters = async (
novelUrl
) => {
const novel: Novel.instance = {
url: novelUrl,
};
const body = await fetchApi(novelUrl).then(res => res.text());
let loadedCheerio = parseHTML(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;
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.Ongoing
: 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 = await fetchApi(
baseUrl + 'wp-admin/admin-ajax.php',
{
method: 'POST',
body: JSON.stringify(body),
})
.then(res => res.text());
} else {
html = await fetchApi(
baseUrl + 'ajax/chapters/',
{ method: 'POST' })
.then(res => res.text());
}
if (html !== '0') {
loadedCheerio = parseHTML(html);
}
const chapters: Chapter.Item[] = [];
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 = parseMadaraDate(releaseDate);
} else {
/**
* Insert current date
*/
releaseDate = dayjs().format('LL');
}
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = chapters.reverse();
return novel;
};
export const parseChapter: Plugin.parseChapter = async (chapterUrl) => {
const url = baseUrl + "/" + "manga" + "/" + chapterUrl;
const body = await fetchApi(chapterUrl).then(res => res.text());
const loadedCheerio = parseHTML(body);
const chapterText =
loadedCheerio('.text-left').html() ||
loadedCheerio('.text-right').html() ||
loadedCheerio('.entry-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url);
};
+198
View File
@@ -0,0 +1,198 @@
import { load as parseHTML } from "cheerio";
// import dayjs from 'dayjs';
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
// 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";
export const id = "Novelmt.com";
export const name = "Novelmt.com";
export const icon = "multisrc/readwn/icon/novelmt.png";
export const version = "1.0.0";
export const site = "https://www.novelmt.com/";
// export const filters: Filter[] = [];
exports["protected"] = false;
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async function (
page,
{ filters, showLatestNovels }
) {
const novels: Novel.Item[] = [];
const pageNo = page - 1;
const url = baseUrl + 'list/all/all-onclick-' + pageNo +'.html';
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = parseHTML(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;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters =
async function (novelUrl) {
const result = await fetchApi(novelUrl);
const body = await result.text();
let loadedCheerio = parseHTML(body);
const novel: Novel.instance = {
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: Chapter.Item[] = [];
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 () {
const chapterName = loadedCheerio(this)
.find('a .chapter-title')
.text()
.trim();
const chapterUrl = baseUrl + loadedCheerio(this).find('a').attr('href')?.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;
};
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
const result = await fetchApi(chapterUrl);
const body = await result.text();
const loadedCheerio = parseHTML(body);
const chapterText = loadedCheerio('.chapter-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const searchUrl = baseUrl + 'e/search/index.php';
const result = await 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 = await result.text();
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url, {});
};
+205
View File
@@ -0,0 +1,205 @@
import { load as parseHTML } from "cheerio";
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus"
import { parseMadaraDate } from "@libs/parseMadaraDate";
import dayjs from "dayjs";
export const id = "novelroom";
export const name = "Novelroom.net [madara]";
export const icon = "multisrc/madara/icons/novelroom.net.png";
export const version = "1.0.0";
export const site = "https://novelroom.net/";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
const novels: Novel.Item[] = [];
const sortOrder = showLatestNovels
? '?m_orderby=latest'
: '/?m_orderby=rating';
let url = site + "manga" + '/page/' + pageNo + sortOrder;
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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: Novel.Item = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters = async (
novelUrl
) => {
const novel: Novel.instance = {
url: novelUrl,
};
const body = await fetchApi(novelUrl).then(res => res.text());
let loadedCheerio = parseHTML(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;
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.Ongoing
: 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 = await fetchApi(
baseUrl + 'wp-admin/admin-ajax.php',
{
method: 'POST',
body: JSON.stringify(body),
})
.then(res => res.text());
} else {
html = await fetchApi(
baseUrl + 'ajax/chapters/',
{ method: 'POST' })
.then(res => res.text());
}
if (html !== '0') {
loadedCheerio = parseHTML(html);
}
const chapters: Chapter.Item[] = [];
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 = parseMadaraDate(releaseDate);
} else {
/**
* Insert current date
*/
releaseDate = dayjs().format('LL');
}
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = chapters.reverse();
return novel;
};
export const parseChapter: Plugin.parseChapter = async (chapterUrl) => {
const url = baseUrl + "/" + "manga" + "/" + chapterUrl;
const body = await fetchApi(chapterUrl).then(res => res.text());
const loadedCheerio = parseHTML(body);
const chapterText =
loadedCheerio('.text-left').html() ||
loadedCheerio('.text-right').html() ||
loadedCheerio('.entry-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url);
};
+205
View File
@@ -0,0 +1,205 @@
import { load as parseHTML } from "cheerio";
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus"
import { parseMadaraDate } from "@libs/parseMadaraDate";
import dayjs from "dayjs";
export const id = "novelstic";
export const name = "Novelstic [madara]";
export const icon = "multisrc/madara/icons/novelstic.png";
export const version = "1.0.0";
export const site = "https://novelstic.com/";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
const novels: Novel.Item[] = [];
const sortOrder = showLatestNovels
? '?m_orderby=latest'
: '/?m_orderby=rating';
let url = site + "novel" + '/page/' + pageNo + sortOrder;
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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: Novel.Item = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters = async (
novelUrl
) => {
const novel: Novel.instance = {
url: novelUrl,
};
const body = await fetchApi(novelUrl).then(res => res.text());
let loadedCheerio = parseHTML(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;
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.Ongoing
: 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 = await fetchApi(
baseUrl + 'wp-admin/admin-ajax.php',
{
method: 'POST',
body: JSON.stringify(body),
})
.then(res => res.text());
} else {
html = await fetchApi(
baseUrl + 'ajax/chapters/',
{ method: 'POST' })
.then(res => res.text());
}
if (html !== '0') {
loadedCheerio = parseHTML(html);
}
const chapters: Chapter.Item[] = [];
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 = parseMadaraDate(releaseDate);
} else {
/**
* Insert current date
*/
releaseDate = dayjs().format('LL');
}
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = chapters.reverse();
return novel;
};
export const parseChapter: Plugin.parseChapter = async (chapterUrl) => {
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
const body = await fetchApi(chapterUrl).then(res => res.text());
const loadedCheerio = parseHTML(body);
const chapterText =
loadedCheerio('.text-left').html() ||
loadedCheerio('.text-right').html() ||
loadedCheerio('.entry-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url);
};
+205
View File
@@ -0,0 +1,205 @@
import { load as parseHTML } from "cheerio";
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus"
import { parseMadaraDate } from "@libs/parseMadaraDate";
import dayjs from "dayjs";
export const id = "onlymtl";
export const name = "OnlyMTL [madara]";
export const icon = "multisrc/madara/icons/onlymtl.png";
export const version = "1.0.0";
export const site = "https://www.onlymtl.com/";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
const novels: Novel.Item[] = [];
const sortOrder = showLatestNovels
? '?m_orderby=latest'
: '/?m_orderby=rating';
let url = site + "novel" + '/page/' + pageNo + sortOrder;
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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: Novel.Item = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters = async (
novelUrl
) => {
const novel: Novel.instance = {
url: novelUrl,
};
const body = await fetchApi(novelUrl).then(res => res.text());
let loadedCheerio = parseHTML(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;
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.Ongoing
: 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 = await fetchApi(
baseUrl + 'wp-admin/admin-ajax.php',
{
method: 'POST',
body: JSON.stringify(body),
})
.then(res => res.text());
} else {
html = await fetchApi(
baseUrl + 'ajax/chapters/',
{ method: 'POST' })
.then(res => res.text());
}
if (html !== '0') {
loadedCheerio = parseHTML(html);
}
const chapters: Chapter.Item[] = [];
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 = parseMadaraDate(releaseDate);
} else {
/**
* Insert current date
*/
releaseDate = dayjs().format('LL');
}
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = chapters.reverse();
return novel;
};
export const parseChapter: Plugin.parseChapter = async (chapterUrl) => {
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
const body = await fetchApi(chapterUrl).then(res => res.text());
const loadedCheerio = parseHTML(body);
const chapterText =
loadedCheerio('.text-left').html() ||
loadedCheerio('.text-right').html() ||
loadedCheerio('.entry-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url);
};
+205
View File
@@ -0,0 +1,205 @@
import { load as parseHTML } from "cheerio";
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus"
import { parseMadaraDate } from "@libs/parseMadaraDate";
import dayjs from "dayjs";
export const id = "readwebnovels";
export const name = "ReadWebNovels [madara]";
export const icon = "multisrc/madara/icons/readwebnovels.png";
export const version = "1.0.0";
export const site = "https://readwebnovels.net/";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
const novels: Novel.Item[] = [];
const sortOrder = showLatestNovels
? '?m_orderby=latest'
: '/?m_orderby=rating';
let url = site + "novel" + '/page/' + pageNo + sortOrder;
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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: Novel.Item = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters = async (
novelUrl
) => {
const novel: Novel.instance = {
url: novelUrl,
};
const body = await fetchApi(novelUrl).then(res => res.text());
let loadedCheerio = parseHTML(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;
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.Ongoing
: 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 = await fetchApi(
baseUrl + 'wp-admin/admin-ajax.php',
{
method: 'POST',
body: JSON.stringify(body),
})
.then(res => res.text());
} else {
html = await fetchApi(
baseUrl + 'ajax/chapters/',
{ method: 'POST' })
.then(res => res.text());
}
if (html !== '0') {
loadedCheerio = parseHTML(html);
}
const chapters: Chapter.Item[] = [];
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 = parseMadaraDate(releaseDate);
} else {
/**
* Insert current date
*/
releaseDate = dayjs().format('LL');
}
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = chapters.reverse();
return novel;
};
export const parseChapter: Plugin.parseChapter = async (chapterUrl) => {
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
const body = await fetchApi(chapterUrl).then(res => res.text());
const loadedCheerio = parseHTML(body);
const chapterText =
loadedCheerio('.text-left').html() ||
loadedCheerio('.text-right').html() ||
loadedCheerio('.entry-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url);
};
+198
View File
@@ -0,0 +1,198 @@
import { load as parseHTML } from "cheerio";
// import dayjs from 'dayjs';
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
// 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";
export const id = "Readwn.com";
export const name = "Readwn.com";
export const icon = "multisrc/readwn/icon/readwn.png";
export const version = "1.0.0";
export const site = "https://www.readwn.com/";
// export const filters: Filter[] = [];
exports["protected"] = false;
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async function (
page,
{ filters, showLatestNovels }
) {
const novels: Novel.Item[] = [];
const pageNo = page - 1;
const url = baseUrl + 'list/all/all-onclick-' + pageNo +'.html';
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = parseHTML(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;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters =
async function (novelUrl) {
const result = await fetchApi(novelUrl);
const body = await result.text();
let loadedCheerio = parseHTML(body);
const novel: Novel.instance = {
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: Chapter.Item[] = [];
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 () {
const chapterName = loadedCheerio(this)
.find('a .chapter-title')
.text()
.trim();
const chapterUrl = baseUrl + loadedCheerio(this).find('a').attr('href')?.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;
};
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
const result = await fetchApi(chapterUrl);
const body = await result.text();
const loadedCheerio = parseHTML(body);
const chapterText = loadedCheerio('.chapter-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const searchUrl = baseUrl + 'e/search/index.php';
const result = await 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 = await result.text();
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url, {});
};
@@ -0,0 +1,205 @@
import { load as parseHTML } from "cheerio";
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus"
import { parseMadaraDate } from "@libs/parseMadaraDate";
import dayjs from "dayjs";
export const id = "sleeptTLS";
export const name = "SleepyTranslations [madara]";
export const icon = "multisrc/madara/icons/sleepytranslations.png";
export const version = "1.0.0";
export const site = "https://sleepytranslations.com/";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
const novels: Novel.Item[] = [];
const sortOrder = showLatestNovels
? '?m_orderby=latest'
: '/?m_orderby=rating';
let url = site + "series" + '/page/' + pageNo + sortOrder;
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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: Novel.Item = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters = async (
novelUrl
) => {
const novel: Novel.instance = {
url: novelUrl,
};
const body = await fetchApi(novelUrl).then(res => res.text());
let loadedCheerio = parseHTML(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;
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.Ongoing
: 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 = await fetchApi(
baseUrl + 'wp-admin/admin-ajax.php',
{
method: 'POST',
body: JSON.stringify(body),
})
.then(res => res.text());
} else {
html = await fetchApi(
baseUrl + 'ajax/chapters/',
{ method: 'POST' })
.then(res => res.text());
}
if (html !== '0') {
loadedCheerio = parseHTML(html);
}
const chapters: Chapter.Item[] = [];
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 = parseMadaraDate(releaseDate);
} else {
/**
* Insert current date
*/
releaseDate = dayjs().format('LL');
}
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = chapters.reverse();
return novel;
};
export const parseChapter: Plugin.parseChapter = async (chapterUrl) => {
const url = baseUrl + "/" + "series" + "/" + chapterUrl;
const body = await fetchApi(chapterUrl).then(res => res.text());
const loadedCheerio = parseHTML(body);
const chapterText =
loadedCheerio('.text-left').html() ||
loadedCheerio('.text-right').html() ||
loadedCheerio('.entry-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url);
};
+205
View File
@@ -0,0 +1,205 @@
import { load as parseHTML } from "cheerio";
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus"
import { parseMadaraDate } from "@libs/parseMadaraDate";
import dayjs from "dayjs";
export const id = "sonicmtl";
export const name = "SonicMTL [madara]";
export const icon = "multisrc/madara/icons/sonicmtl.png";
export const version = "1.0.0";
export const site = "https://www.sonicmtl.com/";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
const novels: Novel.Item[] = [];
const sortOrder = showLatestNovels
? '?m_orderby=latest'
: '/?m_orderby=rating';
let url = site + "novel" + '/page/' + pageNo + sortOrder;
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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: Novel.Item = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters = async (
novelUrl
) => {
const novel: Novel.instance = {
url: novelUrl,
};
const body = await fetchApi(novelUrl).then(res => res.text());
let loadedCheerio = parseHTML(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;
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.Ongoing
: 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 = await fetchApi(
baseUrl + 'wp-admin/admin-ajax.php',
{
method: 'POST',
body: JSON.stringify(body),
})
.then(res => res.text());
} else {
html = await fetchApi(
baseUrl + 'ajax/chapters/',
{ method: 'POST' })
.then(res => res.text());
}
if (html !== '0') {
loadedCheerio = parseHTML(html);
}
const chapters: Chapter.Item[] = [];
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 = parseMadaraDate(releaseDate);
} else {
/**
* Insert current date
*/
releaseDate = dayjs().format('LL');
}
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = chapters.reverse();
return novel;
};
export const parseChapter: Plugin.parseChapter = async (chapterUrl) => {
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
const body = await fetchApi(chapterUrl).then(res => res.text());
const loadedCheerio = parseHTML(body);
const chapterText =
loadedCheerio('.text-left').html() ||
loadedCheerio('.text-right').html() ||
loadedCheerio('.entry-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url);
};
+205
View File
@@ -0,0 +1,205 @@
import { load as parseHTML } from "cheerio";
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus"
import { parseMadaraDate } from "@libs/parseMadaraDate";
import dayjs from "dayjs";
export const id = "sugarbbscan";
export const name = "Sugar Babies [madara]";
export const icon = "multisrc/madara/icons/sugarbabies.png";
export const version = "1.0.0";
export const site = "https://sugarbbscan.com/";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
const novels: Novel.Item[] = [];
const sortOrder = showLatestNovels
? '?m_orderby=latest'
: '/?m_orderby=rating';
let url = site + "series" + '/page/' + pageNo + sortOrder;
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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: Novel.Item = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters = async (
novelUrl
) => {
const novel: Novel.instance = {
url: novelUrl,
};
const body = await fetchApi(novelUrl).then(res => res.text());
let loadedCheerio = parseHTML(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;
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.Ongoing
: 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 = await fetchApi(
baseUrl + 'wp-admin/admin-ajax.php',
{
method: 'POST',
body: JSON.stringify(body),
})
.then(res => res.text());
} else {
html = await fetchApi(
baseUrl + 'ajax/chapters/',
{ method: 'POST' })
.then(res => res.text());
}
if (html !== '0') {
loadedCheerio = parseHTML(html);
}
const chapters: Chapter.Item[] = [];
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 = parseMadaraDate(releaseDate);
} else {
/**
* Insert current date
*/
releaseDate = dayjs().format('LL');
}
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = chapters.reverse();
return novel;
};
export const parseChapter: Plugin.parseChapter = async (chapterUrl) => {
const url = baseUrl + "/" + "series" + "/" + chapterUrl;
const body = await fetchApi(chapterUrl).then(res => res.text());
const loadedCheerio = parseHTML(body);
const chapterText =
loadedCheerio('.text-left').html() ||
loadedCheerio('.text-right').html() ||
loadedCheerio('.entry-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url);
};
@@ -0,0 +1,205 @@
import { load as parseHTML } from "cheerio";
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus"
import { parseMadaraDate } from "@libs/parseMadaraDate";
import dayjs from "dayjs";
export const id = "sweetEscapeTL";
export const name = "Sweet Escape Translations [madara]";
export const icon = "multisrc/madara/icons/sweetescapetranslations.png";
export const version = "1.0.0";
export const site = "https://sweetescapetranslations.com/";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
const novels: Novel.Item[] = [];
const sortOrder = showLatestNovels
? '?m_orderby=latest'
: '/?m_orderby=rating';
let url = site + "manga" + '/page/' + pageNo + sortOrder;
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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: Novel.Item = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters = async (
novelUrl
) => {
const novel: Novel.instance = {
url: novelUrl,
};
const body = await fetchApi(novelUrl).then(res => res.text());
let loadedCheerio = parseHTML(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;
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.Ongoing
: 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 = await fetchApi(
baseUrl + 'wp-admin/admin-ajax.php',
{
method: 'POST',
body: JSON.stringify(body),
})
.then(res => res.text());
} else {
html = await fetchApi(
baseUrl + 'ajax/chapters/',
{ method: 'POST' })
.then(res => res.text());
}
if (html !== '0') {
loadedCheerio = parseHTML(html);
}
const chapters: Chapter.Item[] = [];
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 = parseMadaraDate(releaseDate);
} else {
/**
* Insert current date
*/
releaseDate = dayjs().format('LL');
}
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = chapters.reverse();
return novel;
};
export const parseChapter: Plugin.parseChapter = async (chapterUrl) => {
const url = baseUrl + "/" + "manga" + "/" + chapterUrl;
const body = await fetchApi(chapterUrl).then(res => res.text());
const loadedCheerio = parseHTML(body);
const chapterText =
loadedCheerio('.text-left').html() ||
loadedCheerio('.text-right').html() ||
loadedCheerio('.entry-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url);
};
+205
View File
@@ -0,0 +1,205 @@
import { load as parseHTML } from "cheerio";
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus"
import { parseMadaraDate } from "@libs/parseMadaraDate";
import dayjs from "dayjs";
export const id = "webnovelover";
export const name = "WebNovelLover [madara]";
export const icon = "multisrc/madara/icons/webnovellover.png";
export const version = "1.0.0";
export const site = "https://www.webnovelover.com/";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
const novels: Novel.Item[] = [];
const sortOrder = showLatestNovels
? '?m_orderby=latest'
: '/?m_orderby=rating';
let url = site + "novel" + '/page/' + pageNo + sortOrder;
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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: Novel.Item = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters = async (
novelUrl
) => {
const novel: Novel.instance = {
url: novelUrl,
};
const body = await fetchApi(novelUrl).then(res => res.text());
let loadedCheerio = parseHTML(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;
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.Ongoing
: 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 = await fetchApi(
baseUrl + 'wp-admin/admin-ajax.php',
{
method: 'POST',
body: JSON.stringify(body),
})
.then(res => res.text());
} else {
html = await fetchApi(
baseUrl + 'ajax/chapters/',
{ method: 'POST' })
.then(res => res.text());
}
if (html !== '0') {
loadedCheerio = parseHTML(html);
}
const chapters: Chapter.Item[] = [];
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 = parseMadaraDate(releaseDate);
} else {
/**
* Insert current date
*/
releaseDate = dayjs().format('LL');
}
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = chapters.reverse();
return novel;
};
export const parseChapter: Plugin.parseChapter = async (chapterUrl) => {
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
const body = await fetchApi(chapterUrl).then(res => res.text());
const loadedCheerio = parseHTML(body);
const chapterText =
loadedCheerio('.text-left').html() ||
loadedCheerio('.text-right').html() ||
loadedCheerio('.entry-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url);
};
+205
View File
@@ -0,0 +1,205 @@
import { load as parseHTML } from "cheerio";
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus"
import { parseMadaraDate } from "@libs/parseMadaraDate";
import dayjs from "dayjs";
export const id = "wuxiaworld.site";
export const name = "WuxiaWorld.Site [madara]";
export const icon = "multisrc/madara/icons/wuxiaworld.site.png";
export const version = "1.0.0";
export const site = "https://wuxiaworld.site/";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
const novels: Novel.Item[] = [];
const sortOrder = showLatestNovels
? '?m_orderby=latest'
: '/?m_orderby=rating';
let url = site + "novel" + '/page/' + pageNo + sortOrder;
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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: Novel.Item = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters = async (
novelUrl
) => {
const novel: Novel.instance = {
url: novelUrl,
};
const body = await fetchApi(novelUrl).then(res => res.text());
let loadedCheerio = parseHTML(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;
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.Ongoing
: 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 = await fetchApi(
baseUrl + 'wp-admin/admin-ajax.php',
{
method: 'POST',
body: JSON.stringify(body),
})
.then(res => res.text());
} else {
html = await fetchApi(
baseUrl + 'ajax/chapters/',
{ method: 'POST' })
.then(res => res.text());
}
if (html !== '0') {
loadedCheerio = parseHTML(html);
}
const chapters: Chapter.Item[] = [];
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 = parseMadaraDate(releaseDate);
} else {
/**
* Insert current date
*/
releaseDate = dayjs().format('LL');
}
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = chapters.reverse();
return novel;
};
export const parseChapter: Plugin.parseChapter = async (chapterUrl) => {
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
const body = await fetchApi(chapterUrl).then(res => res.text());
const loadedCheerio = parseHTML(body);
const chapterText =
loadedCheerio('.text-left').html() ||
loadedCheerio('.text-right').html() ||
loadedCheerio('.entry-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url);
};
+205
View File
@@ -0,0 +1,205 @@
import { load as parseHTML } from "cheerio";
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus"
import { parseMadaraDate } from "@libs/parseMadaraDate";
import dayjs from "dayjs";
export const id = "zetroTL";
export const name = "Zetro Translation [madara]";
export const icon = "multisrc/madara/icons/zetrotranslation.png";
export const version = "1.0.0";
export const site = "https://zetrotranslation.com/";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
const novels: Novel.Item[] = [];
const sortOrder = showLatestNovels
? '?m_orderby=latest'
: '/?m_orderby=rating';
let url = site + "novel" + '/page/' + pageNo + sortOrder;
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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: Novel.Item = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters = async (
novelUrl
) => {
const novel: Novel.instance = {
url: novelUrl,
};
const body = await fetchApi(novelUrl).then(res => res.text());
let loadedCheerio = parseHTML(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;
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.Ongoing
: 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 = await fetchApi(
baseUrl + 'wp-admin/admin-ajax.php',
{
method: 'POST',
body: JSON.stringify(body),
})
.then(res => res.text());
} else {
html = await fetchApi(
baseUrl + 'ajax/chapters/',
{ method: 'POST' })
.then(res => res.text());
}
if (html !== '0') {
loadedCheerio = parseHTML(html);
}
const chapters: Chapter.Item[] = [];
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 = parseMadaraDate(releaseDate);
} else {
/**
* Insert current date
*/
releaseDate = dayjs().format('LL');
}
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = chapters.reverse();
return novel;
};
export const parseChapter: Plugin.parseChapter = async (chapterUrl) => {
const url = baseUrl + "/" + "novel" + "/" + chapterUrl;
const body = await fetchApi(chapterUrl).then(res => res.text());
const loadedCheerio = parseHTML(body);
const chapterText =
loadedCheerio('.text-left').html() ||
loadedCheerio('.text-right').html() ||
loadedCheerio('.entry-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url);
};
+205
View File
@@ -0,0 +1,205 @@
import { load as parseHTML } from "cheerio";
import { fetchFile, fetchApi } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { NovelStatus } from "@libs/novelStatus"
import { parseMadaraDate } from "@libs/parseMadaraDate";
import dayjs from "dayjs";
export const id = "zinnovel";
export const name = "ZinnNovel [madara]";
export const icon = "multisrc/madara/icons/zinnnovel.png";
export const version = "1.0.0";
export const site = "https://zinnovel.com/";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async (pageNo, {showLatestNovels}) => {
const novels: Novel.Item[] = [];
const sortOrder = showLatestNovels
? '?m_orderby=latest'
: '/?m_orderby=rating';
let url = site + "manga" + '/page/' + pageNo + sortOrder;
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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: Novel.Item = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters = async (
novelUrl
) => {
const novel: Novel.instance = {
url: novelUrl,
};
const body = await fetchApi(novelUrl).then(res => res.text());
let loadedCheerio = parseHTML(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;
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.Ongoing
: 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 = await fetchApi(
baseUrl + 'wp-admin/admin-ajax.php',
{
method: 'POST',
body: JSON.stringify(body),
})
.then(res => res.text());
} else {
html = await fetchApi(
baseUrl + 'ajax/chapters/',
{ method: 'POST' })
.then(res => res.text());
}
if (html !== '0') {
loadedCheerio = parseHTML(html);
}
const chapters: Chapter.Item[] = [];
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 = parseMadaraDate(releaseDate);
} else {
/**
* Insert current date
*/
releaseDate = dayjs().format('LL');
}
let chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = chapters.reverse();
return novel;
};
export const parseChapter: Plugin.parseChapter = async (chapterUrl) => {
const url = baseUrl + "/" + "manga" + "/" + chapterUrl;
const body = await fetchApi(chapterUrl).then(res => res.text());
const loadedCheerio = parseHTML(body);
const chapterText =
loadedCheerio('.text-left').html() ||
loadedCheerio('.text-right').html() ||
loadedCheerio('.entry-content').html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async (searchTerm) => {
const novels: Novel.Item[] = [];
const url = baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
const body = await fetchApi(url).then(res => res.text());
const loadedCheerio = parseHTML(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;
};
export const fetchImage: Plugin.fetchImage = async (url) => {
return await fetchFile(url);
};
-171
View File
@@ -1,171 +0,0 @@
const cheerio = require('cheerio');
const fetchApi = require('@libs/fetchApi');
const fetchFile = require('@libs/fetchFile');
const languages = require('@libs/languages');
const pluginId = 'ANF.com';
const sourceName = 'AllNovelFull';
const baseUrl = 'https://allnovelfull.com';
async function popularNovels (page) {
const url = `${baseUrl}/most-popular?page=${page}`;
const result = await fetchApi(url);
console.log(result.ok);
const body = await result.text();
const loadedCheerio = cheerio.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 =
baseUrl + loadedCheerio(this).find('img.cover').attr('src');
const novelUrl =
baseUrl + loadedCheerio(this).find('h3.truyen-title > a').attr('href');
const novel = {
url: novelUrl,
name: novelName,
cover: novelCover,
};
console.log(novel);
novels.push(novel);
});
return novels;
};
async function parseNovelAndChapters (novelUrl) {
const url = novelUrl;
const result = await fetchApi(url);
const body = await result.text();
let loadedCheerio = cheerio.load(body);
let novel = {
url: novelUrl,
};
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('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');
async function getChapters (id) {
const chapterListUrl = baseUrl + '/ajax/chapter-option?novelId=' + id;
const data = await fetchApi(chapterListUrl);
const chapters = await data.text();
loadedCheerio = cheerio.load(chapters);
let novelChapters = [];
loadedCheerio('select > option').each(function () {
let chapterName = loadedCheerio(this).text();
let releaseDate = null;
let chapterUrl = loadedCheerio(this)
.attr('value')
?.replace(`/${novelUrl}`, '');
if (chapterUrl) {
novelChapters.push({
name: chapterName,
releaseTime: releaseDate,
url: chapterUrl,
});
}
});
return novelChapters;
};
if (novelId) {
novel.chapters = await getChapters(novelId);
}
return novel;
};
async function parseChapter (chapterUrl) {
const url = baseUrl + chapterUrl;
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = cheerio.load(body);
const chapterText = loadedCheerio('#chapter-content').html() || '';
return chapterText;
};
async function searchNovels (searchTerm){
const url = `${baseUrl}/search?keyword=${searchTerm}`;
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = cheerio.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;
};
module.exports = {
id: pluginId,
name: sourceName,
site: baseUrl,
version: '1.0.0',
lang: languages.English,
icon: 'src/en/allnovelfull/icon.png',
popularNovels,
parseNovelAndChapters,
parseChapter,
searchNovels,
fetchImage: fetchFile,
};
+200
View File
@@ -0,0 +1,200 @@
import { load as cheerioload } from "cheerio";
import { Chapter, Novel, Plugin } from "@typings/plugin";
import { fetchApi, fetchFile } from "@libs/fetch";
export const id = "ANF.com";
export const name = "AllNovelFull";
export const site = "https://allnovelfull.com";
export const version = "1.0.0";
export const icon = "src/en/allnovelfull/icon.png";
export const popularNovels: Plugin.popularNovels = async function (page) {
const url = `${site}/most-popular?page=${page}`;
const result = await fetchApi(url, {});
if (!result.ok) {
console.error("Cloudflare error");
// console.error(await result.text());
// TODO: Cloudflare protection or other error
return [];
}
const body = await result.text();
const loadedCheerio = cheerioload(body);
const novels: Novel.Item[] = [];
loadedCheerio(".col-truyen-main .list-truyen .row").each(function () {
const novelName = loadedCheerio(this)
.find("h3.truyen-title > a")
.text();
const novelCover =
site + loadedCheerio(this).find("img.cover").attr("src");
const novelUrl =
site + loadedCheerio(this).find("h3.truyen-title > a").attr("href");
const novel = {
url: novelUrl,
name: novelName,
cover: novelCover,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters =
async function (novelUrl) {
const url = novelUrl;
const result = await 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 = await result.text();
let loadedCheerio = cheerioload(body);
let novel: Novel.instance = {
url: novelUrl,
};
novel.name = loadedCheerio("div.book > img").attr("alt");
novel.cover = 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");
async function getChapters(id: string) {
const chapterListUrl = site + "/ajax/chapter-option?novelId=" + id;
const data = await fetchApi(chapterListUrl);
if (!data.ok) {
console.error("Cloudflare error");
// console.error(await result.text());
// TODO: Cloudflare protection or other error
return [];
}
const chapters = await data.text();
loadedCheerio = cheerioload(chapters);
const novelChapters: Chapter.Item[] = [];
loadedCheerio("select > option").each(function () {
let chapterName = loadedCheerio(this).text();
let releaseDate = null;
let chapterUrl = loadedCheerio(this)
.attr("value")
?.replace(`/${novelUrl}`, "");
if (chapterUrl) {
novelChapters.push({
name: chapterName,
releaseTime: releaseDate,
url: chapterUrl,
});
}
});
return novelChapters;
}
if (novelId) {
novel.chapters = await getChapters(novelId);
}
return novel;
};
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
const url = site + chapterUrl;
const result = await 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 = await result.text();
const loadedCheerio = cheerioload(body);
const chapterText = loadedCheerio("#chapter-content").html() || "";
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async function (searchTerm) {
const url = `${site}/search?keyword=${searchTerm}`;
const result = await fetchApi(url);
if (!result.ok) {
console.error(await result.text());
// TODO: Cloudflare protection or other error
return [];
}
const body = await result.text();
const loadedCheerio = cheerioload(body);
let novels: Novel.Item[] = [];
loadedCheerio("div.col-truyen-main > div.list-truyen > .row").each(
function () {
const novelUrl =
site +
loadedCheerio(this).find("h3.truyen-title > a").attr("href");
const novelName = loadedCheerio(this)
.find("h3.truyen-title > a")
.text();
const novelCover =
site + loadedCheerio(this).find("img").attr("src");
if (novelUrl) {
novels.push({
url: novelUrl,
name: novelName,
cover: novelCover,
});
}
}
);
return novels;
};
export const fetchImage: Plugin.fetchImage = async function (url, init) {
return await fetchFile(url, init);
};
exports.protected = false;
-143
View File
@@ -1,143 +0,0 @@
const cheerio = require('cheerio');
const fetchApi = require('@libs/fetchApi');
const fetchFile = require('@libs/fetchFile');
const languages = require('@libs/languages');
const Status = require('@libs/novelStatus');
const pluginId = "BLN.com";
const sourceName = 'BestLightNovel';
const baseUrl = 'https://bestlightnovel.com/';
async function popularNovels (page) {
const url =
baseUrl + 'novel_list?type=topview&category=all&state=all&page=1' + page;
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = cheerio.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');
const novel = { name: novelName, cover: novelCover, url: novelUrl };
novels.push(novel);
});
return novels;
};
async function parseNovelAndChapters (novelUrl) {
const url = novelUrl;
const result = await fetchApi(url);
const body = await result.text();
let loadedCheerio = cheerio.load(body);
let novel = {
url,
name: '',
cover: '',
author: '',
status: Status.Unknown,
genres: '',
summary: '',
chapters: [],
};
novel.name = loadedCheerio('.truyen_info_right h1').text().trim();
novel.cover = loadedCheerio('.info_image img').attr('src');
novel.summary = loadedCheerio('#noidungm').text()?.trim();
novel.author = loadedCheerio(
'#main_body > div.cotgiua > div.truyen_info_wrapper > div.truyen_info > div.entry-header > div.truyen_if_wrap > ul > li:nth-child(2) > a',
)
.text()
?.trim();
let status = loadedCheerio(
'#main_body > div.cotgiua > div.truyen_info_wrapper > div.truyen_info > div.entry-header > div.truyen_if_wrap > ul > li:nth-child(4) > a',
)
.text()
?.trim();
novel.status =
status === 'ONGOING'
? Status.Ongoing
: status === 'COMPLETED'
? Status.Completed
: Status.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');
novelChapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = novelChapters.reverse();
return novel;
};
async function parseChapter ( chapterUrl) {
const url = chapterUrl;
const result = await fetchApi(url);
const body = await result.text();
let loadedCheerio = cheerio.load(body);
const chapterText = loadedCheerio('#vung_doc').html();
return chapterText;
};
async function searchNovels (searchTerm) {
const url = `${baseUrl}search_novels/${searchTerm}`;
const result = await fetchApi(url);
const body = await result.text();
let loadedCheerio = cheerio.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');
const novel = { name: novelName, cover: novelCover, url: novelUrl };
novels.push(novel);
});
return novels;
};
module.exports = {
id: pluginId,
name: sourceName,
site: baseUrl,
version: '1.0.0',
lang: languages.English,
icon: 'src/en/bestlightnovel/icon.png',
popularNovels,
parseNovelAndChapters,
parseChapter,
searchNovels,
fetchImage: fetchFile,
};
+172
View File
@@ -0,0 +1,172 @@
import { load as cheerioload } from "cheerio";
import { Chapter, Novel, Plugin } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
import { fetchApi, fetchFile } from "@libs/fetch";
import { NovelStatus } from "@libs/novelStatus";
export const id = "BLN.com";
export const name = "BestLightNovel";
export const site = "https://bestlightnovel.com/";
export const version = "1.0.0";
export const icon = "src/en/bestlightnovel/icon.png";
export const popularNovels: Plugin.popularNovels = async function (page) {
const url =
site + "novel_list?type=topview&category=all&state=all&page=1" + page;
const result = await fetchApi(url);
if (!result.ok) {
console.error(await result.text());
// TODO: Cloudflare protection or other error
return [];
}
const body = await result.text();
const loadedCheerio = cheerioload(body);
let novels: Novel.Item[] = [];
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;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters =
async function (novelUrl) {
const url = novelUrl;
const result = await fetchApi(url);
if (!result.ok) {
console.error(await result.text());
// TODO: Cloudflare protection
return { url, chapters: [] };
}
const body = await result.text();
let loadedCheerio = cheerioload(body);
let novel: Novel.instance = {
url,
name: "",
cover: "",
author: "",
status: NovelStatus.Unknown,
genres: "",
summary: "",
chapters: [],
};
novel.name = loadedCheerio(".truyen_info_right h1").text().trim();
novel.cover =
loadedCheerio(".info_image img").attr("src") || defaultCover;
novel.summary = loadedCheerio("#noidungm").text()?.trim();
novel.author = loadedCheerio(
"#main_body > div.cotgiua > div.truyen_info_wrapper > div.truyen_info > div.entry-header > div.truyen_if_wrap > ul > li:nth-child(2) > a"
)
.text()
?.trim();
let status = loadedCheerio(
"#main_body > div.cotgiua > div.truyen_info_wrapper > div.truyen_info > div.entry-header > div.truyen_if_wrap > ul > li:nth-child(4) > a"
)
.text()
?.trim();
novel.status =
status === "ONGOING"
? NovelStatus.Ongoing
: status === "COMPLETED"
? NovelStatus.Completed
: NovelStatus.Unknown;
let novelChapters: Chapter.Item[] = [];
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;
};
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
const url = chapterUrl;
const result = await fetchApi(url);
const body = await result.text();
let loadedCheerio = cheerioload(body);
const chapterText = loadedCheerio("#vung_doc").html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async function (searchTerm) {
const url = `${site}search_novels/${searchTerm}`;
const result = await fetchApi(url);
const body = await result.text();
let loadedCheerio = cheerioload(body);
let novels: Novel.Item[] = [];
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;
};
export const fetchImage: Plugin.fetchImage = (...args) => fetchFile(...args);
exports.protected = false;
-149
View File
@@ -1,149 +0,0 @@
const cheerio = require('cheerio');
const fetchApi = require('@libs/fetchApi');
const fetchFile = require('@libs/fetchFile');
const languages = require('@libs/languages');
const dayjs = require('dayjs');
const pluginId = 'comrademao';
const sourceName = 'Comrade Mao';
const baseUrl = 'https://comrademao.com/';
async function popularNovels (page) {
let url = baseUrl + 'page/' + page + '/?post_type=novel';
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = cheerio.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');
const novel = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
async function parseNovelAndChapters (novelUrl) {
const url = novelUrl;
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = cheerio.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 = dayjs(
loadedCheerio(this).find('.chapterdate').text(),
).format('LL');
const chapterName = loadedCheerio(this).find('.chapternum').text();
const chapterUrl = loadedCheerio(this).find('a').attr('href');
novelChapters.push({
name: chapterName,
url: chapterUrl,
releaseTime: releaseDate,
});
});
novel.chapters = novelChapters.reverse();
return novel;
};
async function parseChapter (chapterUrl) {
const url = chapterUrl;
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = cheerio.load(body);
let chapterText = loadedCheerio('#chaptercontent').html();
return chapterText;
};
async function searchNovels (searchTerm) {
const url = baseUrl + '?s=' + searchTerm + '&post_type=novel';
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = cheerio.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');
const novel = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
module.exports = {
id: pluginId,
name: sourceName,
site: baseUrl,
version: '1.0.0',
lang: languages.English,
icon: 'src/en/comrademao/icon.png',
popularNovels,
parseNovelAndChapters,
parseChapter,
searchNovels,
fetchImage: fetchFile,
};
+164
View File
@@ -0,0 +1,164 @@
import { load as cheerioload } from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import dayjs from "dayjs";
import { Chapter, Novel, Plugin } from "@typings/plugin";
export const id = "comrademao";
export const name = "Comrade Mao";
export const site = "https://comrademao.com/";
export const version = "1.0.0";
export const icon = "src/en/comrademao/icon.png";
export const popularNovels: Plugin.popularNovels = async function (page) {
let url = site + "page/" + page + "/?post_type=novel";
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = cheerioload(body);
let novels: Novel.Item[] = [];
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;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters =
async function (novelUrl) {
const url = novelUrl;
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = cheerioload(body);
let novel: Novel.instance = { 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: Chapter.Item[] = [];
loadedCheerio("#chapterlist")
.find("li")
.each(function () {
const releaseDate = dayjs(
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;
};
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
const url = chapterUrl;
const result = await fetchApi(url);
if (!result.ok) {
const err = await result.text();
console.error(err);
// TODO: Cloudflare protection or other error
return "Error!" + err;
}
const body = await result.text();
const loadedCheerio = cheerioload(body);
let chapterText = loadedCheerio("#chaptercontent").html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async function (searchTerm) {
const url = site + "?s=" + searchTerm + "&post_type=novel";
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = cheerioload(body);
let novels: Novel.Item[] = [];
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;
};
export const fetchImage: Plugin.fetchImage = (...args) => fetchFile(...args);
exports.protected = false;
-155
View File
@@ -1,155 +0,0 @@
const cheerio = require('cheerio');
const fetchApi = require('@libs/fetchApi');
const fetchFile = require('@libs/fetchFile');
const languages = require('@libs/languages');
const defaultCoverUri =
'https://github.com/LNReader/lnreader-sources/blob/main/icons/src/coverNotAvailable.jpg?raw=true';
const pluginId = 'DDL.com';
const sourceName = 'Divine Dao Library';
const baseUrl = 'https://www.divinedaolibrary.com/';
async function popularNovels (page) {
let url = baseUrl + 'novels';
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = cheerio.load(body);
let novels = [];
loadedCheerio('#main')
.find('li')
.each(function () {
const novelName = loadedCheerio(this).find('a').text();
const novelCover = defaultCoverUri;
const novelUrl = loadedCheerio(this).find(' a').attr('href');
const novel = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
async function parseNovelAndChapters (novelUrl) {
const url = novelUrl;
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = cheerio.load(body);
let novel = {url };
novel.name = loadedCheerio('h1.entry-title').text().trim();
novel.cover =
loadedCheerio('.entry-content').find('img').attr('data-ezsrc') || defaultCoverUri;
novel.summary = loadedCheerio('#main > article > div > p:nth-child(6)')
.text()
.trim();
novel.genres = null;
novel.status = null;
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');
novelChapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
novel.chapters = novelChapters;
return novel;
};
async function parseChapter (chapterUrl) {
const url = chapterUrl;
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = cheerio.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;
};
async function searchNovels (searchTerm) {
let url = baseUrl + 'novels';
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = cheerio.load(body);
let novels = [];
loadedCheerio('#main')
.find('li')
.each(function () {
const novelName = loadedCheerio(this).find('a').text();
const novelCover = defaultCoverUri;
const novelUrl = loadedCheerio(this).find(' a').attr('href');
const novel = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
novels = novels.filter(novel =>
novel.name.toLowerCase().includes(searchTerm.toLowerCase()),
);
return novels;
};
module.exports = {
id: pluginId,
name: sourceName,
site: baseUrl,
version: '1.0.0',
lang: languages.English,
icon: 'src/en/divinedaolibrary/icon.png',
popularNovels,
parseNovelAndChapters,
parseChapter,
searchNovels,
fetchImage: fetchFile,
};
+151
View File
@@ -0,0 +1,151 @@
import { load as parseHTML } from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import { Chapter, Novel, Plugin } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
export const id = "DDL.com";
export const name = "Divine Dao Library";
export const site = "https://www.divinedaolibrary.com/";
export const version = "1.0.0";
export const icon = "src/`en/divinedaolibrary/icon.png";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async function (page) {
let url = baseUrl + "novels";
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = parseHTML(body);
let novels: Novel.Item[] = [];
loadedCheerio("#main")
.find("li")
.each(function () {
const novelName = loadedCheerio(this).find("a").text();
const novelCover = 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;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters =
async function (novelUrl) {
const url = novelUrl;
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = parseHTML(body);
let novel: Novel.instance = { url };
novel.name = loadedCheerio("h1.entry-title").text().trim();
novel.cover =
loadedCheerio(".entry-content").find("img").attr("data-ezsrc") ||
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: Chapter.Item[] = [];
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;
};
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
const url = chapterUrl;
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = parseHTML(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;
};
export const searchNovels: Plugin.searchNovels = async function (searchTerm) {
let url = baseUrl + "novels";
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = parseHTML(body);
let novels: Novel.Item[] = [];
loadedCheerio("#main")
.find("li")
.each(function () {
const novelName = loadedCheerio(this).find("a").text();
const novelCover = 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;
};
export const fetchImage: Plugin.fetchImage = async function (url, init) {
return await fetchFile(url, init);
};
+196
View File
@@ -0,0 +1,196 @@
import { load as parseHTML } from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import { showToast } from "@libs/showToast";
import { Chapter, Novel, Plugin } from "@typings/plugin";
import { defaultCover } from "@libs/defaultCover";
export const id = "earlynovel";
export const name = "Early Novel";
export const version = "1.0.0";
export const icon = "multisrc/madara/icons/latestnovel.png";
export const site = "https://earlynovel.net/";
module.exports.protected = false;
const pluginId = id;
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async function (page) {
const url = `${baseUrl}most-popular?page=${page}`;
const body = await fetchApi(url, {}, pluginId).then((r) => r.text());
const loadedCheerio = parseHTML(body);
let novels: Novel.Item[] = [];
loadedCheerio(".col-truyen-main > .list-truyen > .row").each(function () {
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 +
loadedCheerio(this)
.find("h3.truyen-title > a")
.attr("href")
?.slice(1);
if (!novelUrl || !novelName) return;
const novel = {
name: novelName,
cover: novelCover || defaultCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters =
async function (novelUrl) {
showToast("Early Novel may take 20-30 seconds");
const url = novelUrl;
const body = await fetchApi(url, {}, pluginId).then((r) => r.text());
let loadedCheerio = parseHTML(body);
const name = loadedCheerio(".book > img").attr("alt");
const cover = loadedCheerio(".book > img").attr("src") || defaultCover;
const summary = loadedCheerio(".desc-text").text().trim();
const novel: Novel.instance = {
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: number) => new Promise((res) => setTimeout(res, ms));
const lastPageStr = loadedCheerio('a:contains("Last ")')
.attr("title")
?.match(/(\d+)/g);
const lastPage = Number(lastPageStr?.[1] || "0");
async function getChapters() {
let chapter: Chapter.Item[] = [];
for (let i = 1; i <= lastPage; i++) {
const chaptersUrl = `${novelUrl}?page=${i}`;
const chaptersHtml = await fetchApi(
chaptersUrl,
{},
pluginId
).then((r) => r.text());
loadedCheerio = parseHTML(chaptersHtml);
loadedCheerio("ul.list-chapter > li").each(function () {
const chapterName = loadedCheerio(this)
.find(".chapter-text")
.text()
.trim();
const releaseDate = null;
const chapterHref = loadedCheerio(this)
.find("a")
.attr("href")
?.slice(1);
if (!chapterHref) return;
const chapterUrl = baseUrl + chapterHref;
chapter.push({
name: chapterName,
releaseTime: releaseDate,
url: chapterUrl,
});
});
await delay(1000);
}
return chapter;
}
novel.chapters = await getChapters();
return novel;
};
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
const body = await fetchApi(chapterUrl, {}, pluginId).then((r) => r.text());
const loadedCheerio = parseHTML(body);
const chapterText = loadedCheerio("#chapter-c").html() || "";
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async function (searchTerm) {
const url = `${baseUrl}search?keyword=${searchTerm}`;
const body = await fetchApi(url, {}, pluginId).then((r) => r.text());
const loadedCheerio = parseHTML(body);
let novels: Novel.Item[] = [];
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;
};
export const fetchImage: Plugin.fetchImage = async function fetchImage(url) {
const headers = {
Referer: baseUrl,
};
return await fetchFile(url, { headers: headers });
};
+168
View File
@@ -0,0 +1,168 @@
import { load as parseHTML } from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import { Chapter, Novel, Plugin } from "@typings/plugin";
export const id = "fastnovel";
export const name = "Fast Novel";
export const version = "1.0.0";
export const icon = "src/en/fastnovel/icon.png";
export const site = "https://fastnovel.org/";
exports.protected = false;
const pluginId = id;
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async function (page) {
const url = `${baseUrl}sort/p/?page=${page}`;
const body = await fetchApi(url, {}, pluginId).then((r) => r.text());
const loadedCheerio = parseHTML(body);
let novels: Novel.Item[] = [];
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;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters =
async function (novelUrl) {
const url = novelUrl;
const body = await fetchApi(url, {}, pluginId).then((r) => r.text());
let loadedCheerio = parseHTML(body);
const novel: Novel.instance = {
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");
async function getChapters(id: string) {
const chapterListUrl =
baseUrl + "ajax/chapter-archive?novelId=" + id;
const data = await fetchApi(chapterListUrl);
const chapterdata = await data.text();
loadedCheerio = parseHTML(chapterdata);
let chapter: Chapter.Item[] = [];
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 = await getChapters(novelId);
}
return novel;
};
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
const body = await fetchApi(chapterUrl, {}, pluginId).then((r) => r.text());
const loadedCheerio = parseHTML(body);
loadedCheerio('#chr-content > div,h6,p[style="display: none;"]').remove();
let chapterText = loadedCheerio("#chr-content").html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async function (searchTerm) {
const url = `${baseUrl}search/?keyword=${searchTerm}`;
const body = await fetchApi(url, {}, pluginId).then((r) => r.text());
const loadedCheerio = parseHTML(body);
let novels: Novel.Item[] = [];
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;
};
export const fetchImage: Plugin.fetchImage = async function (url) {
const headers = {
Referer: baseUrl,
};
return await fetchFile(url, { headers: headers });
};
-162
View File
@@ -1,162 +0,0 @@
const cheerio = require('cheerio');
const languages = require('@libs/languages');
const fetchApi = require('@libs/fetchApi');
const fetchFile = require('@libs/fetchFile');
const pluginId = 'foxaholic';
const baseUrl = 'https://www.foxaholic.com/';
async function popularNovels (page){
const link = `${baseUrl}novel/page/${page}/?m_orderby=rating`;
const result = await fetchApi(link, {}, pluginId);
const body = await result.text();
const loadedCheerio = cheerio.load(body);
const novels = [];
loadedCheerio('.page-item-detail').each(function () {
const name = loadedCheerio(this).find('.h5 > a').text();
const cover = loadedCheerio(this).find('img').attr('data-src');
const url = loadedCheerio(this).find('.h5 > a').attr('href');
const novel = {
name,
url,
cover,
};
novels.push(novel);
});
return novels;
};
async function parseNovelAndChapters (novelUrl){
const url = novelUrl;
const result = await fetchApi(url, {}, pluginId);
const body = await result.text();
let loadedCheerio = cheerio.load(body);
const novel = {
url,
chapters: [],
};
novel.name = loadedCheerio('.post-title > h1')
.text()
.replace(/[\t\n]/g, '')
.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()
.replace(/[\t\n]/g, '')
.trim();
const detail = loadedCheerio(this)
.find('.summary-content')
.text()
.replace(/[\t\n]/g, '')
.trim();
switch (detailName) {
case 'Genre':
novel.genre = detail.trim().replace(/[\t\n]/g, ',');
break;
case 'Author':
novel.author = detail.trim();
break;
case 'Novel':
novel.status = detail.trim();
break;
}
});
loadedCheerio('.description-summary > div.summary__content')
.find('em')
.remove();
novel.summary = loadedCheerio('.description-summary > div.summary__content')
.text()
.trim();
let chapter = [];
loadedCheerio('.wp-manga-chapter').each(function () {
const name = loadedCheerio(this)
.find('a')
.text()
.replace(/[\t\n]/g, '')
.trim();
const releaseTime = loadedCheerio(this).find('span').text().trim();
const url = loadedCheerio(this).find('a').attr('href');
chapter.push({ name, releaseTime, url });
});
novel.chapters = chapter.reverse();
return novel;
};
async function parseChapter (chapterUrl){
const result = await fetchApi(chapterUrl, {}, pluginId);
const body = await result.text();
const loadedCheerio = cheerio.load(body);
let chapterText = loadedCheerio('.reading-content').html();
return chapterText;
};
async function searchNovels (searchTerm) {
const url = `${baseUrl}?s=${searchTerm}&post_type=wp-manga`;
const result = await fetchApi(url, {}, pluginId);
const body = await result.text();
const loadedCheerio = cheerio.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');
novels.push({
name: novelName,
url: novelUrl,
cover: novelCover,
});
});
return novels;
};
async function fetchImage (url){
const headers = {
Referer: baseUrl,
}
return await fetchFile(url, {headers: headers});
};
module.exports = {
id: pluginId,
name: 'Foxaholic',
version: '1.0.0',
icon: 'src/en/foxaholic/icon.png',
site: baseUrl,
lang: languages.English,
description: 'Digging Pits',
protected: false,
fetchImage,
popularNovels,
parseNovelAndChapters,
parseChapter,
searchNovels,
};
+170
View File
@@ -0,0 +1,170 @@
import { load as parseHTML } from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import { Chapter, Novel, Plugin } from "@typings/plugin";
export const id = "foxaholic";
export const name = "Foxaholic";
export const version = "1.0.0";
export const icon = "src/en/foxaholic/icon.png";
export const site = "https://www.foxaholic.com/";
module.exports.protected = false;
const pluginId = id;
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async function (page) {
const link = `${baseUrl}novel/page/${page}/?m_orderby=rating`;
const result = await fetchApi(link, {}, pluginId);
const body = await result.text();
const loadedCheerio = parseHTML(body);
const novels: Novel.Item[] = [];
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;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters =
async function (novelUrl) {
const url = novelUrl;
const result = await fetchApi(url, {}, pluginId);
const body = await result.text();
let loadedCheerio = parseHTML(body);
const novel: Novel.instance = {
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?.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: Chapter.Item[] = [];
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;
};
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
const result = await fetchApi(chapterUrl, {}, pluginId);
const body = await result.text();
const loadedCheerio = parseHTML(body);
loadedCheerio("img").removeAttr("srcset");
let chapterText = loadedCheerio(".reading-content").html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async function (searchTerm) {
const url = `${baseUrl}?s=${searchTerm}&post_type=wp-manga`;
const result = await fetchApi(url, {}, pluginId);
const body = await result.text();
const loadedCheerio = parseHTML(body);
const novels: Novel.Item[] = [];
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;
};
export const fetchImage: Plugin.fetchImage = async function (url) {
const headers = {
Referer: baseUrl,
};
return await fetchFile(url, { headers: headers });
};
+130
View File
@@ -0,0 +1,130 @@
import { load as parseHTML } from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import { showToast } from "@libs/showToast";
import { isUrlAbsolute } from "@libs/isAbsoluteUrl";
import { Novel, Plugin } from "@typings/plugin";
export const id = "freenovelupdates";
export const name = "Free Novel Updates (Broken)";
export const version = "1.0.0";
export const icon = "src/en/freenovelupdates/icon.png";
export const site = "https://www.freenovelupdates.com";
exports.protected = false;
const pluginId = id;
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async function (page) {
const url = `${baseUrl}genres/light-novel-1002`;
const body = await fetchApi(url, {}, pluginId).then((r) => r.text());
const loadedCheerio = parseHTML(body);
let novels: Novel.Item[] = [];
loadedCheerio(".books-item").each(function () {
let novelUrl = loadedCheerio(this).find("a").attr("href");
if (novelUrl && !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 && !isUrlAbsolute(novelCover)) {
novelCover = baseUrl + novelCover;
}
const novel = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
}
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters =
async function (novelUrl) {
const url = novelUrl;
const body = await fetchApi(url, {}, pluginId).then((r) => r.text());
let loadedCheerio = parseHTML(body);
const novel: Novel.instance = {
url,
chapters: [],
};
novel.name = loadedCheerio("h1").text();
let novelCover = loadedCheerio(".img > img").attr("src");
novel.cover = novelCover
? 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 () {
let chapterUrl = loadedCheerio(this).find("a").attr("href");
if (chapterUrl && !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,
};
novel.chapters?.push(chapter);
}
});
return novel;
};
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
const body = await fetchApi(chapterUrl, {}, pluginId).then((r) => r.text());
const loadedCheerio = parseHTML(body);
const chapterText = loadedCheerio(".content").html() || "";
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async function (searchTerm) {
showToast("Search is not available in this source");
return [];
};
export const fetchImage: Plugin.fetchImage = async function (url) {
const headers = {
Referer: baseUrl,
};
return await fetchFile(url, { headers: headers });
};
-173
View File
@@ -1,173 +0,0 @@
const cheerio = require('cheerio');
const fetchApi = require('@libs/fetchApi');
const fetchFile = require('@libs/fetchFile');
const languages = require('@libs/languages');
const pluginId = 'FWN.com';
const sourceName = "Web NOVEL";
const baseUrl = 'https://freewebnovel.com/';
async function popularNovels (page) {
let url = baseUrl + 'completed-novel/' + page;
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = cheerio.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;
};
async function parseNovelAndChapters (novelUrl) {
const url = novelUrl;
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = cheerio.load(body);
let novel = {};
novel.url = 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.artist = null;
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) {
if (loadedCheerio(this).find('a').text() === novel.name) {
latestChapter = loadedCheerio(this)
.next()
.find('span.s3')
.text()
.match(/\d+/);
}
});
latestChapter = latestChapter[0];
let prefixUrl = novelUrl.replace('.html', '/');
for (let i = 1; i <= parseInt(latestChapter, 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;
};
async function parseChapter (chapterUrl) {
const url = chapterUrl;
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = cheerio.load(body);
let chapterText = loadedCheerio('div.txt').html();
return chapterText;
};
async function searchNovels (searchTerm) {
const url = baseUrl + 'search/';
const formData = {
searchkey: searchTerm,
};
const result = await fetchApi(url, {
method: 'POST',
body: formData,
});
const body = await result.text();
const loadedCheerio = cheerio.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;
};
module.exports = {
id: pluginId,
name: sourceName,
site: baseUrl,
version: '1.0.0',
lang: languages.English,
icon: 'src/en/freewebnovel/icon.png',
popularNovels,
parseNovelAndChapters,
parseChapter,
searchNovels,
fetchImage: fetchFile,
};
+166
View File
@@ -0,0 +1,166 @@
import { load as parseHTML } from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import { Novel, Plugin } from "@typings/plugin";
export const id = "FWN.com";
export const name = "Web NOVEL";
export const site = "https://freewebnovel.com/";
export const version = "1.0.0";
export const icon = "src/en/freewebnovel/icon.png";
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async function (page) {
let url = baseUrl + "completed-novel/" + page;
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = parseHTML(body);
let novels: Novel.Item[] = [];
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;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters =
async function (novelUrl) {
const url = novelUrl;
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = parseHTML(body);
let novel: Novel.instance = {
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: string | undefined;
loadedCheerio("h3.tit").each(function (res) {
if (loadedCheerio(this).find("a").text() === novel.name) {
latestChapter = loadedCheerio(this)
.next()
.find("span.s3")
.text()
.match(/(\d+)/)?.[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;
};
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
const url = chapterUrl;
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = parseHTML(body);
let chapterText = loadedCheerio("div.txt").html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async function (searchTerm) {
const url = baseUrl + "search/";
const formData = {
searchkey: searchTerm,
};
const result = await fetchApi(url, {
method: "POST",
body: JSON.stringify(formData),
});
const body = await result.text();
const loadedCheerio = parseHTML(body);
let novels: Novel.Item[] = [];
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;
};
export const fetchImage: Plugin.fetchImage = fetchFile;
+213
View File
@@ -0,0 +1,213 @@
import { load as parseHTML } from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import { Chapter, Novel, Plugin } from "@typings/plugin";
export const id = "lightnovelpub";
export const name = "LightNovelPub";
export const version = "1.0.0";
export const icon = "src/en/lightnovelpub/icon.png";
export const site = "https://www.lightnovelpub.com/";
exports.protected = true;
const baseUrl = site;
const pluginId = id;
const headers = {
Accept: "application/json",
"Content-Type": "application/json",
};
export const popularNovels: Plugin.popularNovels = async function (page) {
const url = `${baseUrl}browse/all/popular/all/${page}`;
const body = await fetchApi(url, {}, pluginId).then((r) => r.text());
const loadedCheerio = parseHTML(body);
const novels: Novel.Item[] = [];
loadedCheerio(".novel-item.ads").remove();
loadedCheerio(".novel-item").each(function () {
const novelName = loadedCheerio(this)
.find(".novel-title")
.text()
.trim();
const novelCover = loadedCheerio(this).find("img").attr("data-src");
const novelUrl =
baseUrl +
loadedCheerio(this)
.find(".novel-title > a")
.attr("href")
?.substring(1);
const novel = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters =
async function (novelUrl) {
const url = novelUrl;
const body = await fetchApi(url, {}, pluginId).then((r) => r.text());
let loadedCheerio = parseHTML(body);
const novel: Novel.instance = {
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: number) => new Promise((res) => setTimeout(res, ms));
let lastPage = 1;
lastPage = parseInt(
loadedCheerio(
"#novel > header > div.header-body.container > div.novel-info > div.header-stats > span:nth-child(1) > strong"
)
.text()
?.trim()
);
lastPage = Math.ceil(lastPage / 100);
async function getChapters() {
let chapter: Chapter.Item[] = [];
for (let i = 1; i <= lastPage; i++) {
const chaptersUrl = `${novelUrl}/chapters/page-${i}`;
const chaptersHtml = await fetchApi(
chaptersUrl,
{ headers: headers },
pluginId
).then((r) => r.text());
loadedCheerio = parseHTML(chaptersHtml);
loadedCheerio(".chapter-list li").each(function () {
const chapterName = loadedCheerio(this)
.find(".chapter-title")
.text()
.trim();
const releaseDate = loadedCheerio(this)
.find(".chapter-update")
.text()
.trim();
const chapterUrl =
baseUrl +
loadedCheerio(this)
.find("a")
.attr("href")
?.substring(1);
chapter.push({
name: chapterName,
releaseTime: releaseDate,
url: chapterUrl,
});
});
await delay(1000);
}
return chapter;
}
novel.chapters = await getChapters();
return novel;
};
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
const body = await fetchApi(chapterUrl, {}, pluginId).then((r) => r.text());
const loadedCheerio = parseHTML(body);
let chapterText = loadedCheerio("#chapter-container").html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async function (searchTerm) {
const url = `${baseUrl}lnsearchlive`;
const link = `${baseUrl}search`;
const response = await fetchApi(link, {}, pluginId).then((r) => r.text());
const token = parseHTML(response);
let verifytoken = token("#novelSearchForm > input").attr("value");
let formData = new FormData();
formData.append("inputContent", searchTerm);
const body = await fetchApi(
url,
{
method: "POST",
headers: { LNRequestVerifyToken: verifytoken! },
body: formData,
},
pluginId
).then((r) => r.text());
let loadedCheerio = parseHTML(body);
let novels: Novel.Item[] = [];
let results = JSON.parse(loadedCheerio("body").text());
loadedCheerio = parseHTML(results.resultview);
loadedCheerio(".novel-item").each(function () {
const novelName = loadedCheerio(this)
.find("h4.novel-title")
.text()
.trim();
const novelCover = loadedCheerio(this).find("img").attr("src");
const novelUrl =
baseUrl + loadedCheerio(this).find("a").attr("href")?.substring(1);
novels.push({
name: novelName,
url: novelUrl,
cover: novelCover,
});
});
return novels;
};
export const fetchImage: Plugin.fetchImage = async function (url) {
return await fetchFile(url, { headers: headers });
};
+161
View File
@@ -0,0 +1,161 @@
import { load as parseHTML } from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import { Chapter, Novel, Plugin } from "@typings/plugin";
export const id = "LightNovelUpdates";
export const name = "Light Novel Updates";
export const version = "1.0.0";
export const icon = "src/en/lightnovelupdates/icon.png";
export const site = "https://www.lightnovelupdates.com/";
exports.protected = false;
const pluginId = id;
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async function (page) {
let url = `${baseUrl}novel/page/${page}/?m_orderby=rating`;
const body = await fetchApi(url, {}, pluginId).then((r) => r.text());
const loadedCheerio = parseHTML(body);
let novels: Novel.Item[] = [];
loadedCheerio(".page-item-detail").each(function () {
const novelName = loadedCheerio(this).find(".h5 > a").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;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters =
async function (novelUrl) {
const url = novelUrl;
const body = await fetchApi(url, {}, pluginId).then((r) => r.text());
let loadedCheerio = parseHTML(body);
const novel: Novel.instance = {
url,
chapters: [],
};
novel.name = loadedCheerio(".post-title > h1").text().trim();
novel.cover =
loadedCheerio(".summary_image > a > img").attr("src") || undefined;
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 "Genre(s)":
novel.genres = detail.trim().replace(/[\t\n]/g, ",");
break;
case "Author(s)":
novel.author = detail.trim();
break;
case "Status":
novel.status = detail.replace(/G/g, "g");
break;
}
});
novel.summary = loadedCheerio("div.summary__content").text();
const chapter: Chapter.Item[] = [];
const novelId = loadedCheerio(".rating-post-id").attr("value")!;
let formData = new FormData();
formData.append("action", "manga_get_chapters");
formData.append("manga", novelId);
const data = await fetchApi(
"https://www.lightnovelupdates.com/wp-admin/admin-ajax.php",
{
method: "POST",
body: formData,
},
pluginId
);
const text = await data.text();
loadedCheerio = parseHTML(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;
};
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
const chapterText = (await NovelUpdatesScraper.parseChapter(chapterUrl))
.chapterText;
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async function (searchTerm) {
const url = `${baseUrl}?s=${searchTerm}&post_type=wp-manga&m_orderby=rating`;
const body = await fetchApi(url, {}, pluginId).then((r) => r.text());
const loadedCheerio = parseHTML(body);
let novels: Novel.Item[] = [];
loadedCheerio(".c-tabs-item__content").each(function () {
const novelName = loadedCheerio(this).find(".h4 > a").text();
const novelCover = loadedCheerio(this).find("img").attr("src");
const novelUrl = loadedCheerio(this).find(".h4 > a").attr("href");
if (!novelUrl) return;
novels.push({
url: novelUrl,
name: novelName,
cover: novelCover,
});
});
return novels;
};
export const fetchImage: Plugin.fetchImage = async function (url) {
const headers = {
Referer: baseUrl,
};
return await fetchFile(url, { headers: headers });
};
+183
View File
@@ -0,0 +1,183 @@
import { load as parseHTML } from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import { showToast } from "@libs/showToast";
import { Chapter, Novel, Plugin } from "@typings/plugin";
const pluginId = "lnmtl";
const baseUrl = "https://lnmtl.com/";
export const popularNovels: Plugin.popularNovels = async function (page) {
let url = baseUrl + "novel?page=" + page;
const body = await fetchApi(url, {}, pluginId).then((r) => r.text());
const loadedCheerio = parseHTML(body);
let novels: Novel.Item[] = [];
loadedCheerio(".media").each(function () {
const novelName = loadedCheerio(this).find("h4").text();
const novelCover = loadedCheerio(this).find("img").attr("src");
const novelUrl = loadedCheerio(this).find("h4 > a").attr("href");
if (!novelUrl) return;
const novel = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters =
async function (novelUrl) {
showToast("LNMTL might take around 20-30 seconds.");
const url = novelUrl;
const body = await fetchApi(url, {}, pluginId).then((r) => r.text());
const loadedCheerio = parseHTML(body);
const novel: Novel.instance = {
url,
chapters: [],
};
novel.name = loadedCheerio(".novel-name").text();
novel.cover = loadedCheerio("div.novel").find("img").attr("src");
novel.summary = loadedCheerio("div.description").text().trim();
loadedCheerio(".panel-body > dl").each(function () {
let detailName = loadedCheerio(this).find("dt").text().trim();
let detail = loadedCheerio(this).find("dd").text().trim();
switch (detailName) {
case "Authors":
novel.author = detail;
break;
case "Current status":
novel.status = detail;
break;
}
});
novel.genres = loadedCheerio('.panel-heading:contains(" Genres ")')
.next()
.text()
.trim()
.replace(/\s\s/g, ",");
let volumes = JSON.parse(
loadedCheerio("main")
.next()
.html()
.match(/lnmtl.volumes = \[(.*?)\]/).[0]
.replace("lnmtl.volumes = ", "")
);
let chapters: Chapter.Item[] = [];
volumes = volumes.map((volume) => volume.id);
for (const volume of volumes) {
let volumeData = await fetchApi(
`https://lnmtl.com/chapter?page=1&volumeId=${volume}`
);
volumeData = await volumeData.json();
// volumeData = volumeData.data.map((volume) => volume.slug);
for (let i = 1; i <= volumeData.last_page; i++) {
let chapterData = await fetchApi(
`https://lnmtl.com/chapter?page=${i}&volumeId=${volume}`
);
chapterData = await chapterData.json();
chapterData = chapterData.data.map((chapter) => ({
name: `#${chapter.number} ${chapter.title}`,
url: `${baseUrl}chapter/${chapter.slug}`,
releaseTime: chapter.created_at,
}));
chapters.push(...chapterData);
}
}
novel.chapters = chapters;
return novel;
};
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
const body = await fetchApi(chapterUrl, {}, pluginId).then((r) => r.text());
const loadedCheerio = parseHTML(body);
loadedCheerio(".original").replaceWith("<br><br>");
let chapterText = loadedCheerio(".chapter-body").html();
if (!chapterText) {
chapterText = loadedCheerio(".alert.alert-warning").text();
}
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async function (searchTerm) {
const url = "https://lnmtl.com/term";
const body = await fetchApi(url, {}, pluginId).then((r) => r.text());
const loadedCheerio = parseHTML(body);
let novels:Novel.Item[] = loadedCheerio("footer")
.next()
.next()
.html()
.match(/local: \[(.*?)\]/)[0]
.replace("local: ", "");
novels = JSON.parse(novels);
novels = novels.filter((novel) =>
novel.name.toLowerCase().includes(searchTerm.toLowerCase())
);
novels = novels.map((novel) => ({
name: novel.name,
url: novel.slug,
cover: novel.image,
}));
return novels;
};
export const fetchImage: Plugin.fetchImage = async function (url) {
const headers = {
Referer: baseUrl,
};
return await fetchFile(url, { headers: headers });
};
module.exports = {
id: pluginId,
name: "LNMTL",
version: "1.0.0",
icon: "src/en/lnmtl/icon.png",
site: baseUrl,
protected: true,
fetchImage,
popularNovels,
parseNovelAndChapters,
parseChapter,
searchNovels,
};
+180
View File
@@ -0,0 +1,180 @@
import { load as parseHTML } from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import { Chapter, Novel, Plugin } from "@typings/plugin";
const pluginId = "mtlnovel";
const baseUrl = "https://www.mtlnovel.com/";
export const popularNovels: Plugin.popularNovels = async function (page) {
const url = `${baseUrl}alltime-rank/page/${page}`;
const headers = {
Referer: `${baseUrl}`,
"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 body = await fetchApi(
url,
{
method: "GET",
headers: headers,
},
pluginId
).then((result) => result.text());
const loadedCheerio = parseHTML(body);
let novels: Novel.Item[] = [];
loadedCheerio("div.box.wide").each(function () {
const novelName = loadedCheerio(this)
.find("a.list-title")
.text()
.slice(4);
const novelCover = loadedCheerio(this).find("amp-img").attr("src");
const novelUrl = loadedCheerio(this).find("a.list-title").attr("href");
if (!novelUrl) return;
const novel = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters =
async function (novelUrl) {
const url = novelUrl;
let headers = {
Referer: `${baseUrl}alltime-rank/`,
"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 body = await fetchApi(
url,
{
method: "GET",
headers: headers,
},
pluginId
).then((result) => result.text());
let loadedCheerio = parseHTML(body);
const novel: Novel.instance = {
url,
chapters: [],
};
novel.name = loadedCheerio("h1.entry-title").text();
novel.cover = loadedCheerio(".nov-head > amp-img").attr("src");
novel.summary = loadedCheerio("div.desc > h2").next().text().trim();
novel.author = loadedCheerio("#author").text();
novel.status = loadedCheerio("#status").text();
novel.genres = loadedCheerio("#genre").text().replace(/\s+/g, "");
const chapterListUrl = url + "chapter-list/";
async function getChapters() {
const listResult = await fetch(chapterListUrl);
const listBody = await listResult.text();
loadedCheerio = parseHTML(listBody);
let chapter: Chapter.Item[] = [];
loadedCheerio("div.ch-list")
.find("a.ch-link")
.each(function () {
const chapterName = loadedCheerio(this)
.text()
.replace("~ ", "");
const releaseDate = null;
const chapterUrl = loadedCheerio(this).attr("href");
chapter.push({
url: chapterUrl,
name: chapterName,
releaseTime: releaseDate,
});
});
return chapter.reverse();
}
novel.chapters = await getChapters();
return novel;
};
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
const body = await fetchApi(chapterUrl, {}, pluginId).then((r) => r.text());
const loadedCheerio = parseHTML(body);
const chapterText = loadedCheerio("div.par").html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async function (searchTerm) {
const searchUrl =
baseUrl +
"wp-admin/admin-ajax.php?action=autosuggest&q=" +
searchTerm +
"&__amp_source_origin=https%3A%2F%2Fwww.mtlnovel.com";
const res = await fetch(searchUrl);
const result = await res.json();
let novels: Novel.Item[] = [];
result.items[0].results.map((item) => {
const novelName = item.title.replace(/<\/?strong>/g, "");
const novelCover = item.thumbnail;
const novelUrl = item.permalink.replace(
"https://www.mtlnovel.com/",
""
);
const novel = { name: novelName, cover: novelCover, url: novelUrl };
novels.push(novel);
});
return novels;
};
export const fetchImage: Plugin.fetchImage = async function (url) {
const headers = {
Referer: baseUrl,
};
return await fetchFile(url, { headers: headers });
};
module.exports = {
id: pluginId,
name: "MTL Novel",
version: "1.0.0",
icon: "src/en/mtlnovel/icon.png",
site: baseUrl,
protected: false,
fetchImage,
popularNovels,
parseNovelAndChapters,
parseChapter,
searchNovels,
};
+133
View File
@@ -0,0 +1,133 @@
import { load as parseHTML } from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import { Chapter, Novel, Plugin } from "@typings/plugin";
export const id = "mtlreader";
export const name = "MTL Reader";
export const version = "1.0.0";
export const icon = "src/en/mtlreader/icon.png";
export const site = "https://mtlreader.com/";
exports.protected = false;
const pluginId = id;
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async function (page) {
const url = `${baseUrl}novels?page=${page}`;
const body = await fetchApi(url, {}, pluginId).then((r) => r.text());
const loadedCheerio = parseHTML(body);
let novels: Novel.Item[] = [];
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;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters =
async function (novelUrl) {
const url = novelUrl;
const body = await fetchApi(url, {}, pluginId).then((r) => r.text());
let loadedCheerio = parseHTML(body);
const novel: Novel.instance = {
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: Chapter.Item[] = [];
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;
};
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
const body = await fetchApi(chapterUrl, {}, pluginId).then((r) => r.text());
const loadedCheerio = parseHTML(body);
loadedCheerio(".container ins,script,p.mtlreader").remove();
const chapterText = loadedCheerio(".container").html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async function (searchTerm) {
const url = `${baseUrl}search?input=${searchTerm}`;
const body = await fetchApi(url, {}, pluginId).then((r) => r.text());
let loadedCheerio = parseHTML(body);
let novels: Novel.Item[] = [];
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;
};
export const fetchImage: Plugin.fetchImage = async function (url) {
const headers = {
Referer: baseUrl,
};
return await fetchFile(url, { headers: headers });
};
+182
View File
@@ -0,0 +1,182 @@
import { load as parseHTML } from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import { Chapter, Novel, Plugin } from "@typings/plugin";
export const id = "nitroscans";
export const name = "Nitroscans";
export const version = "1.0.0";
export const icon = "src/en/nitroscans/icon.png";
export const site = "https://nitroscans.com/";
exports.protected = false;
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async function (page) {
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 = await fetchApi(url, {
method: "POST",
body: formData,
}).then((r) => r.text());
const loadedCheerio = parseHTML(body);
let novels: Novel.Item[] = [];
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;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters =
async function (novelUrl) {
const url = novelUrl;
const body = await fetchApi(url).then((r) => r.text());
let loadedCheerio = parseHTML(body);
const novel: Novel.instance = {
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 = loadedCheerio(".summary__content").text()?.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: Chapter.Item[] = [];
let chapterlisturl = novelUrl + "ajax/chapters/";
const data = await fetchApi(chapterlisturl, { method: "POST" });
const text = await data.text();
loadedCheerio = parseHTML(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;
};
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
const body = await fetchApi(chapterUrl).then((r) => r.text());
let loadedCheerio = parseHTML(body);
const chapterText = loadedCheerio(".text-left").html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async function (searchTerm) {
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 = await fetchApi(url, {
method: "POST",
body: formData,
}).then((r) => r.text());
let loadedCheerio = parseHTML(body);
let novels: Novel.Item[] = [];
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;
};
export const fetchImage: Plugin.fetchImage = async function (url) {
const headers = {
Referer: baseUrl,
};
return await fetchFile(url, { headers: headers });
};
+416
View File
@@ -0,0 +1,416 @@
import { load as cheerioload } from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import { Novel, Plugin, Chapter } from "@typings/plugin";
import { Filter, FilterInputs } from "@libs/filterInputs";
export const id = "NobleMTL";
export const name = "NobleMTL";
export const version = "1.0.0";
export const icon = "src/en/noblemtl/icon.png";
export const site = "https://www.noblemtl.com/";
exports.protected = false;
export const popularNovels: Plugin.popularNovels = async function (
page,
{ filters }
) {
let link = `${site}series/?page=${page}`;
if (filters?.genres?.length) {
if (Array.isArray(filters.genres))
link += filters.genres.map((i) => `&genre[]=${i}`).join("");
}
if (filters?.type?.length) {
if (Array.isArray(filters.type))
link += filters.type.map((i) => `&lang[]=${i}`).join("");
}
link += "&status=" + (filters?.status ? filters?.status : "");
link += "&order=" + (filters?.order ? filters?.order : "popular");
const body = await fetchApi(link).then((result) => result.text());
const loadedCheerio = cheerioload(body);
const novels: Novel.Item[] = [];
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: Novel.Item = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters =
async function parseNovelAndChapters(novelUrl) {
const url = novelUrl;
const result = await fetchApi(url);
const body = await result.text();
let loadedCheerio = cheerioload(body);
const novel: Novel.instance = {
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: Chapter.Item[] = [];
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;
};
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
const result = await fetchApi(chapterUrl);
const body = await result.text();
const loadedCheerio = cheerioload(body);
let chapterText = loadedCheerio("div.epcontent").html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async function (searchTerm) {
const url = `${site}?s=${searchTerm}`;
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = cheerioload(body);
const novels: Novel.Item[] = [];
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;
};
export const fetchImage: Plugin.fetchImage = async function (url) {
const headers = {
Referer: site,
};
return await fetchFile(url, { headers: headers });
};
export const filters: Filter[] = [
{
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.Picker,
},
{
key: "status",
label: "Status",
values: [
{ label: "All", value: "" },
{ label: "Ongoing", value: "ongoing" },
{ label: "Hiatus", value: "hiatus" },
{ label: "Completed", value: "completed" },
],
inputType: 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.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.Checkbox,
},
];
+167
View File
@@ -0,0 +1,167 @@
import { fetchApi, fetchFile } from "@libs/fetch";
import { Chapter, Novel, Plugin } from "@typings/plugin";
import { load as parseHTML } from "cheerio";
export const id = "novelforest";
export const name = "Novel Forest (Broken)";
export const version = "1.0.0";
export const icon = "src/en/novelforest/icon.png";
export const site = "https://novelforest.com/";
exports.protected = false;
const pluginId = id;
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async function (page) {
const url = `${baseUrl}popular?page=${page}`;
const body = await fetchApi(url, {}, pluginId).then((r) => r.text());
const loadedCheerio = parseHTML(body);
let novels: Novel.Item[] = [];
loadedCheerio(".book-item").each(function () {
const novelName = loadedCheerio(this).find(".title").text();
const novelCover =
"https:" + loadedCheerio(this).find("img").attr("data-src");
const novelUrl =
baseUrl +
loadedCheerio(this).find(".title a").attr("href")?.substring(1);
const novel = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters = async (
novelUrl
) => {
const url = novelUrl;
const body = await fetchApi(url, {}, pluginId).then((r) => r.text());
let loadedCheerio = parseHTML(body);
const novel: Novel.instance = {
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 = 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()
?.trim();
novel.status = 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()
?.trim();
novel.genres = 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()
?.replace("Genres :", "")
.replace(/[\s\n]+/g, " ")
.trim();
let chapter: Chapter.Item[] = [];
const chaptersUrl =
novelUrl.replace(baseUrl, "https://novelforest.com/api/novels/") +
"/chapters?source=detail";
const chaptersRequest = await fetch(chaptersUrl);
const chaptersHtml = await chaptersRequest.text();
loadedCheerio = parseHTML(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 =
baseUrl + loadedCheerio(this).find("a").attr("href")?.substring(1);
chapter.push({
name: chapterName,
releaseTime: releaseDate,
url: chapterUrl,
});
});
novel.chapters = chapter;
return novel;
};
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
const body = await fetchApi(chapterUrl, {}, pluginId).then((r) => r.text());
let loadedCheerio = parseHTML(body);
loadedCheerio("#listen-chapter").remove();
loadedCheerio("#google_translate_element").remove();
const chapterText = loadedCheerio(".chapter__content").html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async function (searchTerm) {
const url = `${baseUrl}search?q=${searchTerm}`;
const body = await fetchApi(url, {}, pluginId).then((r) => r.text());
let loadedCheerio = parseHTML(body);
let novels: Novel.Item[] = [];
loadedCheerio(".book-item").each(function () {
const novelName = loadedCheerio(this).find(".title").text();
const novelCover =
"https:" + loadedCheerio(this).find("img").attr("data-src");
const novelUrl =
baseUrl +
loadedCheerio(this).find(".title a").attr("href")?.substring(1);
const novel = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const fetchImage: Plugin.fetchImage = fetchFile;
+172
View File
@@ -0,0 +1,172 @@
import { load as parseHTML } from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import { Chapter, Novel, Plugin } from "@typings/plugin";
export const id = "novelfull";
export const name = "NovelFull";
export const version = "1.0.0";
export const icon = "src/en/novelfull/icon.png";
export const site = "https://novelfull.com/";
exports.protected = false;
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async function (page) {
const url = `${baseUrl}most-popular?page=${page}`;
const result = await fetchApi(url);
const body = await result.text();
const loadedCheerio = parseHTML(body);
let novels: Novel.Item[] = [];
loadedCheerio(".col-truyen-main .list-truyen .row").each(function () {
const novelName = loadedCheerio(this)
.find("h3.truyen-title > a")
.text();
const novelCover =
baseUrl + loadedCheerio(this).find("img").attr("src")?.slice(1);
const novelUrl =
baseUrl +
loadedCheerio(this)
.find("h3.truyen-title > a")
.attr("href")
?.slice(1);
const novel = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters =
async function (novelUrl) {
const url = novelUrl;
const result = await fetchApi(url);
const body = await result.text();
let loadedCheerio = parseHTML(body);
const novel: Novel.instance = {
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")!;
async function getChapters(id: string) {
const chapterListUrl =
baseUrl + "ajax/chapter-option?novelId=" + id;
const data = await fetchApi(chapterListUrl);
const chapterlist = await data.text();
loadedCheerio = parseHTML(chapterlist);
let chapter: Chapter.Item[] = [];
loadedCheerio("select > option").each(function () {
const chapterName = loadedCheerio(this).text();
const releaseDate = null;
const chapterUrl =
baseUrl + loadedCheerio(this).attr("value")?.slice(1);
chapter.push({
name: chapterName,
releaseTime: releaseDate,
url: chapterUrl,
});
});
return chapter;
}
novel.chapters = await getChapters(novelId);
return novel;
};
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
const result = await fetchApi(chapterUrl);
const body = await result.text();
const loadedCheerio = parseHTML(body);
loadedCheerio("#chapter-content div.ads").remove();
let chapterText = loadedCheerio("#chapter-content").html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async function (searchTerm) {
const searchUrl = `${baseUrl}search?keyword=${searchTerm}`;
const result = await fetchApi(searchUrl);
const body = await result.text();
const loadedCheerio = parseHTML(body);
let novels: Novel.Item[] = [];
loadedCheerio(".col-truyen-main .list-truyen .row").each(function () {
const novelName = loadedCheerio(this)
.find("h3.truyen-title > a")
.text();
const novelCover =
baseUrl + loadedCheerio(this).find("img").attr("src")?.slice(1);
const novelUrl =
baseUrl +
loadedCheerio(this)
.find("h3.truyen-title > a")
.attr("href")
?.slice(1);
const novel = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const fetchImage: Plugin.fetchImage = async function (url) {
const headers = {
Referer: baseUrl,
};
return await fetchFile(url, { headers: headers });
};
+148
View File
@@ -0,0 +1,148 @@
import { load as parseHTML } from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import { Chapter, Novel, Plugin } from "@typings/plugin";
export const id = "novelhold";
export const name = "Novel Hold";
export const version = "1.0.0";
export const icon = "src/en/novelhold/icon.png";
export const site = "https://novelhold.com/";
exports.protected = false;
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async function (page) {
const url = `${baseUrl}all-${page}.html`;
const body = await fetchApi(url).then((r) => r.text());
const loadedCheerio = parseHTML(body);
let novels: Novel.Item[] = [];
loadedCheerio("#article_list_content > li").each(function () {
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 + loadedCheerio(this).find("a").attr("href")?.slice(1);
const novel = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters =
async function (novelUrl) {
const url = novelUrl;
const body = await fetchApi(url).then((r) => r.text());
let loadedCheerio = parseHTML(body);
const novel: Novel.instance = {
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 = loadedCheerio('p:contains("Genre")')
.text()
?.replace("Genre:", "")
.trim();
let chapter: Chapter.Item[] = [];
loadedCheerio("ul.chapterlist > li").each(function () {
const chapterName = loadedCheerio(this).find("a").text().trim();
const releaseDate = null;
const chapterUrl =
baseUrl + loadedCheerio(this).find("a").attr("href")?.slice(1);
chapter.push({
name: chapterName,
releaseTime: releaseDate,
url: chapterUrl,
});
});
novel.chapters = chapter;
console.log(novel);
return novel;
};
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
const body = await fetchApi(chapterUrl).then((r) => r.text());
let loadedCheerio = parseHTML(body);
const chapterText = loadedCheerio(".content").html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async function (searchTerm) {
const url = `${baseUrl}index.php?s=so&module=book&keyword=${searchTerm}`;
const body = await fetchApi(url).then((r) => r.text());
let loadedCheerio = parseHTML(body);
let novels: Novel.Item[] = [];
loadedCheerio("#article_list_content > li").each(function () {
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 + loadedCheerio(this).find("a").attr("href")?.slice(1);
const novel = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const fetchImage: Plugin.fetchImage = async function (url) {
const headers = {
Referer: baseUrl,
};
return await fetchFile(url, { headers: headers });
};
-182
View File
@@ -1,182 +0,0 @@
const cheerio = require('cheerio');
const fetchApi = require('@libs/fetchApi');
const fetchFile = require('@libs/fetchFile');
const languages = require('@libs/languages');
const baseUrl = 'https://www.novelpub.com/';
const sourceName = 'NovelPub';
const pluginId = 'novelpub.com';
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',
};
async function popularNovels (page) {
let url = baseUrl + 'browse/all/popular/all/' + page;
const result = await fetchApi(url, { method: 'GET', headers });
const body = await result.text();
const loadedCheerio = cheerio.load(body);
let novels = [];
loadedCheerio('.novel-item.ads').remove();
loadedCheerio('.novel-item').each(function () {
const novelName = loadedCheerio(this).find('.novel-title').text().trim();
const novelCover = loadedCheerio(this).find('img').attr('data-src');
const novelUrl =
baseUrl +
loadedCheerio(this).find('.novel-title > a').attr('href').substring(1);
const novel = { name: novelName, cover: novelCover, url: novelUrl };
novels.push(novel);
});
return novels;
};
async function parseNovelAndChapters (novelUrl) {
const url = novelUrl;
const result = await fetchApi(url, { method: 'GET', headers });
const body = await result.text();
let loadedCheerio = cheerio.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 = novel.genres.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 = loadedCheerio(
'#novel > header > div.header-body.container > div.novel-info > div.header-stats > span:nth-child(1) > strong',
)
.text()
?.trim();
lastPage = Math.ceil(lastPage / 100);
const getChapters = async () => {
let novelChapters = [];
for (let i = 1; i <= lastPage; i++) {
const chaptersUrl = `${novelUrl}/chapters/page-${i}`;
const chaptersRequest = await fetchApi(chaptersUrl, { headers });
const chaptersHtml = await chaptersRequest.text();
loadedCheerio = cheerio.load(chaptersHtml);
loadedCheerio('.chapter-list li').each(function () {
const chapterName = loadedCheerio(this)
.find('.chapter-title')
.text()
.trim();
const releaseDate = loadedCheerio(this)
.find('.chapter-update')
.text()
.trim();
const chapterUrl =
baseUrl + loadedCheerio(this).find('a').attr('href').substring(1);
novelChapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
});
await delay(1000);
}
return novelChapters;
};
novel.chapters = await getChapters();
return novel;
};
async function parseChapter (chapterUrl) {
const url = chapterUrl;
const result = await fetchApi(url, { method: 'GET', headers });
const body = await result.text();
const loadedCheerio = cheerio.load(body);
const chapterText = loadedCheerio('#chapter-container').html();
return chapterText;
};
// They have API to search, pls update it, im quite lazy xD
async function searchNovels (searchTerm) {
const url = `${baseUrl}lnwsearchlive?inputContent=${searchTerm}`;
const result = await fetchApi(url, { method: 'GET', headers });
const body = await result.text();
let loadedCheerio = cheerio.load(body);
let novels = [];
// let results = JSON.parse(loadedCheerio('body').text());
// loadedCheerio = cheerio.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;
};
module.exports = {
id: pluginId,
name: sourceName,
site: baseUrl,
version: '1.0.0',
lang: languages.English,
icon: 'src/en/novelpub/icon.png',
popularNovels,
parseNovelAndChapters,
parseChapter,
searchNovels,
fetchImage: fetchFile,
};
+189
View File
@@ -0,0 +1,189 @@
import { load as parseHTML } from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import { Chapter, Novel, Plugin } from "@typings/plugin";
export const id = "novelpub.com";
export const name = "NovelPub";
export const site = "https://www.novelpub.com/";
export const version = "1.0.0";
export const icon = "src/en/novelpub/icon.png";
const baseUrl = 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",
};
export const popularNovels: Plugin.popularNovels = async function (page) {
let url = baseUrl + "browse/all/popular/all/" + page;
const result = await fetchApi(url, { method: "GET", headers });
const body = await result.text();
const loadedCheerio = parseHTML(body);
let novels: Novel.Item[] = [];
loadedCheerio(".novel-item.ads").remove();
loadedCheerio(".novel-item").each(function () {
const novelName = loadedCheerio(this)
.find(".novel-title")
.text()
.trim();
const novelCover = loadedCheerio(this).find("img").attr("data-src");
const novelUrl =
baseUrl +
loadedCheerio(this)
.find(".novel-title > a")
.attr("href")
?.substring(1);
const novel = { name: novelName, cover: novelCover, url: novelUrl };
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters =
async function (novelUrl) {
const url = novelUrl;
const result = await fetchApi(url, { method: "GET", headers });
const body = await result.text();
let loadedCheerio = parseHTML(body);
let novel: Novel.instance = { 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 = novel.genres?.slice(0, -1);
novel.author = loadedCheerio(".author > a > span").text();
novel.summary = loadedCheerio(".summary > .content").text().trim();
const delay = (ms: number) => new Promise((res) => setTimeout(res, ms));
let lastPage = 1;
lastPage = parseInt(
loadedCheerio(
"#novel > header > div.header-body.container > div.novel-info > div.header-stats > span:nth-child(1) > strong"
)
.text()
?.trim()
);
lastPage = Math.ceil(lastPage / 100);
const getChapters = async () => {
let novelChapters: Chapter.Item[] = [];
for (let i = 1; i <= lastPage; i++) {
const chaptersUrl = `${novelUrl}/chapters/page-${i}`;
const chaptersRequest = await fetchApi(chaptersUrl, {
headers,
});
const chaptersHtml = await chaptersRequest.text();
loadedCheerio = parseHTML(chaptersHtml);
loadedCheerio(".chapter-list li").each(function () {
const chapterName = loadedCheerio(this)
.find(".chapter-title")
.text()
.trim();
const releaseDate = loadedCheerio(this)
.find(".chapter-update")
.text()
.trim();
const chapterUrl =
baseUrl +
loadedCheerio(this)
.find("a")
.attr("href")
?.substring(1);
novelChapters.push({
name: chapterName,
releaseTime: releaseDate,
url: chapterUrl,
});
});
await delay(1000);
}
return novelChapters;
};
novel.chapters = await getChapters();
return novel;
};
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
const url = chapterUrl;
const result = await fetchApi(url, { method: "GET", headers });
const body = await result.text();
const loadedCheerio = parseHTML(body);
const chapterText = loadedCheerio("#chapter-container").html();
return chapterText;
};
// They have API to search, pls update it, im quite lazy xD
export const searchNovels: Plugin.searchNovels = async function (searchTerm) {
const url = `${baseUrl}lnwsearchlive?inputContent=${searchTerm}`;
const result = await fetchApi(url, { method: "GET", headers });
const body = await result.text();
let loadedCheerio = parseHTML(body);
let novels: Novel.Item[] = [];
// 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;
};
export const fetchImage: Plugin.fetchImage = fetchFile;
+492
View File
@@ -0,0 +1,492 @@
import cheerio from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import { FilterInputs } from "@libs/filterInputs";
import { Chapter, Novel, Plugin } from "@typings/plugin";
const pluginId = "novelupdates";
const baseUrl = "https://www.novelupdates.com/";
const headers = {
"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",
};
function getPopularNovelsUrl(
page: number,
{ showLatestNovels, filters }: Plugin.Options
) {
let url = `${baseUrl}${
filters
? "series-finder"
: showLatestNovels
? "latest-series"
: "series-ranking"
}/`;
if (!filters) {
url += "?rank=week";
} else {
url += "?sf=1";
}
if (filters) {
if (Array.isArray(filters.novelType) && filters.novelType?.length) {
url += "&nt=" + filters?.novelType.join(",");
}
if (Array.isArray(filters.genres) && filters.genres?.length) {
url += "&gi=" + filters?.genres.join(",") + "&mgi=and";
}
if (Array.isArray(filters.language) && filters.language?.length) {
url += "&org=" + filters?.language.join(",");
}
if (filters.storyStatus) {
url += "&ss=" + filters?.storyStatus;
}
}
if (!filters?.sort) {
url += "&sort=" + "sdate";
} else {
url += "&sort=" + filters?.sort;
}
if (!filters?.order) {
url += "&order=" + "desc";
} else {
url += "&order=" + filters?.order;
}
return url;
}
export const popularNovels: Plugin.popularNovels = async function (
page,
{ showLatestNovels, filters }
) {
const url = getPopularNovelsUrl(page, { showLatestNovels, filters });
const result = await fetchApi(url, { headers: headers }, pluginId);
const body = await result.text();
const loadedCheerio = cheerio.load(body);
const novels: Novel.Item[] = [];
loadedCheerio("div.search_main_box_nu").each(function (res) {
const novelCover = loadedCheerio(this).find("img").attr("src");
const novelName = loadedCheerio(this).find(".search_title > a").text();
const novelUrl = loadedCheerio(this)
.find(".search_title > a")
.attr("href");
if (!novelUrl) return;
const novel = {
name: novelName,
cover: novelCover,
url: novelUrl,
};
novels.push(novel);
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters =
async function (novelUrl) {
const url = novelUrl;
const result = await fetchApi(url, { headers: headers }, pluginId);
const body = await result.text();
let loadedCheerio = cheerio.load(body);
const novel: Novel.instance = {
url,
chapters: [],
};
novel.name = loadedCheerio(".seriestitlenu").text();
novel.cover = loadedCheerio(".seriesimg > img").attr("src");
novel.author = loadedCheerio("#showauthors").text().trim();
novel.genres = loadedCheerio("#seriesgenre")
.children("a")
.map((i, el) => loadedCheerio(el).text())
.toArray()
.join(",");
novel.status = loadedCheerio("#editstatus").text().includes("Ongoing")
? "Ongoing"
: "Completed";
let type = loadedCheerio("#showtype").text().trim();
let summary = loadedCheerio("#editdescription").text().trim();
novel.summary = summary + `\n\nType: ${type}`;
let chapter: Chapter.Item[] = [];
const novelId = loadedCheerio("input#mypostid").attr("value")!;
let formData = new FormData();
formData.append("action", "nd_getchapters");
formData.append("mygrr", "0");
formData.append("mypostid", novelId);
let link = "https://www.novelupdates.com/wp-admin/admin-ajax.php";
const text = await fetchApi(
link,
{
method: "POST",
body: formData,
headers: headers,
},
pluginId
).then((data) => data.text());
loadedCheerio = cheerio.load(text);
loadedCheerio("li.sp_li_chp").each(function () {
const chapterName = loadedCheerio(this).text().trim();
const releaseDate = null;
const chapterUrl =
"https:" +
loadedCheerio(this).find("a").first().next().attr("href");
chapter.push({
name: chapterName,
releaseTime: releaseDate,
url: chapterUrl,
});
});
novel.chapters = chapter.reverse();
return novel;
};
function getLocation(href: string) {
var match = href.match(
/^(https?:)\/\/(([^:/?#]*)(?::([0-9]+))?)([/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/
);
return match && `${match[1]}//${match[3]}`;
}
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
// console.log('Original URL: ', chapterUrl);
let chapterText = "";
const result = await fetchApi(
chapterUrl,
{
method: "GET",
headers: headers,
},
pluginId
);
const body = await result.text();
// console.log(result.chapterUrl);
// console.log('Redirected URL: ', result.chapterUrl);
const loadedCheerio = cheerio.load(body);
let isWuxiaWorld = result.chapterUrl.toLowerCase().includes("wuxiaworld");
let isBlogspot = result.chapterUrl.toLowerCase().includes("blogspot");
let isTumblr = result.chapterUrl.toLowerCase().includes("tumblr");
let isWattpad = result.chapterUrl.toLowerCase().includes("wattpad");
let isLightNovelsTls = result.chapterUrl
.toLowerCase()
.includes("lightnovelstranslations");
let isiNovelTranslation = result.chapterUrl
.toLowerCase()
.includes("inoveltranslation");
let isTravisTranslation = result.chapterUrl
.toLowerCase()
.includes("travistranslations");
/**
* Checks if its a wordpress site
*/
let isWordPressStr =
loadedCheerio('meta[name="generator"]').attr("content") ||
loadedCheerio("footer").text();
let isWordPress = false;
if (isWordPressStr) {
isWordPress =
isWordPressStr.toLowerCase().includes("wordpress") ||
isWordPressStr.includes("Site Kit by Google") ||
loadedCheerio(".powered-by")
.text()
.toLowerCase()
.includes("wordpress");
}
let isRainOfSnow = result.chapterUrl.toLowerCase().includes("rainofsnow");
let isWebNovel = result.chapterUrl.toLowerCase().includes("webnovel");
let isHostedNovel = result.chapterUrl.toLowerCase().includes("hostednovel");
let isScribbleHub = result.chapterUrl.toLowerCase().includes("scribblehub");
if (isWuxiaWorld) {
chapterText = loadedCheerio("#chapter-content").html()!;
} else if (isRainOfSnow) {
chapterText = loadedCheerio("div.content").html()!;
} else if (isTumblr) {
chapterText = loadedCheerio(".post").html()!;
} else if (isBlogspot) {
loadedCheerio(".post-share-buttons").remove();
chapterText = loadedCheerio(".entry-content").html()!;
} else if (isHostedNovel) {
chapterText = loadedCheerio(".chapter").html()!;
} else if (isScribbleHub) {
chapterText = loadedCheerio("div.chp_raw").html()!;
} else if (isWattpad) {
chapterText = loadedCheerio(".container pre").html()!;
} else if (isTravisTranslation) {
chapterText = loadedCheerio(".reader-content").html()!;
} else if (isLightNovelsTls) {
chapterText = loadedCheerio(".text_story").html()!;
} else if (isiNovelTranslation) {
chapterText = loadedCheerio(".chakra-skeleton").html()!;
} else if (isWordPress) {
/**
* Remove wordpress bloat tags
*/
const bloatClasses = [
".c-ads",
"#madara-comments",
"#comments",
".content-comments",
".sharedaddy",
".wp-dark-mode-switcher",
".wp-next-post-navi",
".wp-block-buttons",
".wp-block-columns",
".post-cats",
".sidebar",
".author-avatar",
".ezoic-ad",
];
bloatClasses.map((tag) => loadedCheerio(tag).remove());
chapterText =
loadedCheerio(".entry-content").html() ||
loadedCheerio(".single_post").html() ||
loadedCheerio(".post-entry").html() ||
loadedCheerio(".main-content").html() ||
loadedCheerio("article.post").html() ||
loadedCheerio(".content").html() ||
loadedCheerio("#content").html() ||
loadedCheerio(".page-body").html() ||
loadedCheerio(".td-page-content").html()!;
} else if (isWebNovel) {
chapterText = loadedCheerio(".cha-words").html()!;
if (!chapterText) {
chapterText = loadedCheerio("._content").html()!;
}
} else {
/**
* Remove unnecessary tags
*/
const tags = ["nav", "header", "footer", ".hidden"];
tags.map((tag) => loadedCheerio(tag).remove());
chapterText = loadedCheerio("body").html()!;
}
if (chapterText) {
/**
* Convert relative urls to absolute
*/
chapterText = chapterText.replace(
/href="\//g,
`href="${getLocation(result.chapterUrl)}/`
);
}
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async function (searchTerm) {
const url =
"https://www.novelupdates.com/?s=" +
searchTerm +
"&post_type=seriesplans";
const result = await fetchApi(url, { headers: headers }, pluginId);
const body = await result.text();
const loadedCheerio = cheerio.load(body);
let novels: Novel.Item[] = [];
loadedCheerio("div.search_main_box_nu").each(function () {
const novelCover = loadedCheerio(this).find("img").attr("src");
const novelName = loadedCheerio(this).find(".search_title > a").text();
const novelUrl = loadedCheerio(this)
.find(".search_title > a")
.attr("href")
?.split("/")[4];
if (!novelUrl) return;
novels.push({
name: novelName,
url: novelUrl,
cover: novelCover,
});
});
return novels;
};
export const fetchImage: Plugin.fetchImage = async function (url) {
return await fetchFile(url, { headers: headers });
};
const filters = [
{
key: "sort",
label: "Sort Results By",
values: [
{ label: "Last Updated", value: "sdate" },
{ label: "Rating", value: "srate" },
{ label: "Rank", value: "srank" },
{ label: "Reviews", value: "sreview" },
{ label: "Chapters", value: "srel" },
{ label: "Title", value: "abc" },
{ label: "Readers", value: "sread" },
{ label: "Frequency", value: "sfrel" },
],
inputType: FilterInputs.Picker,
},
{
key: "order",
label: "Order",
values: [
{ label: "Descending", value: "desc" },
{ label: "Ascending", value: "asc" },
],
inputType: FilterInputs.Picker,
},
{
key: "storyStatus",
label: "Story Status (Translation)",
values: [
{ label: "All", value: "" },
{ label: "Completed", value: "2" },
{ label: "Ongoing", value: "3" },
{ label: "Hiatus", value: "4" },
],
inputType: FilterInputs.Picker,
},
{
key: "language",
label: "Language",
values: [
{ label: "Chinese", value: 495 },
{ label: "Filipino", value: 9181 },
{ label: "Indonesian", value: 9179 },
{ label: "Japanese", value: 496 },
{ label: "Khmer", value: 18657 },
{ label: "Korean", value: 497 },
{ label: "Malaysian", value: 9183 },
{ label: "Thai", value: 9954 },
{ label: "Vietnamese", value: 9177 },
],
inputType: FilterInputs.Checkbox,
},
{
key: "novelType",
label: "Novel Type",
values: [
{ label: "Light Novel", value: "2443" },
{ label: "Published Novel", value: "26874" },
{ label: "Web Novel", value: "2444" },
],
inputType: FilterInputs.Checkbox,
},
{
key: "genres",
label: "Genres",
values: [
{ label: "Action", value: 8 },
{ label: "Adult", value: 280 },
{ label: "Adventure", value: 13 },
{ label: "Comedy", value: 17 },
{ label: "Drama", value: 9 },
{ label: "Ecchi", value: 292 },
{ label: "Fantasy", value: 5 },
{ label: "Gender Bender", value: 168 },
{ label: "Harem", value: 3 },
{ label: "Historical", value: 330 },
{ label: "Horror", value: 343 },
{ label: "Josei", value: 324 },
{ label: "Martial Arts", value: 14 },
{ label: "Mature", value: 4 },
{ label: "Mecha", value: 10 },
{ label: "Mystery", value: 245 },
{ label: "Psychoical", value: 486 },
{ label: "Romance", value: 15 },
{ label: "School Life", value: 6 },
{ label: "Sci-fi", value: 11 },
{ label: "Seinen", value: 18 },
{ label: "Shoujo", value: 157 },
{ label: "Shoujo Ai", value: 851 },
{ label: "Shounen", value: 12 },
{ label: "Shounen Ai", value: 1692 },
{ label: "Slice of Life", value: 7 },
{ label: "Smut", value: 281 },
{ label: "Sports", value: 1357 },
{ label: "Supernatural", value: 16 },
{ label: "Tragedy", value: 132 },
{ label: "Wuxia", value: 479 },
{ label: "Xianxia", value: 480 },
{ label: "Xuanhuan", value: 3954 },
{ label: "Yaoi", value: 560 },
{ label: "Yuri", value: 922 },
],
inputType: FilterInputs.Checkbox,
},
];
module.exports = {
id: pluginId,
name: "Novel Updates",
version: "0.5.0",
icon: "src/en/novelupdates/icon.png",
site: baseUrl,
protected: false,
fetchImage,
popularNovels,
parseNovelAndChapters,
parseChapter,
searchNovels,
filters,
};
+274
View File
@@ -0,0 +1,274 @@
import { load as parseHTML } from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import { FilterInputs } from "@libs/filterInputs";
import { Chapter, Novel, Plugin } from "@typings/plugin";
export const id = "PandaMTL";
export const name = "PandaMTL";
export const version = "1.0.0";
export const icon = "src/en/wordpress/icon.png";
export const site = "https://www.pandamtl.com/";
exports.protected = false;
const pluginId = id;
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async function (
page,
{ filters }
) {
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?.status ? filters?.status : "");
link += "&order=" + (filters?.order ? filters?.order : "popular");
const body = await fetchApi(link, {}, pluginId).then((result) =>
result.text()
);
const loadedCheerio = parseHTML(body);
const novels: Novel.Item[] = [];
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;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters =
async function (novelUrl) {
const url = novelUrl;
const result = await fetchApi(url, {}, pluginId);
const body = await result.text();
let loadedCheerio = parseHTML(body);
const novel: Novel.instance = {
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: Chapter.Item[] = [];
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;
};
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
const result = await fetchApi(chapterUrl, {}, pluginId);
const body = await result.text();
const loadedCheerio = parseHTML(body);
let chapterText = loadedCheerio(".epcontent").html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async function (searchTerm) {
const url = `${baseUrl}?s=${searchTerm}`;
const result = await fetchApi(url, {}, pluginId);
const body = await result.text();
const loadedCheerio = parseHTML(body);
const novels: Novel.Item[] = [];
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;
};
export const fetchImage: Plugin.fetchImage = async function (url) {
const headers = {
Referer: baseUrl,
};
return await fetchFile(url, { headers: headers });
};
export const 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.Picker,
},
{
key: "status",
label: "Status",
values: [
{ label: "All", value: "" },
{ label: "Ongoing", value: "ongoing" },
{ label: "Hiatus", value: "hiatus" },
{ label: "Completed", value: "completed" },
],
inputType: FilterInputs.Picker,
},
{
key: "type",
label: "Type",
values: [
{ label: "Light Novel (KR)", value: "light-novel-kr" },
{ label: "Web Novel", value: "web-novel" },
],
inputType: 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.Checkbox,
},
];
+146
View File
@@ -0,0 +1,146 @@
import cheerio from "cheerio";
import { fetchApi, fetchFile } from "@libs/fetch";
import { Chapter, Novel, Plugin } from "@typings/plugin";
export const id = "wuxiaworld";
export const name = "Wuxia World (WIP)";
export const version = "0.5.0";
export const icon = "src/en/wuxiaworld/icon.png";
export const site = "https://www.wuxiaworld.com/";
exports.protected = true;
const pluginId = id;
const baseUrl = site;
export const popularNovels: Plugin.popularNovels = async function (page) {
const link = `${baseUrl}api/novels`;
const result = await fetchApi(link, {}, pluginId);
const data = await result.json();
let novels: Novel.Item[] = [];
data.items.map((novel) => {
let name = novel.name;
let cover = novel.coverUrl;
let url = baseUrl + "novel/" + novel.slug + "/";
novels.push({
name,
cover,
url,
});
});
return novels;
};
export const parseNovelAndChapters: Plugin.parseNovelAndChapters =
async function (novelUrl) {
const url = novelUrl;
console.log(url);
const result = await fetchApi(url, {}, pluginId);
const body = await result.text();
const loadedCheerio = cheerio.load(body);
const novel: Novel.instance = {
url,
chapters: [],
};
novel.name = loadedCheerio("h1.line-clamp-2").text();
novel.cover = loadedCheerio("img.absolute").attr("src");
novel.summary = loadedCheerio(
"div.flex-col:nth-child(4) > div > div > span > span"
)
.text()
.trim();
novel.author = loadedCheerio("div.MuiGrid-container > div > div > div")
.filter(function () {
return loadedCheerio(this).text().trim() === "Author:";
})
.next()
.text();
let genres: string[] = [];
loadedCheerio("a.MuiLink-underlineNone").each(function () {
genres.push(loadedCheerio(this).find("div > div").text());
});
novel.genres = genres.join(",");
novel.status = loadedCheerio("div.font-set-b10")
.text()
.includes("Complete");
let chapter: Chapter.Item[] = [];
loadedCheerio("div.border-b").each(function () {
const name = loadedCheerio(this)
.find("a > div > div > div > span")
.text();
const releaseTime = loadedCheerio(this)
.find("a > div > div > div > div > span")
.text();
let url = loadedCheerio(this).find("a").attr("href")?.slice(1);
url = `${baseUrl}${url}`;
chapter.push({ name, releaseTime, url });
});
novel.chapters = chapter;
return novel;
};
export const parseChapter: Plugin.parseChapter = async function (chapterUrl) {
const result = await fetchApi(chapterUrl, {}, pluginId);
const body = await result.text();
const loadedCheerio = cheerio.load(body);
loadedCheerio(".chapter-nav").remove();
loadedCheerio("#chapter-content > script").remove();
let chapterText = loadedCheerio("#chapter-content").html();
return chapterText;
};
export const searchNovels: Plugin.searchNovels = async function (searchTerm) {
const searchUrl = "https://www.wuxiaworld.com/api/novels/search?query=";
const url = `${searchUrl}${searchTerm}`;
const result = await fetchApi(url);
const data = await result.json();
const novels: Novel.Item[] = [];
data.items.map((novel) => {
let name = novel.name;
let cover = novel.cover;
let url = baseUrl + "novel/" + novel.slug + "/";
novels.push({
name,
url,
cover,
});
});
return novels;
};
export const fetchImage: Plugin.fetchImage = async function (url) {
const headers = {
Referer: baseUrl,
};
return await fetchFile(url, { headers: headers });
};