fix: Update Plugins (#677)
* typo * update * fix * fix * update * ifreedom * fix * fix ranobelib * ...
This commit is contained in:
@@ -15,7 +15,8 @@ interface MadaraOptionPath {
|
||||
chapter?: string;
|
||||
}
|
||||
|
||||
const MadaraDefaultPath: MadaraOptionPath = {
|
||||
const MadaraDefaultPath = {
|
||||
genres: "novel-genre",
|
||||
novels: "novel",
|
||||
novel: "novel",
|
||||
chapter: "novel",
|
||||
@@ -70,12 +71,12 @@ class MadaraPlugin implements Plugin.PluginBase {
|
||||
const novels: Plugin.NovelItem[] = [];
|
||||
|
||||
let url = this.site;
|
||||
if (filters?.genres && this.options?.path?.genres) {
|
||||
url += this.options?.path?.genres + filters.genres;
|
||||
if (filters?.genres?.value) {
|
||||
url += (this.options?.path?.genres || MadaraDefaultPath.genres) +
|
||||
"/" +
|
||||
filters.genres.value;
|
||||
} else {
|
||||
url += this.options?.path?.novels
|
||||
? this.options.path.novels
|
||||
: MadaraDefaultPath.novels;
|
||||
url += this.options?.path?.novels || MadaraDefaultPath.novels;
|
||||
}
|
||||
|
||||
url +=
|
||||
@@ -83,7 +84,7 @@ class MadaraPlugin implements Plugin.PluginBase {
|
||||
pageNo +
|
||||
"/" +
|
||||
"?m_orderby=" +
|
||||
(showLatestNovels ? "latest" : filters?.sort || "rating");
|
||||
(showLatestNovels ? "latest" : filters?.sort?.value || "rating");
|
||||
|
||||
const body = await fetchApi(url).then((res) => res.text());
|
||||
|
||||
|
||||
@@ -15,7 +15,8 @@ interface MadaraOptionPath {
|
||||
chapter?: string;
|
||||
}
|
||||
|
||||
const MadaraDefaultPath: MadaraOptionPath = {
|
||||
const MadaraDefaultPath = {
|
||||
genres: "novel-genre",
|
||||
novels: "novel",
|
||||
novel: "novel",
|
||||
chapter: "novel",
|
||||
@@ -70,12 +71,12 @@ class MadaraPlugin implements Plugin.PluginBase {
|
||||
const novels: Plugin.NovelItem[] = [];
|
||||
|
||||
let url = this.site;
|
||||
if (filters?.genres && this.options?.path?.genres) {
|
||||
url += this.options?.path?.genres + filters.genres;
|
||||
if (filters?.genres?.value) {
|
||||
url += (this.options?.path?.genres || MadaraDefaultPath.genres) +
|
||||
"/" +
|
||||
filters.genres.value;
|
||||
} else {
|
||||
url += this.options?.path?.novels
|
||||
? this.options.path.novels
|
||||
: MadaraDefaultPath.novels;
|
||||
url += this.options?.path?.novels || MadaraDefaultPath.novels;
|
||||
}
|
||||
|
||||
url +=
|
||||
@@ -83,7 +84,7 @@ class MadaraPlugin implements Plugin.PluginBase {
|
||||
pageNo +
|
||||
"/" +
|
||||
"?m_orderby=" +
|
||||
(showLatestNovels ? "latest" : filters?.sort || "rating");
|
||||
(showLatestNovels ? "latest" : filters?.sort?.value || "rating");
|
||||
|
||||
const body = await fetchApi(url).then((res) => res.text());
|
||||
|
||||
|
||||
@@ -15,7 +15,8 @@ interface MadaraOptionPath {
|
||||
chapter?: string;
|
||||
}
|
||||
|
||||
const MadaraDefaultPath: MadaraOptionPath = {
|
||||
const MadaraDefaultPath = {
|
||||
genres: "novel-genre",
|
||||
novels: "novel",
|
||||
novel: "novel",
|
||||
chapter: "novel",
|
||||
@@ -70,12 +71,12 @@ class MadaraPlugin implements Plugin.PluginBase {
|
||||
const novels: Plugin.NovelItem[] = [];
|
||||
|
||||
let url = this.site;
|
||||
if (filters?.genres && this.options?.path?.genres) {
|
||||
url += this.options?.path?.genres + filters.genres;
|
||||
if (filters?.genres?.value) {
|
||||
url += (this.options?.path?.genres || MadaraDefaultPath.genres) +
|
||||
"/" +
|
||||
filters.genres.value;
|
||||
} else {
|
||||
url += this.options?.path?.novels
|
||||
? this.options.path.novels
|
||||
: MadaraDefaultPath.novels;
|
||||
url += this.options?.path?.novels || MadaraDefaultPath.novels;
|
||||
}
|
||||
|
||||
url +=
|
||||
@@ -83,7 +84,7 @@ class MadaraPlugin implements Plugin.PluginBase {
|
||||
pageNo +
|
||||
"/" +
|
||||
"?m_orderby=" +
|
||||
(showLatestNovels ? "latest" : filters?.sort || "rating");
|
||||
(showLatestNovels ? "latest" : filters?.sort?.value || "rating");
|
||||
|
||||
const body = await fetchApi(url).then((res) => res.text());
|
||||
|
||||
|
||||
@@ -1,166 +1,152 @@
|
||||
|
||||
import { CheerioAPI, load } from "cheerio";
|
||||
import { fetchApi, fetchFile } from "@libs/fetch";
|
||||
import { Plugin } from "@typings/plugin";
|
||||
import { NovelStatus } from "@libs/novelStatus";
|
||||
|
||||
class LightNovelFRPlugin implements Plugin.PluginBase {
|
||||
id: string;
|
||||
name: string;
|
||||
icon: string;
|
||||
site: string;
|
||||
version: string;
|
||||
userAgent: string;
|
||||
cookieString: string;
|
||||
constructor() {
|
||||
this.id = "kol-novel";
|
||||
this.name = "Kol Novel[wpmangastream]";
|
||||
this.icon = "multisrc/wpmangastream/icons/kol-novel.png";
|
||||
this.site = "https://kolnovel.com/";
|
||||
this.version = "1.0.0";
|
||||
this.userAgent = "''";
|
||||
this.cookieString = "''";
|
||||
}
|
||||
|
||||
async popularNovels(page: number): Promise<Plugin.NovelItem[]> {
|
||||
let url = this.site + 'series/?page=' + page + '&status=&order=popular';
|
||||
const body = await(await fetchApi(url, {})).text();
|
||||
const loadedCheerio = load(body);
|
||||
|
||||
let novels: Plugin.NovelItem[] = [];
|
||||
|
||||
loadedCheerio('article.maindet').each(function () {
|
||||
const novelName = loadedCheerio(this).find('h2').text();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
const novelUrl = loadedCheerio(this).find('h2 a').attr('href');
|
||||
|
||||
if (!novelUrl) return;
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels;
|
||||
}
|
||||
|
||||
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
|
||||
const url = novelUrl;
|
||||
const body = await(await fetchApi(url, {})).text();
|
||||
let loadedCheerio = load(body);
|
||||
|
||||
const novel: Plugin.SourceNovel = { url };
|
||||
|
||||
// novel.url = url;
|
||||
novel.name = loadedCheerio('h1.entry-title').text();
|
||||
novel.cover =
|
||||
loadedCheerio('img.wp-post-image').attr('data-src') ||
|
||||
loadedCheerio('img.wp-post-image').attr('src');
|
||||
novel.status = loadedCheerio('div.sertostat > span').attr('class');
|
||||
|
||||
loadedCheerio('div.serl > span').each(function () {
|
||||
const detailName = loadedCheerio(this).text().trim();
|
||||
const detail = loadedCheerio(this).next().text().trim();
|
||||
|
||||
switch (detailName) {
|
||||
case 'الكاتب':
|
||||
case 'Author':
|
||||
case 'Auteur':
|
||||
novel.author = detail;
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
novel.genres = loadedCheerio('.sertogenre')
|
||||
.children('a')
|
||||
.map((i, el) => loadedCheerio(el).text())
|
||||
.toArray()
|
||||
.join(',');
|
||||
|
||||
let summary = loadedCheerio('.sersys > p').siblings().remove("div").end();
|
||||
novel.summary = ""
|
||||
for (let i = 0; i < summary.length; i++) {
|
||||
const p = summary[i];
|
||||
novel.summary += loadedCheerio(p).text().trim() + "\n\n";
|
||||
}
|
||||
|
||||
let novelChapters:Plugin.ChapterItem[] = [];
|
||||
|
||||
loadedCheerio('.eplister')
|
||||
.find('li')
|
||||
.each(function () {
|
||||
const chapterName =
|
||||
loadedCheerio(this).find('.epl-num').text() +
|
||||
' - ' +
|
||||
loadedCheerio(this).find('.epl-title').text();
|
||||
|
||||
const releaseDate = loadedCheerio(this).find('.epl-date').text().trim();
|
||||
|
||||
const chapterUrl = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
if (!chapterUrl) return;
|
||||
|
||||
const chapter = {
|
||||
name: chapterName,
|
||||
url: chapterUrl,
|
||||
releaseDate,
|
||||
};
|
||||
|
||||
novelChapters.push(chapter);
|
||||
});
|
||||
|
||||
novel.chapters = novelChapters;
|
||||
|
||||
if (novel.chapters) novel.chapters.reverse()
|
||||
|
||||
return novel;
|
||||
}
|
||||
|
||||
|
||||
async parseChapter(chapterUrl: string): Promise<string> {
|
||||
const url = chapterUrl;
|
||||
const body = await(await fetchApi(url, {})).text();
|
||||
const loadedCheerio = load(body);
|
||||
|
||||
let chapterText = loadedCheerio('.epcontent').html() || '';
|
||||
|
||||
return chapterText;
|
||||
};
|
||||
|
||||
async searchNovels(searchTerm: string): Promise<Plugin.NovelItem[]> {
|
||||
const url = this.site + "?s=" + searchTerm;
|
||||
const body = await(await fetchApi(url, {})).text();
|
||||
const loadedCheerio = load(body);
|
||||
|
||||
let novels: Plugin.NovelItem[] = [];
|
||||
|
||||
loadedCheerio('article.maindet').each(function () {
|
||||
const novelName = loadedCheerio(this).find('h2').text();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('data-src') || image.attr('src');
|
||||
const novelUrl = loadedCheerio(this).find('h2 a').attr('href');
|
||||
|
||||
if (!novelUrl) return;
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels;
|
||||
};
|
||||
async fetchImage(url: string): Promise<string | undefined>{
|
||||
return await fetchFile(url);
|
||||
}
|
||||
interface WPmangaStreamOptions {
|
||||
reverseChapters?: boolean;
|
||||
lang?: string;
|
||||
}
|
||||
|
||||
export default new LightNovelFRPlugin();
|
||||
export interface WPmangaStreamMetadata {
|
||||
id: string;
|
||||
sourceSite: string;
|
||||
sourceName: string;
|
||||
options?: WPmangaStreamOptions;
|
||||
}
|
||||
|
||||
class WPmangaStreamPlugin implements Plugin.PluginBase {
|
||||
id: string;
|
||||
name: string;
|
||||
icon: string;
|
||||
site: string;
|
||||
version: string;
|
||||
userAgent: string;
|
||||
cookieString: string;
|
||||
options?: WPmangaStreamOptions;
|
||||
|
||||
constructor(metadata: WPmangaStreamMetadata) {
|
||||
this.id = metadata.id;
|
||||
this.name = metadata.sourceName + "[wpmangastream]";
|
||||
this.icon = `multisrc/wpmangastream/icons/${metadata.id}.png`;
|
||||
this.site = metadata.sourceSite;
|
||||
this.version = "1.0.0";
|
||||
this.userAgent = "";
|
||||
this.cookieString = "";
|
||||
this.options = metadata.options;
|
||||
}
|
||||
|
||||
async popularNovels(page: number): Promise<Plugin.NovelItem[]> {
|
||||
const url = this.site + "series/?page=" + page + "&status=&order=popular";
|
||||
const body = await fetchApi(url).then((res) => res.text());
|
||||
const loadedCheerio = load(body);
|
||||
const novels: Plugin.NovelItem[] = [];
|
||||
|
||||
loadedCheerio("article.maindet").each(function () {
|
||||
const name = loadedCheerio(this).find("h2").text();
|
||||
const image = loadedCheerio(this).find("img");
|
||||
const url = loadedCheerio(this).find("h2 a").attr("href");
|
||||
|
||||
if (!url) return;
|
||||
novels.push({
|
||||
name,
|
||||
cover: image.attr("data-src") || image.attr("src"),
|
||||
url,
|
||||
});
|
||||
});
|
||||
|
||||
return novels;
|
||||
}
|
||||
|
||||
async parseNovelAndChapters(url: string): Promise<Plugin.SourceNovel> {
|
||||
const body = await fetchApi(url).then((res) => res.text());
|
||||
const loadedCheerio = load(body);
|
||||
|
||||
const novel: Plugin.SourceNovel = { url };
|
||||
|
||||
// novel.url = url;
|
||||
novel.name = loadedCheerio("h1.entry-title").text();
|
||||
novel.cover =
|
||||
loadedCheerio("img.wp-post-image").attr("data-src") ||
|
||||
loadedCheerio("img.wp-post-image").attr("src");
|
||||
novel.status = loadedCheerio("div.sertostat > span").attr("class");
|
||||
|
||||
loadedCheerio("div.serl > span").each(function () {
|
||||
const detailName = loadedCheerio(this).text().trim();
|
||||
const detail = loadedCheerio(this).next().text().trim();
|
||||
|
||||
switch (detailName) {
|
||||
case "الكاتب":
|
||||
case "Author":
|
||||
case "Auteur":
|
||||
novel.author = detail;
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
novel.genres = loadedCheerio(".sertogenre")
|
||||
.children("a")
|
||||
.map((i, el) => loadedCheerio(el).text())
|
||||
.toArray()
|
||||
.join(",");
|
||||
|
||||
let summary = loadedCheerio(".sersys > p").siblings().remove("div").end();
|
||||
novel.summary = "";
|
||||
for (let i = 0; i < summary.length; i++) {
|
||||
const p = summary[i];
|
||||
novel.summary += loadedCheerio(p).text().trim() + "\\n\\n";
|
||||
}
|
||||
|
||||
const chapters: Plugin.ChapterItem[] = loadedCheerio(".eplister li")
|
||||
.map((index, element) => ({
|
||||
name:
|
||||
loadedCheerio(element).find(".epl-num").text() +
|
||||
loadedCheerio(element).find(".epl-title").text(),
|
||||
releaseTime: loadedCheerio(element).find(".epl-date").text().trim(),
|
||||
url: loadedCheerio(element).find("a").attr("href") || "",
|
||||
}))
|
||||
.get()
|
||||
.filter((chapter) => chapter.name && chapter.url);
|
||||
|
||||
if (this.options?.reverseChapters && chapters.length) chapters.reverse();
|
||||
|
||||
novel.chapters = chapters;
|
||||
return novel;
|
||||
}
|
||||
|
||||
async parseChapter(chapterUrl: string): Promise<string> {
|
||||
const body = await fetchApi(chapterUrl).then((res) => res.text());
|
||||
const loadedCheerio = load(body);
|
||||
|
||||
const chapterText = loadedCheerio(".epcontent").html() || "";
|
||||
return chapterText;
|
||||
}
|
||||
|
||||
async searchNovels(searchTerm: string): Promise<Plugin.NovelItem[]> {
|
||||
const url = this.site + "?s=" + searchTerm;
|
||||
const body = await fetchApi(url).then((res) => res.text());
|
||||
const loadedCheerio = load(body);
|
||||
|
||||
const novels: Plugin.NovelItem[] = [];
|
||||
|
||||
loadedCheerio("article.maindet").each(function () {
|
||||
const name = loadedCheerio(this).find("h2").text();
|
||||
const image = loadedCheerio(this).find("img");
|
||||
const url = loadedCheerio(this).find("h2 a").attr("href");
|
||||
|
||||
if (!url) return;
|
||||
novels.push({
|
||||
name,
|
||||
cover: image.attr("data-src") || image.attr("src"),
|
||||
url,
|
||||
});
|
||||
});
|
||||
|
||||
return novels;
|
||||
}
|
||||
|
||||
fetchImage = fetchFile;
|
||||
}
|
||||
|
||||
const plugin = new WPmangaStreamPlugin({"id":"kol-novel","sourceSite":"https://kolnovel.com/","sourceName":"Kol Novel","options":{"lang":"arabic","reverseChapters":true}});
|
||||
export default plugin;
|
||||
@@ -15,7 +15,8 @@ interface MadaraOptionPath {
|
||||
chapter?: string;
|
||||
}
|
||||
|
||||
const MadaraDefaultPath: MadaraOptionPath = {
|
||||
const MadaraDefaultPath = {
|
||||
genres: "novel-genre",
|
||||
novels: "novel",
|
||||
novel: "novel",
|
||||
chapter: "novel",
|
||||
@@ -70,12 +71,12 @@ class MadaraPlugin implements Plugin.PluginBase {
|
||||
const novels: Plugin.NovelItem[] = [];
|
||||
|
||||
let url = this.site;
|
||||
if (filters?.genres && this.options?.path?.genres) {
|
||||
url += this.options?.path?.genres + filters.genres;
|
||||
if (filters?.genres?.value) {
|
||||
url += (this.options?.path?.genres || MadaraDefaultPath.genres) +
|
||||
"/" +
|
||||
filters.genres.value;
|
||||
} else {
|
||||
url += this.options?.path?.novels
|
||||
? this.options.path.novels
|
||||
: MadaraDefaultPath.novels;
|
||||
url += this.options?.path?.novels || MadaraDefaultPath.novels;
|
||||
}
|
||||
|
||||
url +=
|
||||
@@ -83,7 +84,7 @@ class MadaraPlugin implements Plugin.PluginBase {
|
||||
pageNo +
|
||||
"/" +
|
||||
"?m_orderby=" +
|
||||
(showLatestNovels ? "latest" : filters?.sort || "rating");
|
||||
(showLatestNovels ? "latest" : filters?.sort?.value || "rating");
|
||||
|
||||
const body = await fetchApi(url).then((res) => res.text());
|
||||
|
||||
|
||||
@@ -15,7 +15,8 @@ interface MadaraOptionPath {
|
||||
chapter?: string;
|
||||
}
|
||||
|
||||
const MadaraDefaultPath: MadaraOptionPath = {
|
||||
const MadaraDefaultPath = {
|
||||
genres: "novel-genre",
|
||||
novels: "novel",
|
||||
novel: "novel",
|
||||
chapter: "novel",
|
||||
@@ -70,12 +71,12 @@ class MadaraPlugin implements Plugin.PluginBase {
|
||||
const novels: Plugin.NovelItem[] = [];
|
||||
|
||||
let url = this.site;
|
||||
if (filters?.genres && this.options?.path?.genres) {
|
||||
url += this.options?.path?.genres + filters.genres;
|
||||
if (filters?.genres?.value) {
|
||||
url += (this.options?.path?.genres || MadaraDefaultPath.genres) +
|
||||
"/" +
|
||||
filters.genres.value;
|
||||
} else {
|
||||
url += this.options?.path?.novels
|
||||
? this.options.path.novels
|
||||
: MadaraDefaultPath.novels;
|
||||
url += this.options?.path?.novels || MadaraDefaultPath.novels;
|
||||
}
|
||||
|
||||
url +=
|
||||
@@ -83,7 +84,7 @@ class MadaraPlugin implements Plugin.PluginBase {
|
||||
pageNo +
|
||||
"/" +
|
||||
"?m_orderby=" +
|
||||
(showLatestNovels ? "latest" : filters?.sort || "rating");
|
||||
(showLatestNovels ? "latest" : filters?.sort?.value || "rating");
|
||||
|
||||
const body = await fetchApi(url).then((res) => res.text());
|
||||
|
||||
|
||||
@@ -15,7 +15,8 @@ interface MadaraOptionPath {
|
||||
chapter?: string;
|
||||
}
|
||||
|
||||
const MadaraDefaultPath: MadaraOptionPath = {
|
||||
const MadaraDefaultPath = {
|
||||
genres: "novel-genre",
|
||||
novels: "novel",
|
||||
novel: "novel",
|
||||
chapter: "novel",
|
||||
@@ -70,12 +71,12 @@ class MadaraPlugin implements Plugin.PluginBase {
|
||||
const novels: Plugin.NovelItem[] = [];
|
||||
|
||||
let url = this.site;
|
||||
if (filters?.genres && this.options?.path?.genres) {
|
||||
url += this.options?.path?.genres + filters.genres;
|
||||
if (filters?.genres?.value) {
|
||||
url += (this.options?.path?.genres || MadaraDefaultPath.genres) +
|
||||
"/" +
|
||||
filters.genres.value;
|
||||
} else {
|
||||
url += this.options?.path?.novels
|
||||
? this.options.path.novels
|
||||
: MadaraDefaultPath.novels;
|
||||
url += this.options?.path?.novels || MadaraDefaultPath.novels;
|
||||
}
|
||||
|
||||
url +=
|
||||
@@ -83,7 +84,7 @@ class MadaraPlugin implements Plugin.PluginBase {
|
||||
pageNo +
|
||||
"/" +
|
||||
"?m_orderby=" +
|
||||
(showLatestNovels ? "latest" : filters?.sort || "rating");
|
||||
(showLatestNovels ? "latest" : filters?.sort?.value || "rating");
|
||||
|
||||
const body = await fetchApi(url).then((res) => res.text());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user