async popularNovels(page: number): Promise<any> {
const url = `${this.site}series/?page=${page}&m_orderby=views`;
const html = await fetchHtml({ url });
const $ = cheerio.load(html);
const novels: any[] = [];
$(".page-item-detail").each((i, el) => {
const novelName = $(el).find(".post-title a").text().trim();
const novelCover = $(el).find(".img-responsive").attr("src");
const novelUrl = $(el).find(".post-title a").attr("href");
if (novelUrl) {
novels.push({ name: novelName, cover: novelCover, url: novelUrl });
}
});
return novels;
}
async parseNovel(novelUrl: string): Promise<any> {
const html = await fetchHtml({ url: novelUrl });
const $ = cheerio.load(html);
const novel: any = {
name: $(".post-title h1").text().trim(),
cover: $(".summary_image img").attr("src"),
summary: $(".description-summary .summary__content").text().trim(),
author: $(".author-content a").text().trim(),
artist: $(".artist-content a").text().trim(),
status: $(".post-status .summary-content").text().trim(),
genres: "",
};
const genres: string[] = [];
$(".genres-content a").each((i, el) => {
genres.push($(el).text().trim());
});
novel.genres = genres.join(", ");
return novel;
}
async parseChapters(novelUrl: string): Promise<any> {
const html = await fetchHtml({ url: novelUrl });
const $ = cheerio.load(html);
const chapters: any[] = [];
$(".wp-manga-chapter").each((i, el) => {
const chapterName = $(el).find("a").text().trim();
const chapterUrl = $(el).find("a").attr("href");
const releaseTime = $(el).find(".chapter-release-date").text().trim();
if (chapterUrl) {
chapters.push({ name: chapterName, url: chapterUrl, releaseTime });
}
});
return chapters.reverse(); // لترتيب الفصول من الأول إلى الأخير
}
async fetchChapter(novelUrl: string, chapterUrl: string): Promise<any> {
const html = await fetchHtml({ url: chapterUrl });
const $ = cheerio.load(html);
// تنظيف النص من الإعلانات المزعجة داخل محتوى الفصل
$(".text-left script, .text-left ins, .text-left .ads").remove();
const chapterText = $(".text-left").html() || $(".reading-content").html() || "";
return chapterText;
}
async searchNovels(searchTerm: string, page: number): Promise<any> {
const url = `${this.site}?s=${encodeURIComponent(searchTerm)}&post_type=wp-manga`;
const html = await fetchHtml({ url });
const $ = cheerio.load(html);
const novels: any[] = [];
$(".c-tabs-item__content").each((i, el) => {
const novelName = $(el).find(".post-title a").text().trim();
const novelCover = $(el).find("img").attr("src");
const novelUrl = $(el).find(".post-title a").attr("href");
if (novelUrl) {
novels.push({ name: novelName, cover: novelCover, url: novelUrl });
}
});
return novels;
}
Plugin Name
KolNovel (Arabic)
Website URL
https://free.kolnovel.com/
Language
Arabic
Other Details
import { SourcePlugin } from "@libs/plugin";
import { fetchHtml } from "@libs/fetch";
import * as cheerio from "cheerio";
export default class KolNovel implements SourcePlugin {
id = "kolnovel";
name = "KolNovel";
icon = "src/ar/kolnovel/icon.png";
site = "https://free.kolnovel.com/";
version = "1.0.0";
}
Acknowledgements