Prettier (#852)
* add prettier * lint-staged * prettier * upgrade husky
This commit is contained in:
+116
-111
@@ -1,145 +1,150 @@
|
||||
import { load as parseHTML } from "cheerio";
|
||||
import { fetchFile } from "@libs/fetch";
|
||||
import { Plugin } from "@typings/plugin";
|
||||
import { Filters } from "@libs/filterInputs";
|
||||
import { load as parseHTML } from 'cheerio';
|
||||
import { fetchFile } from '@libs/fetch';
|
||||
import { Plugin } from '@typings/plugin';
|
||||
import { Filters } from '@libs/filterInputs';
|
||||
|
||||
class HasulTL implements Plugin.PluginBase {
|
||||
id = "HasuTL";
|
||||
name = "Hasu Translations";
|
||||
icon = "src/es/hasutl/icon.png";
|
||||
site = "https://hasutl.wordpress.com/";
|
||||
filters?: Filters | undefined;
|
||||
version = "1.0.0";
|
||||
baseUrl = this.site
|
||||
async popularNovels(pageNo: number, options: Plugin.PopularNovelsOptions<Filters>): Promise<Plugin.NovelItem[]> {
|
||||
let url = this.baseUrl + "light-novels-activas/";
|
||||
id = 'HasuTL';
|
||||
name = 'Hasu Translations';
|
||||
icon = 'src/es/hasutl/icon.png';
|
||||
site = 'https://hasutl.wordpress.com/';
|
||||
filters?: Filters | undefined;
|
||||
version = '1.0.0';
|
||||
baseUrl = this.site;
|
||||
async popularNovels(
|
||||
pageNo: number,
|
||||
options: Plugin.PopularNovelsOptions<Filters>,
|
||||
): Promise<Plugin.NovelItem[]> {
|
||||
let url = this.baseUrl + 'light-novels-activas/';
|
||||
|
||||
const result = await fetch(url);
|
||||
const body = await result.text();
|
||||
const result = await fetch(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = parseHTML(body);
|
||||
let loadedCheerio = parseHTML(body);
|
||||
|
||||
let novels: Plugin.NovelItem[] = [];
|
||||
let novels: Plugin.NovelItem[] = [];
|
||||
|
||||
loadedCheerio("div.wp-block-columns").each(function () {
|
||||
const novelName = loadedCheerio(this).find(".wp-block-button").text();
|
||||
const novelCover = loadedCheerio(this).find("img").attr("src");
|
||||
loadedCheerio('div.wp-block-columns').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.wp-block-button').text();
|
||||
const novelCover = loadedCheerio(this).find('img').attr('src');
|
||||
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find(".wp-block-button > a")
|
||||
.attr("href");
|
||||
let novelUrl = loadedCheerio(this)
|
||||
.find('.wp-block-button > a')
|
||||
.attr('href');
|
||||
|
||||
if (!novelUrl) return;
|
||||
if (!novelUrl) return;
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels;
|
||||
}
|
||||
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
|
||||
const url = novelUrl;
|
||||
return novels;
|
||||
}
|
||||
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
|
||||
const url = novelUrl;
|
||||
|
||||
const result = await fetch(url);
|
||||
const body = await result.text();
|
||||
const result = await fetch(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = parseHTML(body);
|
||||
let loadedCheerio = parseHTML(body);
|
||||
|
||||
let novel: Plugin.SourceNovel = {
|
||||
url,
|
||||
let novel: Plugin.SourceNovel = {
|
||||
url,
|
||||
};
|
||||
|
||||
novel.url = novelUrl;
|
||||
|
||||
novel.name = loadedCheerio('.post-header').text();
|
||||
|
||||
novel.cover = loadedCheerio('.featured-media > img').attr('src');
|
||||
|
||||
let novelSummary = loadedCheerio('.post-content').find('p').html()!;
|
||||
novel.summary = novelSummary;
|
||||
|
||||
let novelChapters: Plugin.ChapterItem[] = [];
|
||||
|
||||
loadedCheerio('.wp-block-media-text__content')
|
||||
.find('a')
|
||||
.each(function () {
|
||||
const chapterName = loadedCheerio(this).text().trim();
|
||||
|
||||
const releaseDate = null;
|
||||
|
||||
let chapterUrl = loadedCheerio(this).attr('href');
|
||||
|
||||
if (!chapterUrl) return;
|
||||
|
||||
const chapter = {
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
};
|
||||
|
||||
novel.url = novelUrl;
|
||||
novelChapters.push(chapter);
|
||||
});
|
||||
|
||||
novel.name = loadedCheerio(".post-header").text();
|
||||
novel.chapters = novelChapters;
|
||||
|
||||
novel.cover = loadedCheerio(".featured-media > img").attr("src");
|
||||
return novel;
|
||||
}
|
||||
async parseChapter(chapterUrl: string): Promise<string> {
|
||||
const url = chapterUrl;
|
||||
|
||||
let novelSummary = loadedCheerio(".post-content").find("p").html()!;
|
||||
novel.summary = novelSummary;
|
||||
const result = await fetch(url);
|
||||
const body = await result.text();
|
||||
|
||||
let novelChapters: Plugin.ChapterItem[] = [];
|
||||
let loadedCheerio = parseHTML(body);
|
||||
|
||||
loadedCheerio(".wp-block-media-text__content")
|
||||
.find("a")
|
||||
.each(function () {
|
||||
const chapterName = loadedCheerio(this).text().trim();
|
||||
let chapterText = loadedCheerio('.post-content').html() || '';
|
||||
|
||||
const releaseDate = null;
|
||||
return chapterText;
|
||||
}
|
||||
async searchNovels(
|
||||
searchTerm: string,
|
||||
pageNo: number,
|
||||
): Promise<Plugin.NovelItem[]> {
|
||||
const url = `${this.baseUrl}?s=${searchTerm}&post_type=wp-manga`;
|
||||
|
||||
let chapterUrl = loadedCheerio(this).attr("href");
|
||||
const result = await fetch(url);
|
||||
const body = await result.text();
|
||||
|
||||
if (!chapterUrl) return;
|
||||
let loadedCheerio = parseHTML(body);
|
||||
|
||||
const chapter = {
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
};
|
||||
let novels: Plugin.NovelItem[] = [];
|
||||
|
||||
novelChapters.push(chapter);
|
||||
});
|
||||
loadedCheerio('.post-container').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-header').text();
|
||||
if (
|
||||
!novelName.includes('Cap') &&
|
||||
!novelName.includes('Vol') &&
|
||||
!novelName.includes('Light Novels')
|
||||
) {
|
||||
const novelCover = loadedCheerio(this).find('img').attr('src');
|
||||
|
||||
novel.chapters = novelChapters;
|
||||
let novelUrl = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
return novel;
|
||||
}
|
||||
async parseChapter(chapterUrl: string): Promise<string> {
|
||||
const url = chapterUrl;
|
||||
if (!novelUrl) return;
|
||||
|
||||
const result = await fetch(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = parseHTML(body);
|
||||
|
||||
let chapterText = loadedCheerio(".post-content").html() || '';
|
||||
|
||||
return chapterText;
|
||||
}
|
||||
async searchNovels(searchTerm: string, pageNo: number): Promise<Plugin.NovelItem[]> {
|
||||
const url = `${this.baseUrl}?s=${searchTerm}&post_type=wp-manga`;
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
const result = await fetch(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = parseHTML(body);
|
||||
|
||||
let novels: Plugin.NovelItem[] = [];
|
||||
|
||||
loadedCheerio(".post-container").each(function () {
|
||||
const novelName = loadedCheerio(this).find(".post-header").text();
|
||||
if (
|
||||
!novelName.includes("Cap") &&
|
||||
!novelName.includes("Vol") &&
|
||||
!novelName.includes("Light Novels")
|
||||
) {
|
||||
const novelCover = loadedCheerio(this).find("img").attr("src");
|
||||
|
||||
let novelUrl = loadedCheerio(this).find("a").attr("href");
|
||||
|
||||
if (!novelUrl) return;
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
}
|
||||
});
|
||||
|
||||
return novels;
|
||||
}
|
||||
async fetchImage(url: string): Promise<string | undefined> {
|
||||
return fetchFile(url);
|
||||
}
|
||||
novels.push(novel);
|
||||
}
|
||||
});
|
||||
|
||||
return novels;
|
||||
}
|
||||
async fetchImage(url: string): Promise<string | undefined> {
|
||||
return fetchFile(url);
|
||||
}
|
||||
}
|
||||
|
||||
export default new HasulTL();
|
||||
|
||||
@@ -1,180 +1,183 @@
|
||||
import { load as parseHTML } from "cheerio";
|
||||
import { fetchFile } from "@libs/fetch";
|
||||
import { Plugin } from "@typings/plugin";
|
||||
import { Filters } from "@libs/filterInputs";
|
||||
import { load as parseHTML } from 'cheerio';
|
||||
import { fetchFile } from '@libs/fetch';
|
||||
import { Plugin } from '@typings/plugin';
|
||||
import { Filters } from '@libs/filterInputs';
|
||||
|
||||
class Ligera implements Plugin.PluginBase {
|
||||
id = "ligera.com";
|
||||
name = "Novelas Ligera";
|
||||
icon = "src/es/novelasligera/icon.png";
|
||||
site = "https://novelasligera.com/";
|
||||
filters?: Filters | undefined;
|
||||
version = "1.0.0";
|
||||
baseUrl = this.site;
|
||||
async popularNovels(pageNo: number, options: Plugin.PopularNovelsOptions<Filters>): Promise<Plugin.NovelItem[]> {
|
||||
let url = this.baseUrl;
|
||||
id = 'ligera.com';
|
||||
name = 'Novelas Ligera';
|
||||
icon = 'src/es/novelasligera/icon.png';
|
||||
site = 'https://novelasligera.com/';
|
||||
filters?: Filters | undefined;
|
||||
version = '1.0.0';
|
||||
baseUrl = this.site;
|
||||
async popularNovels(
|
||||
pageNo: number,
|
||||
options: Plugin.PopularNovelsOptions<Filters>,
|
||||
): Promise<Plugin.NovelItem[]> {
|
||||
let url = this.baseUrl;
|
||||
|
||||
const result = await fetch(url);
|
||||
const body = await result.text();
|
||||
const result = await fetch(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = parseHTML(body);
|
||||
let loadedCheerio = parseHTML(body);
|
||||
|
||||
let novels: Plugin.NovelItem[] = [];
|
||||
let novels: Plugin.NovelItem[] = [];
|
||||
|
||||
loadedCheerio(".elementor-column").each(function () {
|
||||
const novelName = loadedCheerio(this)
|
||||
.find(".widget-image-caption.wp-caption-text")
|
||||
.text();
|
||||
if (novelName) {
|
||||
const novelCover = loadedCheerio(this)
|
||||
.find("a > img")
|
||||
.attr("data-lazy-src");
|
||||
loadedCheerio('.elementor-column').each(function () {
|
||||
const novelName = loadedCheerio(this)
|
||||
.find('.widget-image-caption.wp-caption-text')
|
||||
.text();
|
||||
if (novelName) {
|
||||
const novelCover = loadedCheerio(this)
|
||||
.find('a > img')
|
||||
.attr('data-lazy-src');
|
||||
|
||||
let novelUrl = loadedCheerio(this).find("a").attr("href");
|
||||
if (!novelUrl) return;
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
let novelUrl = loadedCheerio(this).find('a').attr('href');
|
||||
if (!novelUrl) return;
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
}
|
||||
novels.push(novel);
|
||||
}
|
||||
});
|
||||
|
||||
return novels;
|
||||
}
|
||||
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
|
||||
const url = this.baseUrl + 'novela/' + novelUrl;
|
||||
|
||||
// console.log(url);
|
||||
|
||||
const result = await fetch(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = parseHTML(body);
|
||||
|
||||
let novel: Plugin.SourceNovel = { url };
|
||||
|
||||
novel.name = loadedCheerio('h1').text();
|
||||
|
||||
novel.cover = loadedCheerio('.elementor-widget-container')
|
||||
.find('img')
|
||||
.attr('src');
|
||||
|
||||
loadedCheerio('.elementor-row')
|
||||
.find('p')
|
||||
.each(function () {
|
||||
if (loadedCheerio(this).text().includes('Autor:')) {
|
||||
novel.author = loadedCheerio(this)
|
||||
.text()
|
||||
.replace('Autor:', '')
|
||||
.trim();
|
||||
}
|
||||
if (loadedCheerio(this).text().includes('Estado:')) {
|
||||
novel.status = loadedCheerio(this)
|
||||
.text()
|
||||
.replace('Estado: ', '')
|
||||
.trim();
|
||||
}
|
||||
|
||||
if (loadedCheerio(this).text().includes('Género:')) {
|
||||
loadedCheerio(this).find('span').remove();
|
||||
novel.genres = loadedCheerio(this).text().replace(/,\s/g, ',');
|
||||
}
|
||||
});
|
||||
|
||||
novel.summary = loadedCheerio(
|
||||
'.elementor-text-editor.elementor-clearfix',
|
||||
).text();
|
||||
|
||||
let novelChapters: Plugin.ChapterItem[] = [];
|
||||
|
||||
loadedCheerio('.elementor-accordion-item').remove();
|
||||
|
||||
loadedCheerio('.elementor-tab-content')
|
||||
.find('li')
|
||||
.each(function () {
|
||||
const chapterName = loadedCheerio(this).text();
|
||||
const releaseDate = null;
|
||||
const chapterUrl = loadedCheerio(this).find('a').attr('href');
|
||||
if (!chapterUrl) return;
|
||||
const chapter = {
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
};
|
||||
|
||||
novelChapters.push(chapter);
|
||||
});
|
||||
|
||||
novel.chapters = novelChapters;
|
||||
|
||||
return novel;
|
||||
}
|
||||
async parseChapter(chapterUrl: string): Promise<string> {
|
||||
const url = chapterUrl;
|
||||
// console.log(url);
|
||||
|
||||
const result = await fetch(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = parseHTML(body);
|
||||
loadedCheerio('.osny-nightmode.osny-nightmode--left').remove();
|
||||
loadedCheerio('.code-block.code-block-1').remove();
|
||||
loadedCheerio('.adsb30').remove();
|
||||
loadedCheerio('.saboxplugin-wrap').remove();
|
||||
loadedCheerio('.wp-post-navigation').remove();
|
||||
|
||||
let chapterText = loadedCheerio('.entry-content').html() || '';
|
||||
return chapterText;
|
||||
}
|
||||
async searchNovels(
|
||||
searchTerm: string,
|
||||
pageNo: number,
|
||||
): Promise<Plugin.NovelItem[]> {
|
||||
const url = this.baseUrl + '?s=' + searchTerm + '&post_type=wp-manga';
|
||||
// console.log(url);
|
||||
|
||||
const result = await fetch(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = parseHTML(body);
|
||||
|
||||
let novels: Plugin.NovelItem[] = [];
|
||||
|
||||
loadedCheerio('.inside-article').each(function () {
|
||||
const novelCover = loadedCheerio(this).find('img').attr('src');
|
||||
let novelUrl = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
let novelName;
|
||||
|
||||
if (novelUrl) {
|
||||
novelName = novelUrl.replace(/-/g, ' ').replace(/^./, function (x) {
|
||||
return x.toUpperCase();
|
||||
});
|
||||
}
|
||||
|
||||
return novels;
|
||||
}
|
||||
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
|
||||
const url = this.baseUrl + "novela/" + novelUrl;
|
||||
novelUrl += '/';
|
||||
|
||||
// console.log(url);
|
||||
if (!novelName || !novelUrl) return;
|
||||
|
||||
const result = await fetch(url);
|
||||
const body = await result.text();
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
let loadedCheerio = parseHTML(body);
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
let novel: Plugin.SourceNovel = { url };
|
||||
novels = [{ ...novels[1] }];
|
||||
|
||||
novel.name = loadedCheerio("h1").text();
|
||||
|
||||
novel.cover = loadedCheerio(".elementor-widget-container")
|
||||
.find("img")
|
||||
.attr("src");
|
||||
|
||||
loadedCheerio(".elementor-row")
|
||||
.find("p")
|
||||
.each(function () {
|
||||
if (loadedCheerio(this).text().includes("Autor:")) {
|
||||
novel.author = loadedCheerio(this)
|
||||
.text()
|
||||
.replace("Autor:", "")
|
||||
.trim();
|
||||
}
|
||||
if (loadedCheerio(this).text().includes("Estado:")) {
|
||||
novel.status = loadedCheerio(this)
|
||||
.text()
|
||||
.replace("Estado: ", "")
|
||||
.trim();
|
||||
}
|
||||
|
||||
if (loadedCheerio(this).text().includes("Género:")) {
|
||||
loadedCheerio(this).find("span").remove();
|
||||
novel.genres = loadedCheerio(this)
|
||||
.text()
|
||||
.replace(/,\s/g, ",");
|
||||
}
|
||||
});
|
||||
|
||||
novel.summary = loadedCheerio(
|
||||
".elementor-text-editor.elementor-clearfix"
|
||||
).text();
|
||||
|
||||
let novelChapters: Plugin.ChapterItem[] = [];
|
||||
|
||||
loadedCheerio(".elementor-accordion-item").remove();
|
||||
|
||||
loadedCheerio(".elementor-tab-content")
|
||||
.find("li")
|
||||
.each(function () {
|
||||
const chapterName = loadedCheerio(this).text();
|
||||
const releaseDate = null;
|
||||
const chapterUrl = loadedCheerio(this).find("a").attr("href");
|
||||
if (!chapterUrl) return;
|
||||
const chapter = {
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
};
|
||||
|
||||
novelChapters.push(chapter);
|
||||
});
|
||||
|
||||
novel.chapters = novelChapters;
|
||||
|
||||
return novel;
|
||||
}
|
||||
async parseChapter(chapterUrl: string): Promise<string> {
|
||||
const url = chapterUrl;
|
||||
// console.log(url);
|
||||
|
||||
const result = await fetch(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = parseHTML(body);
|
||||
loadedCheerio(".osny-nightmode.osny-nightmode--left").remove();
|
||||
loadedCheerio(".code-block.code-block-1").remove();
|
||||
loadedCheerio(".adsb30").remove();
|
||||
loadedCheerio(".saboxplugin-wrap").remove();
|
||||
loadedCheerio(".wp-post-navigation").remove();
|
||||
|
||||
let chapterText = loadedCheerio(".entry-content").html() || '';
|
||||
return chapterText;
|
||||
}
|
||||
async searchNovels(searchTerm: string, pageNo: number): Promise<Plugin.NovelItem[]> {
|
||||
const url = this.baseUrl + "?s=" + searchTerm + "&post_type=wp-manga";
|
||||
// console.log(url);
|
||||
|
||||
const result = await fetch(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = parseHTML(body);
|
||||
|
||||
let novels: Plugin.NovelItem[] = [];
|
||||
|
||||
loadedCheerio(".inside-article").each(function () {
|
||||
const novelCover = loadedCheerio(this).find("img").attr("src");
|
||||
let novelUrl = loadedCheerio(this).find("a").attr("href");
|
||||
|
||||
let novelName;
|
||||
|
||||
if (novelUrl) {
|
||||
novelName = novelUrl.replace(/-/g, " ").replace(/^./, function (x) {
|
||||
return x.toUpperCase();
|
||||
});
|
||||
}
|
||||
|
||||
novelUrl += "/";
|
||||
|
||||
if (!novelName || !novelUrl) return;
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
novels = [{ ...novels[1] }];
|
||||
|
||||
return novels;
|
||||
}
|
||||
async fetchImage(url: string): Promise<string | undefined> {
|
||||
return fetchFile(url);
|
||||
}
|
||||
|
||||
return novels;
|
||||
}
|
||||
async fetchImage(url: string): Promise<string | undefined> {
|
||||
return fetchFile(url);
|
||||
}
|
||||
}
|
||||
|
||||
export default new Ligera();
|
||||
export default new Ligera();
|
||||
|
||||
@@ -1,203 +1,200 @@
|
||||
import { fetchApi, fetchFile } from "@libs/fetch";
|
||||
import { Plugin } from "@typings/plugin";
|
||||
import { load as parseHTML } from "cheerio";
|
||||
import { defaultCover } from "@libs/defaultCover";
|
||||
import { Filters } from "@libs/filterInputs";
|
||||
import { fetchApi, fetchFile } from '@libs/fetch';
|
||||
import { Plugin } from '@typings/plugin';
|
||||
import { load as parseHTML } from 'cheerio';
|
||||
import { defaultCover } from '@libs/defaultCover';
|
||||
import { Filters } from '@libs/filterInputs';
|
||||
|
||||
class ReinoWuxia implements Plugin.PluginBase {
|
||||
id = "awuxia.com";
|
||||
name = "ReinoWuxia";
|
||||
icon = "src/es/novelawuxia/icon.png";
|
||||
filters?: Filters | undefined;
|
||||
version = "1.0.0";
|
||||
site = "http://www.reinowuxia.com/"
|
||||
baseUrl = this.site;
|
||||
getNovelName(y: string | undefined) {
|
||||
return y?.replace(/-/g, " ").replace(/(?:^|\s)\S/g, (a) => a.toUpperCase());
|
||||
}
|
||||
async popularNovels(pageNo: number, options: Plugin.PopularNovelsOptions<Filters>): Promise<Plugin.NovelItem[]> {
|
||||
let url = this.baseUrl + "p/todas-las-novelas.html";
|
||||
id = 'awuxia.com';
|
||||
name = 'ReinoWuxia';
|
||||
icon = 'src/es/novelawuxia/icon.png';
|
||||
filters?: Filters | undefined;
|
||||
version = '1.0.0';
|
||||
site = 'http://www.reinowuxia.com/';
|
||||
baseUrl = this.site;
|
||||
getNovelName(y: string | undefined) {
|
||||
return y?.replace(/-/g, ' ').replace(/(?:^|\s)\S/g, a => a.toUpperCase());
|
||||
}
|
||||
async popularNovels(
|
||||
pageNo: number,
|
||||
options: Plugin.PopularNovelsOptions<Filters>,
|
||||
): Promise<Plugin.NovelItem[]> {
|
||||
let url = this.baseUrl + 'p/todas-las-novelas.html';
|
||||
|
||||
const result = await fetchApi(url, {
|
||||
method: "GET",
|
||||
});
|
||||
const body = await result.text();
|
||||
const result = await fetchApi(url, {
|
||||
method: 'GET',
|
||||
});
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = parseHTML(body);
|
||||
let loadedCheerio = parseHTML(body);
|
||||
|
||||
let novels: Plugin.NovelItem[] = [];
|
||||
let novels: Plugin.NovelItem[] = [];
|
||||
|
||||
loadedCheerio(".post-body.entry-content")
|
||||
.find("a")
|
||||
.each( (idx, ele) => {
|
||||
let novelName = loadedCheerio(ele)
|
||||
.attr("href")
|
||||
?.split("/")
|
||||
.pop()
|
||||
?.replace(".html", "");
|
||||
novelName = this.getNovelName(novelName);
|
||||
const novelCover = loadedCheerio(ele).find("img").attr("src");
|
||||
loadedCheerio('.post-body.entry-content')
|
||||
.find('a')
|
||||
.each((idx, ele) => {
|
||||
let novelName = loadedCheerio(ele)
|
||||
.attr('href')
|
||||
?.split('/')
|
||||
.pop()
|
||||
?.replace('.html', '');
|
||||
novelName = this.getNovelName(novelName);
|
||||
const novelCover = loadedCheerio(ele).find('img').attr('src');
|
||||
|
||||
let novelUrl = loadedCheerio(ele).attr("href");
|
||||
let novelUrl = loadedCheerio(ele).attr('href');
|
||||
|
||||
if (!novelName || !novelUrl) return;
|
||||
if (!novelName || !novelUrl) return;
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels;
|
||||
}
|
||||
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
|
||||
const url = novelUrl;
|
||||
return novels;
|
||||
}
|
||||
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
|
||||
const url = novelUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = parseHTML(body);
|
||||
let loadedCheerio = parseHTML(body);
|
||||
|
||||
let novel: Plugin.SourceNovel = { url };
|
||||
let novel: Plugin.SourceNovel = { url };
|
||||
|
||||
novel.name = loadedCheerio("h1.post-title").text().trim();
|
||||
novel.name = loadedCheerio('h1.post-title').text().trim();
|
||||
|
||||
novel.cover = loadedCheerio("div.separator").find("a").attr("href");
|
||||
novel.cover = loadedCheerio('div.separator').find('a').attr('href');
|
||||
|
||||
novel.status = "";
|
||||
novel.status = '';
|
||||
|
||||
loadedCheerio("div > b").each(function () {
|
||||
const detailName = loadedCheerio(this).text();
|
||||
let detail = loadedCheerio(this)[0].nextSibling;
|
||||
loadedCheerio('div > b').each(function () {
|
||||
const detailName = loadedCheerio(this).text();
|
||||
let detail = loadedCheerio(this)[0].nextSibling;
|
||||
|
||||
if (detailName && detail) {
|
||||
const text = loadedCheerio(detail).text();
|
||||
if (detailName && detail) {
|
||||
const text = loadedCheerio(detail).text();
|
||||
|
||||
if (detailName.includes("Autor")) {
|
||||
novel.author = text.replace("Autor:", "");
|
||||
}
|
||||
if (detailName.includes('Autor')) {
|
||||
novel.author = text.replace('Autor:', '');
|
||||
}
|
||||
|
||||
if (detailName.includes("Estatus")) {
|
||||
novel.status = text.replace("Estatus: ", "");
|
||||
}
|
||||
if (detailName.includes("Géneros:")) {
|
||||
novel.genres = text
|
||||
.replace("Géneros: ", "")
|
||||
.replace(/,\s/g, ",");
|
||||
}
|
||||
if (detailName.includes('Estatus')) {
|
||||
novel.status = text.replace('Estatus: ', '');
|
||||
}
|
||||
if (detailName.includes('Géneros:')) {
|
||||
novel.genres = text.replace('Géneros: ', '').replace(/,\s/g, ',');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let novelChapters: Plugin.ChapterItem[] = [];
|
||||
|
||||
loadedCheerio('div').each(function () {
|
||||
const detailName = loadedCheerio(this).text();
|
||||
if (detailName.includes('Sinopsis')) {
|
||||
novel.summary =
|
||||
loadedCheerio(this).next().text() !== ''
|
||||
? loadedCheerio(this).next().text().replace('Sinopsis', '').trim()
|
||||
: loadedCheerio(this)
|
||||
.next()
|
||||
.next()
|
||||
.text()
|
||||
.replace('Sinopsis', '')
|
||||
.trim();
|
||||
}
|
||||
|
||||
if (detailName.includes('Lista de Capítulos')) {
|
||||
loadedCheerio(this)
|
||||
.find('a')
|
||||
.each(function (res) {
|
||||
const chapterName = loadedCheerio(this).text();
|
||||
let chapterUrl = loadedCheerio(this).attr('href');
|
||||
const releaseDate = null;
|
||||
|
||||
if (
|
||||
chapterName &&
|
||||
chapterUrl &&
|
||||
!novelChapters.some(chap => chap.name === chapterName)
|
||||
) {
|
||||
const chapter = {
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
};
|
||||
|
||||
novelChapters.push(chapter);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
let novelChapters: Plugin.ChapterItem[] = [];
|
||||
novel.chapters = novelChapters;
|
||||
|
||||
loadedCheerio("div").each(function () {
|
||||
const detailName = loadedCheerio(this).text();
|
||||
if (detailName.includes("Sinopsis")) {
|
||||
novel.summary =
|
||||
loadedCheerio(this).next().text() !== ""
|
||||
? loadedCheerio(this)
|
||||
.next()
|
||||
.text()
|
||||
.replace("Sinopsis", "")
|
||||
.trim()
|
||||
: loadedCheerio(this)
|
||||
.next()
|
||||
.next()
|
||||
.text()
|
||||
.replace("Sinopsis", "")
|
||||
.trim();
|
||||
}
|
||||
return novel;
|
||||
}
|
||||
async parseChapter(chapterUrl: string): Promise<string> {
|
||||
const url = chapterUrl;
|
||||
|
||||
if (detailName.includes("Lista de Capítulos")) {
|
||||
loadedCheerio(this)
|
||||
.find("a")
|
||||
.each(function (res) {
|
||||
const chapterName = loadedCheerio(this).text();
|
||||
let chapterUrl = loadedCheerio(this).attr("href");
|
||||
const releaseDate = null;
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
if (
|
||||
chapterName &&
|
||||
chapterUrl &&
|
||||
!novelChapters.some(
|
||||
(chap) => chap.name === chapterName
|
||||
)
|
||||
) {
|
||||
const chapter = {
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
};
|
||||
let loadedCheerio = parseHTML(body);
|
||||
|
||||
novelChapters.push(chapter);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
let chapterText = loadedCheerio('.post-body.entry-content').html() || '';
|
||||
|
||||
novel.chapters = novelChapters;
|
||||
return chapterText;
|
||||
}
|
||||
async searchNovels(
|
||||
searchTerm: string,
|
||||
pageNo: number,
|
||||
): Promise<Plugin.NovelItem[]> {
|
||||
const url = `${this.baseUrl}search?q=${searchTerm}`;
|
||||
|
||||
return novel;
|
||||
}
|
||||
async parseChapter(chapterUrl: string): Promise<string> {
|
||||
const url = chapterUrl;
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
let loadedCheerio = parseHTML(body);
|
||||
|
||||
let loadedCheerio = parseHTML(body);
|
||||
let novels: Plugin.NovelItem[] = [];
|
||||
|
||||
let chapterText = loadedCheerio(".post-body.entry-content").html() || '';
|
||||
loadedCheerio('.date-outer').each((idx, ele) => {
|
||||
let novelName = loadedCheerio(ele)
|
||||
.find('a')
|
||||
.attr('href')
|
||||
?.split('/')
|
||||
.pop()
|
||||
?.replace(/-capitulo(.*?).html/, '');
|
||||
|
||||
return chapterText;
|
||||
}
|
||||
async searchNovels(searchTerm: string, pageNo: number): Promise<Plugin.NovelItem[]> {
|
||||
const url = `${this.baseUrl}search?q=${searchTerm}`;
|
||||
const novelUrl = novelName + '.html/';
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
novelName = this.getNovelName(novelName);
|
||||
|
||||
let loadedCheerio = parseHTML(body);
|
||||
const exists = novels.some(novel => novel.name === novelName);
|
||||
|
||||
let novels: Plugin.NovelItem[] = [];
|
||||
if (!exists) {
|
||||
const novelCover = defaultCover;
|
||||
|
||||
loadedCheerio(".date-outer").each((idx, ele) => {
|
||||
let novelName = loadedCheerio(ele)
|
||||
.find("a")
|
||||
.attr("href")
|
||||
?.split("/")
|
||||
.pop()
|
||||
?.replace(/-capitulo(.*?).html/, "");
|
||||
if (!novelUrl || !novelName) return;
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
const novelUrl = novelName + ".html/";
|
||||
|
||||
novelName = this.getNovelName(novelName);
|
||||
|
||||
const exists = novels.some((novel) => novel.name === novelName);
|
||||
|
||||
if (!exists) {
|
||||
const novelCover = defaultCover;
|
||||
|
||||
if (!novelUrl || !novelName) return;
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
}
|
||||
});
|
||||
|
||||
return novels;
|
||||
}
|
||||
async fetchImage(url: string): Promise<string | undefined> {
|
||||
return fetchFile(url);
|
||||
}
|
||||
novels.push(novel);
|
||||
}
|
||||
});
|
||||
|
||||
return novels;
|
||||
}
|
||||
async fetchImage(url: string): Promise<string | undefined> {
|
||||
return fetchFile(url);
|
||||
}
|
||||
}
|
||||
|
||||
export default new ReinoWuxia();
|
||||
export default new ReinoWuxia();
|
||||
|
||||
@@ -1,171 +1,178 @@
|
||||
import { fetchFile, fetchApi } from "@libs/fetch";
|
||||
import { Filters } from "@libs/filterInputs";
|
||||
import { Plugin } from "@typings/plugin";
|
||||
import { load as parseHTML } from "cheerio";
|
||||
import { fetchFile, fetchApi } from '@libs/fetch';
|
||||
import { Filters } from '@libs/filterInputs';
|
||||
import { Plugin } from '@typings/plugin';
|
||||
import { load as parseHTML } from 'cheerio';
|
||||
|
||||
export const id = "oasisTL.wp";
|
||||
export const name = "Oasis Translations";
|
||||
export const site = "https://oasistranslations.wordpress.com/";
|
||||
export const version = "1.0.0";
|
||||
export const icon = "src/es/oasistranslations/icon.png";
|
||||
export const id = 'oasisTL.wp';
|
||||
export const name = 'Oasis Translations';
|
||||
export const site = 'https://oasistranslations.wordpress.com/';
|
||||
export const version = '1.0.0';
|
||||
export const icon = 'src/es/oasistranslations/icon.png';
|
||||
|
||||
const baseUrl = site;
|
||||
|
||||
class Oasis implements Plugin.PluginBase {
|
||||
id = "oasisTL.wp";
|
||||
name = "Oasis Translations";
|
||||
site = "https://oasistranslations.wordpress.com/";
|
||||
version = "1.0.0";
|
||||
filters?: Filters | undefined;
|
||||
icon = "src/es/oasistranslations/icon.png";
|
||||
async popularNovels(pageNo: number, options: Plugin.PopularNovelsOptions<Filters>): Promise<Plugin.NovelItem[]> {
|
||||
let url = baseUrl;
|
||||
id = 'oasisTL.wp';
|
||||
name = 'Oasis Translations';
|
||||
site = 'https://oasistranslations.wordpress.com/';
|
||||
version = '1.0.0';
|
||||
filters?: Filters | undefined;
|
||||
icon = 'src/es/oasistranslations/icon.png';
|
||||
async popularNovels(
|
||||
pageNo: number,
|
||||
options: Plugin.PopularNovelsOptions<Filters>,
|
||||
): Promise<Plugin.NovelItem[]> {
|
||||
let url = baseUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = parseHTML(body);
|
||||
let loadedCheerio = parseHTML(body);
|
||||
|
||||
let novels: Plugin.NovelItem[] = [];
|
||||
let novels: Plugin.NovelItem[] = [];
|
||||
|
||||
loadedCheerio(".menu-item-1819")
|
||||
.find(".sub-menu > li")
|
||||
.each(function () {
|
||||
const novelName = loadedCheerio(this).text();
|
||||
if (!novelName.match(/Activas|Finalizadas|Dropeadas/)) {
|
||||
const novelCover = loadedCheerio(this).find("img").attr("src");
|
||||
loadedCheerio('.menu-item-1819')
|
||||
.find('.sub-menu > li')
|
||||
.each(function () {
|
||||
const novelName = loadedCheerio(this).text();
|
||||
if (!novelName.match(/Activas|Finalizadas|Dropeadas/)) {
|
||||
const novelCover = loadedCheerio(this).find('img').attr('src');
|
||||
|
||||
let novelUrl = loadedCheerio(this).find("a").attr("href");
|
||||
let novelUrl = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
if (!novelUrl) return;
|
||||
if (!novelUrl) return;
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
}
|
||||
});
|
||||
novels.push(novel);
|
||||
}
|
||||
});
|
||||
|
||||
return novels;
|
||||
}
|
||||
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
|
||||
const url = novelUrl;
|
||||
return novels;
|
||||
}
|
||||
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
|
||||
const url = novelUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = parseHTML(body);
|
||||
let loadedCheerio = parseHTML(body);
|
||||
|
||||
let novel: Plugin.SourceNovel = { url };
|
||||
let novel: Plugin.SourceNovel = { url };
|
||||
|
||||
novel.name = loadedCheerio("h1.entry-title")
|
||||
.text()
|
||||
.replace(/[\t\n]/g, "")
|
||||
.trim();
|
||||
novel.name = loadedCheerio('h1.entry-title')
|
||||
.text()
|
||||
.replace(/[\t\n]/g, '')
|
||||
.trim();
|
||||
|
||||
novel.cover = loadedCheerio('img[loading="lazy"]').attr("src");
|
||||
novel.cover = loadedCheerio('img[loading="lazy"]').attr('src');
|
||||
|
||||
loadedCheerio(".entry-content > p").each(function (res) {
|
||||
if (loadedCheerio(this).text().includes("Autor")) {
|
||||
const details = loadedCheerio(this).html()?.match(/<\/strong>(.|\n)*?<br>/g)?.
|
||||
map((detail) => detail.replace(/<strong>|<\/strong>|<br>|:\s/g, ""));
|
||||
loadedCheerio('.entry-content > p').each(function (res) {
|
||||
if (loadedCheerio(this).text().includes('Autor')) {
|
||||
const details = loadedCheerio(this)
|
||||
.html()
|
||||
?.match(/<\/strong>(.|\n)*?<br>/g)
|
||||
?.map(detail => detail.replace(/<strong>|<\/strong>|<br>|:\s/g, ''));
|
||||
|
||||
novel.genres = "";
|
||||
if (details){
|
||||
novel.author = details[2];
|
||||
novel.genres = details[4].replace(/\s| /g, "");
|
||||
}
|
||||
}
|
||||
});
|
||||
novel.genres = '';
|
||||
if (details) {
|
||||
novel.author = details[2];
|
||||
novel.genres = details[4].replace(/\s| /g, '');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// let novelSummary = $(this).next().html();
|
||||
novel.summary = "";
|
||||
// let novelSummary = $(this).next().html();
|
||||
novel.summary = '';
|
||||
|
||||
let novelChapters: Plugin.ChapterItem[] = [];
|
||||
let novelChapters: Plugin.ChapterItem[] = [];
|
||||
|
||||
// if ($(".entry-content").find("li").length) {
|
||||
loadedCheerio(".entry-content")
|
||||
.find("a")
|
||||
.each(function () {
|
||||
let chapterUrl = loadedCheerio(this).attr("href");
|
||||
// if ($(".entry-content").find("li").length) {
|
||||
loadedCheerio('.entry-content')
|
||||
.find('a')
|
||||
.each(function () {
|
||||
let chapterUrl = loadedCheerio(this).attr('href');
|
||||
|
||||
if (chapterUrl && chapterUrl.includes(baseUrl)) {
|
||||
const chapterName = loadedCheerio(this).text();
|
||||
const releaseDate = null;
|
||||
if (chapterUrl && chapterUrl.includes(baseUrl)) {
|
||||
const chapterName = loadedCheerio(this).text();
|
||||
const releaseDate = null;
|
||||
|
||||
const chapter = {
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
};
|
||||
const chapter = {
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
};
|
||||
|
||||
novelChapters.push(chapter);
|
||||
}
|
||||
});
|
||||
novelChapters.push(chapter);
|
||||
}
|
||||
});
|
||||
|
||||
novel.chapters = novelChapters;
|
||||
novel.chapters = novelChapters;
|
||||
|
||||
return novel;
|
||||
}
|
||||
async parseChapter(chapterUrl: string): Promise<string> {
|
||||
const url = chapterUrl;
|
||||
return novel;
|
||||
}
|
||||
async parseChapter(chapterUrl: string): Promise<string> {
|
||||
const url = chapterUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = parseHTML(body);
|
||||
let loadedCheerio = parseHTML(body);
|
||||
|
||||
loadedCheerio("div#jp-post-flair").remove();
|
||||
loadedCheerio('div#jp-post-flair').remove();
|
||||
|
||||
let chapterText = loadedCheerio(".entry-content").html() || '';
|
||||
let chapterText = loadedCheerio('.entry-content').html() || '';
|
||||
|
||||
return chapterText;
|
||||
}
|
||||
async searchNovels(searchTerm: string, pageNo: number): Promise<Plugin.NovelItem[]> {
|
||||
searchTerm = searchTerm.toLowerCase();
|
||||
return chapterText;
|
||||
}
|
||||
async searchNovels(
|
||||
searchTerm: string,
|
||||
pageNo: number,
|
||||
): Promise<Plugin.NovelItem[]> {
|
||||
searchTerm = searchTerm.toLowerCase();
|
||||
|
||||
let url = baseUrl;
|
||||
let url = baseUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = parseHTML(body);
|
||||
let loadedCheerio = parseHTML(body);
|
||||
|
||||
let novels: Plugin.NovelItem[] = [];
|
||||
loadedCheerio(".menu-item-1819")
|
||||
.find(".sub-menu > li")
|
||||
.each(function () {
|
||||
const novelName = loadedCheerio(this).text();
|
||||
if (!novelName.match(/Activas|Finalizadas|Dropeadas/)) {
|
||||
const novelCover = loadedCheerio(this).find("img").attr("src");
|
||||
let novels: Plugin.NovelItem[] = [];
|
||||
loadedCheerio('.menu-item-1819')
|
||||
.find('.sub-menu > li')
|
||||
.each(function () {
|
||||
const novelName = loadedCheerio(this).text();
|
||||
if (!novelName.match(/Activas|Finalizadas|Dropeadas/)) {
|
||||
const novelCover = loadedCheerio(this).find('img').attr('src');
|
||||
|
||||
let novelUrl = loadedCheerio(this).find("a").attr("href");
|
||||
let novelUrl = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
if (!novelUrl) return;
|
||||
if (!novelUrl) return;
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
}
|
||||
});
|
||||
novels.push(novel);
|
||||
}
|
||||
});
|
||||
|
||||
novels = novels.filter((novel) =>
|
||||
novel.name.toLowerCase().includes(searchTerm)
|
||||
);
|
||||
|
||||
return novels;
|
||||
}
|
||||
async fetchImage(url: string): Promise<string | undefined> {
|
||||
return fetchFile(url);
|
||||
}
|
||||
novels = novels.filter(novel =>
|
||||
novel.name.toLowerCase().includes(searchTerm),
|
||||
);
|
||||
|
||||
return novels;
|
||||
}
|
||||
async fetchImage(url: string): Promise<string | undefined> {
|
||||
return fetchFile(url);
|
||||
}
|
||||
}
|
||||
|
||||
export default new Oasis();
|
||||
|
||||
@@ -1,93 +1,96 @@
|
||||
import { fetchApi, fetchFile } from "@libs/fetch";
|
||||
import { Filters } from "@libs/filterInputs";
|
||||
import { Plugin } from "@typings/plugin";
|
||||
import { fetchApi, fetchFile } from '@libs/fetch';
|
||||
import { Filters } from '@libs/filterInputs';
|
||||
import { Plugin } from '@typings/plugin';
|
||||
|
||||
class SkyNovels implements Plugin.PluginBase {
|
||||
id = "skynovels.net";
|
||||
name = "SkyNovels";
|
||||
site = "https://www.skynovels.net/";
|
||||
version = "1.0.0";
|
||||
icon = "src/es/skynovels/icon.png";
|
||||
id = 'skynovels.net';
|
||||
name = 'SkyNovels';
|
||||
site = 'https://www.skynovels.net/';
|
||||
version = '1.0.0';
|
||||
icon = 'src/es/skynovels/icon.png';
|
||||
baseUrl = this.site;
|
||||
|
||||
async popularNovels(pageNo: number, options: Plugin.PopularNovelsOptions<Filters>): Promise<Plugin.NovelItem[]> {
|
||||
const url = "https://api.skynovels.net/api/novels?&q";
|
||||
async popularNovels(
|
||||
pageNo: number,
|
||||
options: Plugin.PopularNovelsOptions<Filters>,
|
||||
): Promise<Plugin.NovelItem[]> {
|
||||
const url = 'https://api.skynovels.net/api/novels?&q';
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.json() as response;
|
||||
const body = (await result.json()) as response;
|
||||
|
||||
const novels: Plugin.NovelItem[] = [];
|
||||
|
||||
body.novels?.forEach((res) => {
|
||||
const novelName = res.nvl_title;
|
||||
const novelCover =
|
||||
"https://api.skynovels.net/api/get-image/" +
|
||||
res.image +
|
||||
"/novels/false";
|
||||
const novelUrl =
|
||||
this.baseUrl + "novelas/" + res.id + "/" + res.nvl_name + "/";
|
||||
body.novels?.forEach(res => {
|
||||
const novelName = res.nvl_title;
|
||||
const novelCover =
|
||||
'https://api.skynovels.net/api/get-image/' +
|
||||
res.image +
|
||||
'/novels/false';
|
||||
const novelUrl =
|
||||
this.baseUrl + 'novelas/' + res.id + '/' + res.nvl_name + '/';
|
||||
|
||||
const novel = { name: novelName, url: novelUrl, cover: novelCover };
|
||||
const novel = { name: novelName, url: novelUrl, cover: novelCover };
|
||||
|
||||
novels.push(novel);
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels;
|
||||
}
|
||||
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
|
||||
const novelId = novelUrl.split("/")[4];
|
||||
const url =
|
||||
"https://api.skynovels.net/api/novel/" + novelId + "/reading?&q";
|
||||
const novelId = novelUrl.split('/')[4];
|
||||
const url =
|
||||
'https://api.skynovels.net/api/novel/' + novelId + '/reading?&q';
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.json() as responseBook;
|
||||
const result = await fetchApi(url);
|
||||
const body = (await result.json()) as responseBook;
|
||||
|
||||
const item = body?.novel?.[0];
|
||||
const item = body?.novel?.[0];
|
||||
|
||||
let novel: Plugin.SourceNovel = { url: novelUrl };
|
||||
let novel: Plugin.SourceNovel = { url: novelUrl };
|
||||
|
||||
novel.name = item?.nvl_title;
|
||||
novel.name = item?.nvl_title;
|
||||
|
||||
novel.cover =
|
||||
"https://api.skynovels.net/api/get-image/" +
|
||||
item?.image +
|
||||
"/novels/false";
|
||||
novel.cover =
|
||||
'https://api.skynovels.net/api/get-image/' +
|
||||
item?.image +
|
||||
'/novels/false';
|
||||
|
||||
let genres: string[] = [];
|
||||
item?.genres?.forEach((genre) => genres.push(genre.genre_name));
|
||||
novel.genres = genres.join(",");
|
||||
novel.author = item?.nvl_writer;
|
||||
novel.summary = item?.nvl_content;
|
||||
novel.status = item?.nvl_status;
|
||||
let genres: string[] = [];
|
||||
item?.genres?.forEach(genre => genres.push(genre.genre_name));
|
||||
novel.genres = genres.join(',');
|
||||
novel.author = item?.nvl_writer;
|
||||
novel.summary = item?.nvl_content;
|
||||
novel.status = item?.nvl_status;
|
||||
|
||||
let novelChapters: Plugin.ChapterItem[] = [];
|
||||
let novelChapters: Plugin.ChapterItem[] = [];
|
||||
|
||||
item?.volumes?.forEach((volume) => {
|
||||
volume?.chapters?.forEach((chapter) => {
|
||||
const chapterName = chapter.chp_index_title;
|
||||
const releaseDate = new Date(chapter.createdAt).toDateString();
|
||||
const chapterUrl = novelUrl + chapter.id + "/" + chapter.chp_name;
|
||||
item?.volumes?.forEach(volume => {
|
||||
volume?.chapters?.forEach(chapter => {
|
||||
const chapterName = chapter.chp_index_title;
|
||||
const releaseDate = new Date(chapter.createdAt).toDateString();
|
||||
const chapterUrl = novelUrl + chapter.id + '/' + chapter.chp_name;
|
||||
|
||||
const chap = {
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
};
|
||||
const chap = {
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
};
|
||||
|
||||
novelChapters.push(chap);
|
||||
});
|
||||
});
|
||||
novelChapters.push(chap);
|
||||
});
|
||||
});
|
||||
|
||||
novel.chapters = novelChapters;
|
||||
novel.chapters = novelChapters;
|
||||
|
||||
return novel;
|
||||
return novel;
|
||||
}
|
||||
async parseChapter(chapterUrl: string): Promise<string> {
|
||||
let chapterId: string = chapterUrl.split("/")[6];
|
||||
let chapterId: string = chapterUrl.split('/')[6];
|
||||
const url = `https://api.skynovels.net/api/novel-chapter/${chapterId}`;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.json() as responseChapter;
|
||||
const body = (await result.json()) as responseChapter;
|
||||
|
||||
const item = body?.chapter?.[0];
|
||||
|
||||
@@ -95,31 +98,34 @@ class SkyNovels implements Plugin.PluginBase {
|
||||
|
||||
return chapterText;
|
||||
}
|
||||
async searchNovels(searchTerm: string, pageNo: number): Promise<Plugin.NovelItem[]> {
|
||||
async searchNovels(
|
||||
searchTerm: string,
|
||||
pageNo: number,
|
||||
): Promise<Plugin.NovelItem[]> {
|
||||
searchTerm = searchTerm.toLowerCase();
|
||||
const url = "https://api.skynovels.net/api/novels?&q";
|
||||
const url = 'https://api.skynovels.net/api/novels?&q';
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.json() as response;;
|
||||
const body = (await result.json()) as response;
|
||||
|
||||
let results = body?.novels?.filter((novel) =>
|
||||
novel.nvl_title.toLowerCase().includes(searchTerm)
|
||||
let results = body?.novels?.filter(novel =>
|
||||
novel.nvl_title.toLowerCase().includes(searchTerm),
|
||||
);
|
||||
|
||||
const novels: Plugin.NovelItem[] = [];
|
||||
|
||||
results?.forEach((res) => {
|
||||
const novelName = res.nvl_title;
|
||||
const novelCover =
|
||||
"https://api.skynovels.net/api/get-image/" +
|
||||
res.image +
|
||||
"/novels/false";
|
||||
const novelUrl =
|
||||
this.baseUrl + "novelas/" + res.id + "/" + res.nvl_name + "/";
|
||||
results?.forEach(res => {
|
||||
const novelName = res.nvl_title;
|
||||
const novelCover =
|
||||
'https://api.skynovels.net/api/get-image/' +
|
||||
res.image +
|
||||
'/novels/false';
|
||||
const novelUrl =
|
||||
this.baseUrl + 'novelas/' + res.id + '/' + res.nvl_name + '/';
|
||||
|
||||
const novel = { name: novelName, url: novelUrl, cover: novelCover };
|
||||
const novel = { name: novelName, url: novelUrl, cover: novelCover };
|
||||
|
||||
novels.push(novel);
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels;
|
||||
@@ -132,7 +138,7 @@ class SkyNovels implements Plugin.PluginBase {
|
||||
export default new SkyNovels();
|
||||
|
||||
interface response {
|
||||
novels?: (NovelsEntity)[] | null;
|
||||
novels?: NovelsEntity[] | null;
|
||||
}
|
||||
interface NovelsEntity {
|
||||
id: number;
|
||||
@@ -154,16 +160,15 @@ interface NovelsEntity {
|
||||
nvl_last_update: string;
|
||||
nvl_rating?: number | null;
|
||||
nvl_ratings_count: number;
|
||||
genres?: (GenresEntity)[] | null;
|
||||
genres?: GenresEntity[] | null;
|
||||
}
|
||||
interface GenresEntity {
|
||||
id: number;
|
||||
genre_name: string;
|
||||
}
|
||||
|
||||
|
||||
interface responseBook {
|
||||
novel?: (NovelEntity)[] | null;
|
||||
novel?: NovelEntity[] | null;
|
||||
}
|
||||
interface NovelEntity {
|
||||
id: number;
|
||||
@@ -184,11 +189,11 @@ interface NovelEntity {
|
||||
nvl_chapters: number;
|
||||
nvl_last_update: string;
|
||||
nvl_rating: number;
|
||||
bookmarks?: (BookmarksEntity)[] | null;
|
||||
volumes?: (VolumesEntity)[] | null;
|
||||
novel_ratings?: (NovelRatingsEntity)[] | null;
|
||||
collaborators?: (CollaboratorsEntity)[] | null;
|
||||
genres?: (GenresEntity)[] | null;
|
||||
bookmarks?: BookmarksEntity[] | null;
|
||||
volumes?: VolumesEntity[] | null;
|
||||
novel_ratings?: NovelRatingsEntity[] | null;
|
||||
collaborators?: CollaboratorsEntity[] | null;
|
||||
genres?: GenresEntity[] | null;
|
||||
}
|
||||
interface BookmarksEntity {
|
||||
id: number;
|
||||
@@ -201,7 +206,7 @@ interface VolumesEntity {
|
||||
id: number;
|
||||
nvl_id: number;
|
||||
user_id?: number | null;
|
||||
chapters?: (ChaptersEntity)[] | null;
|
||||
chapters?: ChaptersEntity[] | null;
|
||||
}
|
||||
interface ChaptersEntity {
|
||||
id: number;
|
||||
@@ -233,9 +238,8 @@ interface CollaboratorsEntity {
|
||||
user_login: string;
|
||||
}
|
||||
|
||||
|
||||
interface responseChapter {
|
||||
chapter?: (ChapterEntity)[] | null;
|
||||
chapter?: ChapterEntity[] | null;
|
||||
}
|
||||
interface ChapterEntity {
|
||||
id: number;
|
||||
@@ -256,9 +260,9 @@ interface ChapterEntity {
|
||||
nvl_name: string;
|
||||
user_login: string;
|
||||
reactions_count: number;
|
||||
comments?: (null)[] | null;
|
||||
reactions?: (null)[] | null;
|
||||
total_reactions?: (TotalReactionsEntity)[] | null;
|
||||
comments?: null[] | null;
|
||||
reactions?: null[] | null;
|
||||
total_reactions?: TotalReactionsEntity[] | null;
|
||||
}
|
||||
interface TotalReactionsEntity {
|
||||
reaction_id: number;
|
||||
|
||||
+131
-124
@@ -1,19 +1,19 @@
|
||||
import { CheerioAPI, load as parseHTML } from "cheerio";
|
||||
import { fetchApi, fetchFile } from "@libs/fetch";
|
||||
import { FilterTypes, Filters } from "@libs/filterInputs";
|
||||
import { Plugin } from "@typings/plugin";
|
||||
import { defaultCover } from "@libs/defaultCover";
|
||||
import { NovelStatus } from "@libs/novelStatus";
|
||||
import { CheerioAPI, load as parseHTML } from 'cheerio';
|
||||
import { fetchApi, fetchFile } from '@libs/fetch';
|
||||
import { FilterTypes, Filters } from '@libs/filterInputs';
|
||||
import { Plugin } from '@typings/plugin';
|
||||
import { defaultCover } from '@libs/defaultCover';
|
||||
import { NovelStatus } from '@libs/novelStatus';
|
||||
|
||||
class TuNovelaLigera implements Plugin.PagePlugin {
|
||||
id = "tunovelaligera";
|
||||
name = "TuNovelaLigera";
|
||||
icon = "src/es/tunovelaligera/icon.png";
|
||||
site = "https://tunovelaligera.com";
|
||||
version = "1.0.0";
|
||||
id = 'tunovelaligera';
|
||||
name = 'TuNovelaLigera';
|
||||
icon = 'src/es/tunovelaligera/icon.png';
|
||||
site = 'https://tunovelaligera.com';
|
||||
version = '1.0.0';
|
||||
|
||||
async sleep (ms: number) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms))
|
||||
async sleep(ms: number) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
}
|
||||
async popularNovels(
|
||||
pageNo: number,
|
||||
@@ -22,21 +22,23 @@ class TuNovelaLigera implements Plugin.PagePlugin {
|
||||
filters,
|
||||
}: Plugin.PopularNovelsOptions<typeof this.filters>,
|
||||
): Promise<Plugin.NovelItem[]> {
|
||||
let link = this.site
|
||||
let link = this.site;
|
||||
|
||||
link += filters?.genres?.value ? "/genero" + filters.genres.value : "/novelas";
|
||||
link += filters?.genres?.value
|
||||
? '/genero' + filters.genres.value
|
||||
: '/novelas';
|
||||
link += `/page/${pageNo}?m_orderby=`;
|
||||
link += (showLatestNovels ? "latest" : filters?.order?.value || "rating");
|
||||
link += showLatestNovels ? 'latest' : filters?.order?.value || 'rating';
|
||||
|
||||
const result = await fetchApi(link).then((res) => res.text());
|
||||
const result = await fetchApi(link).then(res => res.text());
|
||||
const loadedCheerio = parseHTML(result);
|
||||
|
||||
const novels: Plugin.NovelItem[] = [];
|
||||
|
||||
loadedCheerio(".page-item-detail").each((i, el) => {
|
||||
const name = loadedCheerio(el).find(".h5 > a").text();
|
||||
const cover = loadedCheerio(el).find("img").attr("src");
|
||||
const url = loadedCheerio(el).find(".h5 > a").attr("href");
|
||||
loadedCheerio('.page-item-detail').each((i, el) => {
|
||||
const name = loadedCheerio(el).find('.h5 > a').text();
|
||||
const cover = loadedCheerio(el).find('img').attr('src');
|
||||
const url = loadedCheerio(el).find('.h5 > a').attr('href');
|
||||
if (!url) return;
|
||||
|
||||
novels.push({ name, cover, path: url.replace(this.site, '') });
|
||||
@@ -47,15 +49,15 @@ class TuNovelaLigera implements Plugin.PagePlugin {
|
||||
|
||||
parseChapters(loadedCheerio: CheerioAPI): Plugin.ChapterItem[] {
|
||||
const chapters: Plugin.ChapterItem[] = [];
|
||||
loadedCheerio("#lcp_instance_0 li").each((i, el) => {
|
||||
loadedCheerio('#lcp_instance_0 li').each((i, el) => {
|
||||
const chapterName = loadedCheerio(el)
|
||||
.find("a")
|
||||
.find('a')
|
||||
.text()
|
||||
.replace(/[\t\n]/g, "")
|
||||
.replace(/[\t\n]/g, '')
|
||||
.trim();
|
||||
|
||||
const chapterUrl = loadedCheerio(el).find("a").attr("href");
|
||||
if(!chapterUrl) return;
|
||||
const chapterUrl = loadedCheerio(el).find('a').attr('href');
|
||||
if (!chapterUrl) return;
|
||||
chapters.push({
|
||||
name: chapterName,
|
||||
path: chapterUrl.replace(this.site, ''),
|
||||
@@ -63,59 +65,61 @@ class TuNovelaLigera implements Plugin.PagePlugin {
|
||||
});
|
||||
return chapters;
|
||||
}
|
||||
|
||||
async parseNovel(novelPath: string): Promise<Plugin.SourceNovel & { totalPages: number; }> {
|
||||
|
||||
async parseNovel(
|
||||
novelPath: string,
|
||||
): Promise<Plugin.SourceNovel & { totalPages: number }> {
|
||||
const novelUrl = this.site + novelPath;
|
||||
const result = await fetchApi(novelUrl);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = parseHTML(body);
|
||||
let lastPage = 1;
|
||||
loadedCheerio('ul.lcp_paginator > li > a').each(function() {
|
||||
const page = Number(this.attribs['title']);
|
||||
if(page && page > lastPage) lastPage = page;
|
||||
loadedCheerio('ul.lcp_paginator > li > a').each(function () {
|
||||
const page = Number(this.attribs['title']);
|
||||
if (page && page > lastPage) lastPage = page;
|
||||
});
|
||||
const novel: Plugin.SourceNovel & { totalPages: number; } = {
|
||||
const novel: Plugin.SourceNovel & { totalPages: number } = {
|
||||
path: novelPath,
|
||||
chapters: [],
|
||||
totalPages: lastPage,
|
||||
name: loadedCheerio(".post-title > h1").text().trim()
|
||||
name: loadedCheerio('.post-title > h1').text().trim(),
|
||||
};
|
||||
|
||||
loadedCheerio(".manga-title-badges").remove();
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
|
||||
let novelCover = loadedCheerio(".summary_image > a > img");
|
||||
let novelCover = loadedCheerio('.summary_image > a > img');
|
||||
|
||||
novel.cover =
|
||||
novelCover.attr("data-src") ||
|
||||
novelCover.attr("src") ||
|
||||
novelCover.attr("data-cfsrc") ||
|
||||
novelCover.attr('data-src') ||
|
||||
novelCover.attr('src') ||
|
||||
novelCover.attr('data-cfsrc') ||
|
||||
defaultCover;
|
||||
|
||||
loadedCheerio(".post-content_item").each(function () {
|
||||
loadedCheerio('.post-content_item').each(function () {
|
||||
const detailName = loadedCheerio(this)
|
||||
.find(".summary-heading > h5")
|
||||
.find('.summary-heading > h5')
|
||||
.text()
|
||||
.trim();
|
||||
const detail = loadedCheerio(this).find(".summary-content").text().trim();
|
||||
const detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
|
||||
switch (detailName) {
|
||||
case "Género(s)":
|
||||
novel.genres = detail.replace(/, /g, ",");
|
||||
case 'Género(s)':
|
||||
novel.genres = detail.replace(/, /g, ',');
|
||||
break;
|
||||
case "Autor(es)":
|
||||
case 'Autor(es)':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case "Estado":
|
||||
case 'Estado':
|
||||
novel.status =
|
||||
detail.includes("OnGoing") || detail.includes("Updating")
|
||||
detail.includes('OnGoing') || detail.includes('Updating')
|
||||
? NovelStatus.Ongoing
|
||||
: NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
novel.summary = loadedCheerio("div.summary__content > p").text().trim();
|
||||
novel.summary = loadedCheerio('div.summary__content > p').text().trim();
|
||||
|
||||
novel.chapters = this.parseChapters(loadedCheerio);
|
||||
|
||||
@@ -130,22 +134,27 @@ class TuNovelaLigera implements Plugin.PagePlugin {
|
||||
|
||||
let loadedCheerio = parseHTML(body);
|
||||
const latestChapterEle = loadedCheerio('#lcp_instance_0 li').first();
|
||||
const latestChapterUrl = loadedCheerio(latestChapterEle).find("a").attr("href");
|
||||
const latestChapterName = loadedCheerio(latestChapterEle).find("a")
|
||||
.text()
|
||||
.replace(/[\t\n]/g, "")
|
||||
.trim();
|
||||
const latestChapter: Plugin.ChapterItem | undefined = latestChapterUrl ? {
|
||||
path: latestChapterUrl.replace(this.site, ''),
|
||||
name: latestChapterName
|
||||
} : undefined
|
||||
const latestChapterUrl = loadedCheerio(latestChapterEle)
|
||||
.find('a')
|
||||
.attr('href');
|
||||
const latestChapterName = loadedCheerio(latestChapterEle)
|
||||
.find('a')
|
||||
.text()
|
||||
.replace(/[\t\n]/g, '')
|
||||
.trim();
|
||||
const latestChapter: Plugin.ChapterItem | undefined = latestChapterUrl
|
||||
? {
|
||||
path: latestChapterUrl.replace(this.site, ''),
|
||||
name: latestChapterName,
|
||||
}
|
||||
: undefined;
|
||||
await this.sleep(1000);
|
||||
const pageText = await fetchApi(pageUrl).then(res => res.text());
|
||||
const chapters = this.parseChapters(parseHTML(pageText));
|
||||
return {
|
||||
chapters,
|
||||
latestChapter
|
||||
}
|
||||
latestChapter,
|
||||
};
|
||||
}
|
||||
async parseChapter(chapterPath: string): Promise<string> {
|
||||
const result = await fetchApi(this.site + chapterPath);
|
||||
@@ -153,14 +162,12 @@ class TuNovelaLigera implements Plugin.PagePlugin {
|
||||
|
||||
const loadedCheerio = parseHTML(body);
|
||||
|
||||
const chapterText = loadedCheerio(".c-blog-post.post").html() || "";
|
||||
const chapterText = loadedCheerio('.c-blog-post.post').html() || '';
|
||||
|
||||
return chapterText;
|
||||
}
|
||||
|
||||
async searchNovels(
|
||||
searchTerm: string,
|
||||
): Promise<Plugin.NovelItem[]> {
|
||||
async searchNovels(searchTerm: string): Promise<Plugin.NovelItem[]> {
|
||||
const url = `${this.site}/?s=${searchTerm}&post_type=wp-manga`;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
@@ -170,10 +177,10 @@ class TuNovelaLigera implements Plugin.PagePlugin {
|
||||
|
||||
const novels: Plugin.NovelItem[] = [];
|
||||
|
||||
loadedCheerio(".c-tabs-item__content").each((i, el) => {
|
||||
const name = loadedCheerio(el).find(".h4 > a").text();
|
||||
const cover = loadedCheerio(el).find("img").attr("src");
|
||||
const url = loadedCheerio(el).find(".h4 > a").attr("href");
|
||||
loadedCheerio('.c-tabs-item__content').each((i, el) => {
|
||||
const name = loadedCheerio(el).find('.h4 > a').text();
|
||||
const cover = loadedCheerio(el).find('img').attr('src');
|
||||
const url = loadedCheerio(el).find('.h4 > a').attr('href');
|
||||
if (!url) return;
|
||||
|
||||
novels.push({ name, cover, path: url.replace(this.site, '') });
|
||||
@@ -188,70 +195,70 @@ class TuNovelaLigera implements Plugin.PagePlugin {
|
||||
|
||||
filters = {
|
||||
order: {
|
||||
value: "rating",
|
||||
label: "Ordenado por",
|
||||
value: 'rating',
|
||||
label: 'Ordenado por',
|
||||
options: [
|
||||
{ label: "Lo mas reciente", value: "latest" },
|
||||
{ label: "A-Z", value: "alphabet" },
|
||||
{ label: "Clasificación", value: "rating" },
|
||||
{ label: "Trending", value: "trending" },
|
||||
{ label: "Mas visto", value: "views" },
|
||||
{ label: "Nuevo", value: "new-manga" },
|
||||
{ label: 'Lo mas reciente', value: 'latest' },
|
||||
{ label: 'A-Z', value: 'alphabet' },
|
||||
{ label: 'Clasificación', value: 'rating' },
|
||||
{ label: 'Trending', value: 'trending' },
|
||||
{ label: 'Mas visto', value: 'views' },
|
||||
{ label: 'Nuevo', value: 'new-manga' },
|
||||
],
|
||||
type: FilterTypes.Picker,
|
||||
},
|
||||
genres: {
|
||||
value: "",
|
||||
label: "Generos",
|
||||
value: '',
|
||||
label: 'Generos',
|
||||
options: [
|
||||
{ label: "None", value: "" },
|
||||
{ label: "Acción", value: "accion" },
|
||||
{ label: "Adulto", value: "adulto" },
|
||||
{ label: "Artes Marciales", value: "artes-marciales" },
|
||||
{ label: "Aventura", value: "aventura" },
|
||||
{ label: "Ciencia Ficción", value: "ciencia-ficcion" },
|
||||
{ label: "Comedia", value: "comedia" },
|
||||
{ label: "Deportes", value: "deportes" },
|
||||
{ label: "Drama", value: "drama" },
|
||||
{ label: "Eastern Fantasy", value: "eastern-fantasy" },
|
||||
{ label: "Ecchi", value: "ecchi" },
|
||||
{ label: "FanFiction", value: "fan-fiction" },
|
||||
{ label: "Fantasía", value: "fantasia" },
|
||||
{ label: "Fantasía oriental", value: "fantasia-oriental" },
|
||||
{ label: "Ficción Romántica", value: "ficcion-romantica" },
|
||||
{ label: "Gender Bender", value: "gender-bender" },
|
||||
{ label: "Harem", value: "harem" },
|
||||
{ label: "Histórico", value: "historico" },
|
||||
{ label: "Horror", value: "horror" },
|
||||
{ label: "Josei", value: "josei" },
|
||||
{ label: "Maduro", value: "maduro" },
|
||||
{ label: "Mecha", value: "mecha" },
|
||||
{ label: "Misterio", value: "misterio" },
|
||||
{ label: "Novela China", value: "novela-china" },
|
||||
{ label: "Novela FanFiction", value: "novela-fanfiction" },
|
||||
{ label: "Novela Japonesa", value: "novela-japonesa" },
|
||||
{ label: "Novela Koreana", value: "novela-koreana" },
|
||||
{ label: "Novela ligera", value: "novela-ligera" },
|
||||
{ label: "Novela original", value: "novela-original" },
|
||||
{ label: "Novela Web", value: "web-novel" },
|
||||
{ label: "Psicológico", value: "psicologico" },
|
||||
{ label: "Realismo Mágico", value: "realismo-magico" },
|
||||
{ label: "Recuento de vida", value: "recuento-de-vida" },
|
||||
{ label: "Romance", value: "romance" },
|
||||
{ label: "Romance contemporáneo", value: "romance-contemporaneo" },
|
||||
{ label: "Romance Moderno", value: "romance-moderno" },
|
||||
{ label: "Seinen", value: "seinen" },
|
||||
{ label: "Shoujo", value: "shoujo" },
|
||||
{ label: "Shounen", value: "shounen" },
|
||||
{ label: "Sobrenatural", value: "sobrenatural" },
|
||||
{ label: "Tragedia", value: "tragedia" },
|
||||
{ label: "Vampiros", value: "vampiros" },
|
||||
{ label: "Vida Escolar", value: "vida-escolar" },
|
||||
{ label: "Western Fantasy", value: "western-fantasy" },
|
||||
{ label: "Wuxia", value: "wuxia" },
|
||||
{ label: "Xianxia", value: "xianxia" },
|
||||
{ label: "Xuanhuan", value: "xuanhuan" },
|
||||
{ label: "Yaoi", value: "yaoi" },
|
||||
{ label: 'None', value: '' },
|
||||
{ label: 'Acción', value: 'accion' },
|
||||
{ label: 'Adulto', value: 'adulto' },
|
||||
{ label: 'Artes Marciales', value: 'artes-marciales' },
|
||||
{ label: 'Aventura', value: 'aventura' },
|
||||
{ label: 'Ciencia Ficción', value: 'ciencia-ficcion' },
|
||||
{ label: 'Comedia', value: 'comedia' },
|
||||
{ label: 'Deportes', value: 'deportes' },
|
||||
{ label: 'Drama', value: 'drama' },
|
||||
{ label: 'Eastern Fantasy', value: 'eastern-fantasy' },
|
||||
{ label: 'Ecchi', value: 'ecchi' },
|
||||
{ label: 'FanFiction', value: 'fan-fiction' },
|
||||
{ label: 'Fantasía', value: 'fantasia' },
|
||||
{ label: 'Fantasía oriental', value: 'fantasia-oriental' },
|
||||
{ label: 'Ficción Romántica', value: 'ficcion-romantica' },
|
||||
{ label: 'Gender Bender', value: 'gender-bender' },
|
||||
{ label: 'Harem', value: 'harem' },
|
||||
{ label: 'Histórico', value: 'historico' },
|
||||
{ label: 'Horror', value: 'horror' },
|
||||
{ label: 'Josei', value: 'josei' },
|
||||
{ label: 'Maduro', value: 'maduro' },
|
||||
{ label: 'Mecha', value: 'mecha' },
|
||||
{ label: 'Misterio', value: 'misterio' },
|
||||
{ label: 'Novela China', value: 'novela-china' },
|
||||
{ label: 'Novela FanFiction', value: 'novela-fanfiction' },
|
||||
{ label: 'Novela Japonesa', value: 'novela-japonesa' },
|
||||
{ label: 'Novela Koreana', value: 'novela-koreana' },
|
||||
{ label: 'Novela ligera', value: 'novela-ligera' },
|
||||
{ label: 'Novela original', value: 'novela-original' },
|
||||
{ label: 'Novela Web', value: 'web-novel' },
|
||||
{ label: 'Psicológico', value: 'psicologico' },
|
||||
{ label: 'Realismo Mágico', value: 'realismo-magico' },
|
||||
{ label: 'Recuento de vida', value: 'recuento-de-vida' },
|
||||
{ label: 'Romance', value: 'romance' },
|
||||
{ label: 'Romance contemporáneo', value: 'romance-contemporaneo' },
|
||||
{ label: 'Romance Moderno', value: 'romance-moderno' },
|
||||
{ label: 'Seinen', value: 'seinen' },
|
||||
{ label: 'Shoujo', value: 'shoujo' },
|
||||
{ label: 'Shounen', value: 'shounen' },
|
||||
{ label: 'Sobrenatural', value: 'sobrenatural' },
|
||||
{ label: 'Tragedia', value: 'tragedia' },
|
||||
{ label: 'Vampiros', value: 'vampiros' },
|
||||
{ label: 'Vida Escolar', value: 'vida-escolar' },
|
||||
{ label: 'Western Fantasy', value: 'western-fantasy' },
|
||||
{ label: 'Wuxia', value: 'wuxia' },
|
||||
{ label: 'Xianxia', value: 'xianxia' },
|
||||
{ label: 'Xuanhuan', value: 'xuanhuan' },
|
||||
{ label: 'Yaoi', value: 'yaoi' },
|
||||
],
|
||||
type: FilterTypes.Picker,
|
||||
},
|
||||
|
||||
+167
-162
@@ -1,192 +1,197 @@
|
||||
import { fetchApi, fetchFile } from "@libs/fetch";
|
||||
import { Filters } from "@libs/filterInputs";
|
||||
import { Plugin } from "@typings/plugin";
|
||||
import { load as parseHTML } from "cheerio";
|
||||
import { fetchApi, fetchFile } from '@libs/fetch';
|
||||
import { Filters } from '@libs/filterInputs';
|
||||
import { Plugin } from '@typings/plugin';
|
||||
import { load as parseHTML } from 'cheerio';
|
||||
|
||||
export const id = "yuukitls.com";
|
||||
export const name = "Yuuki Tls";
|
||||
export const site = "https://yuukitls.com/";
|
||||
export const version = "1.0.0";
|
||||
export const icon = "src/es/yuukitls/icon.png";
|
||||
export const id = 'yuukitls.com';
|
||||
export const name = 'Yuuki Tls';
|
||||
export const site = 'https://yuukitls.com/';
|
||||
export const version = '1.0.0';
|
||||
export const icon = 'src/es/yuukitls/icon.png';
|
||||
|
||||
const baseUrl = site;
|
||||
|
||||
class Yuuki implements Plugin.PluginBase {
|
||||
id = "yuukitls.com";
|
||||
name = "Yuuki Tls";
|
||||
icon = "src/es/yuukitls/icon.png";
|
||||
site = "https://yuukitls.com/";
|
||||
filters?: Filters | undefined;
|
||||
version = "1.0.0";
|
||||
baseUrl = this.site;
|
||||
id = 'yuukitls.com';
|
||||
name = 'Yuuki Tls';
|
||||
icon = 'src/es/yuukitls/icon.png';
|
||||
site = 'https://yuukitls.com/';
|
||||
filters?: Filters | undefined;
|
||||
version = '1.0.0';
|
||||
baseUrl = this.site;
|
||||
|
||||
async popularNovels(pageNo: number, options: Plugin.PopularNovelsOptions<Filters>): Promise<Plugin.NovelItem[]> {
|
||||
let url = baseUrl;
|
||||
async popularNovels(
|
||||
pageNo: number,
|
||||
options: Plugin.PopularNovelsOptions<Filters>,
|
||||
): Promise<Plugin.NovelItem[]> {
|
||||
let url = baseUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = parseHTML(body);
|
||||
let loadedCheerio = parseHTML(body);
|
||||
|
||||
let novels: Plugin.NovelItem[] = [];
|
||||
let novels: Plugin.NovelItem[] = [];
|
||||
|
||||
loadedCheerio(".quadmenu-navbar-collapse ul li:nth-child(2)")
|
||||
.find("li")
|
||||
.each(function () {
|
||||
const novelName = loadedCheerio(this)
|
||||
.text()
|
||||
.replace(/[\s\n]+/g, " ");
|
||||
const novelCover = loadedCheerio(this).find("img").attr("src");
|
||||
loadedCheerio('.quadmenu-navbar-collapse ul li:nth-child(2)')
|
||||
.find('li')
|
||||
.each(function () {
|
||||
const novelName = loadedCheerio(this)
|
||||
.text()
|
||||
.replace(/[\s\n]+/g, ' ');
|
||||
const novelCover = loadedCheerio(this).find('img').attr('src');
|
||||
|
||||
let novelUrl = loadedCheerio(this).find("a").attr("href");
|
||||
if (!novelUrl) return;
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels;
|
||||
}
|
||||
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
|
||||
const url = novelUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = parseHTML(body);
|
||||
|
||||
let novel: Plugin.SourceNovel = {
|
||||
url,
|
||||
let novelUrl = loadedCheerio(this).find('a').attr('href');
|
||||
if (!novelUrl) return;
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novel.name = loadedCheerio("h1.entry-title")
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
return novels;
|
||||
}
|
||||
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
|
||||
const url = novelUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = parseHTML(body);
|
||||
|
||||
let novel: Plugin.SourceNovel = {
|
||||
url,
|
||||
};
|
||||
|
||||
novel.name = loadedCheerio('h1.entry-title')
|
||||
.text()
|
||||
.replace(/[\t\n]/g, '')
|
||||
.trim();
|
||||
|
||||
novel.cover = loadedCheerio('img[loading="lazy"]').attr('src');
|
||||
|
||||
loadedCheerio('.entry-content')
|
||||
.find('div')
|
||||
.each(function () {
|
||||
if (loadedCheerio(this).text().includes('Escritor:')) {
|
||||
novel.author = loadedCheerio(this)
|
||||
.text()
|
||||
.replace(/[\t\n]/g, "")
|
||||
.replace('Escritor: ', '')
|
||||
.trim();
|
||||
|
||||
novel.cover = loadedCheerio('img[loading="lazy"]').attr("src");
|
||||
|
||||
loadedCheerio(".entry-content")
|
||||
.find("div")
|
||||
.each(function () {
|
||||
if (loadedCheerio(this).text().includes("Escritor:")) {
|
||||
novel.author = loadedCheerio(this)
|
||||
.text()
|
||||
.replace("Escritor: ", "")
|
||||
.trim();
|
||||
}
|
||||
if (loadedCheerio(this).text().includes("Género:")) {
|
||||
novel.genres = loadedCheerio(this)
|
||||
.text()
|
||||
.replace(/Género: |\s/g, "");
|
||||
}
|
||||
|
||||
if (loadedCheerio(this).text().includes("Sinopsis:")) {
|
||||
novel.summary = loadedCheerio(this).next().text();
|
||||
}
|
||||
});
|
||||
|
||||
let novelChapters: Plugin.ChapterItem[] = [];
|
||||
|
||||
if (loadedCheerio(".entry-content").find("li").length) {
|
||||
loadedCheerio(".entry-content")
|
||||
.find("li")
|
||||
.each(function () {
|
||||
let chapterUrl = loadedCheerio(this).find("a").attr("href");
|
||||
|
||||
if (chapterUrl && chapterUrl.includes(baseUrl)) {
|
||||
const chapterName = loadedCheerio(this).text();
|
||||
const releaseDate = null;
|
||||
|
||||
const chapter = {
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
};
|
||||
|
||||
novelChapters.push(chapter);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
loadedCheerio(".entry-content")
|
||||
.find("p")
|
||||
.each(function () {
|
||||
let chapterUrl = loadedCheerio(this).find("a").attr("href");
|
||||
|
||||
if (chapterUrl && chapterUrl.includes(baseUrl)) {
|
||||
const chapterName = loadedCheerio(this).text();
|
||||
const releaseDate = null;
|
||||
|
||||
const chapter = {
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
};
|
||||
|
||||
novelChapters.push(chapter);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (loadedCheerio(this).text().includes('Género:')) {
|
||||
novel.genres = loadedCheerio(this)
|
||||
.text()
|
||||
.replace(/Género: |\s/g, '');
|
||||
}
|
||||
|
||||
novel.chapters = novelChapters;
|
||||
if (loadedCheerio(this).text().includes('Sinopsis:')) {
|
||||
novel.summary = loadedCheerio(this).next().text();
|
||||
}
|
||||
});
|
||||
|
||||
return novel;
|
||||
}
|
||||
async parseChapter(chapterUrl: string): Promise<string> {
|
||||
const url = chapterUrl;
|
||||
let novelChapters: Plugin.ChapterItem[] = [];
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
if (loadedCheerio('.entry-content').find('li').length) {
|
||||
loadedCheerio('.entry-content')
|
||||
.find('li')
|
||||
.each(function () {
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
let loadedCheerio = parseHTML(body);
|
||||
let chapterText = loadedCheerio(".entry-content").html() || '';
|
||||
if (chapterUrl && chapterUrl.includes(baseUrl)) {
|
||||
const chapterName = loadedCheerio(this).text();
|
||||
const releaseDate = null;
|
||||
|
||||
return chapterText;
|
||||
}
|
||||
async searchNovels(searchTerm: string, pageNo: number): Promise<Plugin.NovelItem[]> {
|
||||
searchTerm = searchTerm.toLowerCase();
|
||||
const chapter = {
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
};
|
||||
|
||||
let url = baseUrl;
|
||||
novelChapters.push(chapter);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
loadedCheerio('.entry-content')
|
||||
.find('p')
|
||||
.each(function () {
|
||||
let chapterUrl = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
if (chapterUrl && chapterUrl.includes(baseUrl)) {
|
||||
const chapterName = loadedCheerio(this).text();
|
||||
const releaseDate = null;
|
||||
|
||||
let loadedCheerio = parseHTML(body);
|
||||
const chapter = {
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
};
|
||||
|
||||
let novels: Plugin.NovelItem[] = [];
|
||||
|
||||
loadedCheerio(".menu-item-2869")
|
||||
.find(".menu-item.menu-item-type-post_type.menu-item-object-post")
|
||||
.each(function () {
|
||||
const novelName = loadedCheerio(this).text();
|
||||
const novelCover = loadedCheerio(this).find("img").attr("src");
|
||||
|
||||
let novelUrl = loadedCheerio(this).find("a").attr("href");
|
||||
if (!novelUrl) return;
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
novels = novels.filter((novel) =>
|
||||
novel.name.toLowerCase().includes(searchTerm)
|
||||
);
|
||||
|
||||
return novels;
|
||||
}
|
||||
fetchImage(url: string): Promise<string | undefined> {
|
||||
return fetchFile(url);
|
||||
novelChapters.push(chapter);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
novel.chapters = novelChapters;
|
||||
|
||||
return novel;
|
||||
}
|
||||
async parseChapter(chapterUrl: string): Promise<string> {
|
||||
const url = chapterUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = parseHTML(body);
|
||||
let chapterText = loadedCheerio('.entry-content').html() || '';
|
||||
|
||||
return chapterText;
|
||||
}
|
||||
async searchNovels(
|
||||
searchTerm: string,
|
||||
pageNo: number,
|
||||
): Promise<Plugin.NovelItem[]> {
|
||||
searchTerm = searchTerm.toLowerCase();
|
||||
|
||||
let url = baseUrl;
|
||||
|
||||
const result = await fetchApi(url);
|
||||
const body = await result.text();
|
||||
|
||||
let loadedCheerio = parseHTML(body);
|
||||
|
||||
let novels: Plugin.NovelItem[] = [];
|
||||
|
||||
loadedCheerio('.menu-item-2869')
|
||||
.find('.menu-item.menu-item-type-post_type.menu-item-object-post')
|
||||
.each(function () {
|
||||
const novelName = loadedCheerio(this).text();
|
||||
const novelCover = loadedCheerio(this).find('img').attr('src');
|
||||
|
||||
let novelUrl = loadedCheerio(this).find('a').attr('href');
|
||||
if (!novelUrl) return;
|
||||
|
||||
const novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
novels.push(novel);
|
||||
});
|
||||
|
||||
novels = novels.filter(novel =>
|
||||
novel.name.toLowerCase().includes(searchTerm),
|
||||
);
|
||||
|
||||
return novels;
|
||||
}
|
||||
fetchImage(url: string): Promise<string | undefined> {
|
||||
return fetchFile(url);
|
||||
}
|
||||
}
|
||||
|
||||
export default new Yuuki();
|
||||
|
||||
Reference in New Issue
Block a user