diff --git a/icons/src/es/hasutl/icon.jpg b/icons/src/es/hasutl/icon.jpg new file mode 100644 index 0000000..50c1464 Binary files /dev/null and b/icons/src/es/hasutl/icon.jpg differ diff --git a/icons/src/es/novelasligera/icon.png b/icons/src/es/novelasligera/icon.png new file mode 100644 index 0000000..609f287 Binary files /dev/null and b/icons/src/es/novelasligera/icon.png differ diff --git a/icons/src/es/oasistranslations/icon.png b/icons/src/es/oasistranslations/icon.png new file mode 100644 index 0000000..c4a05c4 Binary files /dev/null and b/icons/src/es/oasistranslations/icon.png differ diff --git a/icons/src/es/reinowuxia/icon.png b/icons/src/es/reinowuxia/icon.png new file mode 100644 index 0000000..af71fa4 Binary files /dev/null and b/icons/src/es/reinowuxia/icon.png differ diff --git a/icons/src/es/skynovels/icon.png b/icons/src/es/skynovels/icon.png new file mode 100644 index 0000000..7d5cfb2 Binary files /dev/null and b/icons/src/es/skynovels/icon.png differ diff --git a/icons/src/es/yuukitls/icon.png b/icons/src/es/yuukitls/icon.png new file mode 100644 index 0000000..277b7d7 Binary files /dev/null and b/icons/src/es/yuukitls/icon.png differ diff --git a/icons/src/pt/lightnovelbrasil/icon.png b/icons/src/pt/lightnovelbrasil/icon.png new file mode 100644 index 0000000..dcabe5b Binary files /dev/null and b/icons/src/pt/lightnovelbrasil/icon.png differ diff --git a/plugins/portuguese/lightnovelbrasil.broken.ts b/plugins/portuguese/lightnovelbrasil.ts similarity index 87% rename from plugins/portuguese/lightnovelbrasil.broken.ts rename to plugins/portuguese/lightnovelbrasil.ts index b5760bc..64d69a8 100644 --- a/plugins/portuguese/lightnovelbrasil.broken.ts +++ b/plugins/portuguese/lightnovelbrasil.ts @@ -6,7 +6,7 @@ import { Plugin } from '@typings/plugin'; class LightNovelBrasil implements Plugin.PluginBase { id = 'lightnovelbrasil'; name = 'Light Novel Brasil'; - icon = 'multisrc/wpmangastream/icons/lightnovelbrasil.png'; + icon = 'src/pt/lightnovelbrasil/icon.png'; site = 'https://lightnovelbrasil.com/'; version = '1.0.0'; @@ -35,19 +35,19 @@ class LightNovelBrasil implements Plugin.PluginBase { const novels: Plugin.NovelItem[] = []; - loadedCheerio('article.bs').each(function () { - const novelName = loadedCheerio(this).find('.ntitle').text().trim(); - let image = loadedCheerio(this).find('img'); + loadedCheerio('article.bs').each((idx, ele) => { + const novelName = loadedCheerio(ele).find('.ntitle').text().trim(); + let image = loadedCheerio(ele).find('img'); const novelCover = image.attr('data-src') || image.attr('src'); - const novelUrl = loadedCheerio(this).find('a').attr('href'); + const novelUrl = loadedCheerio(ele).find('a').attr('href'); if (!novelUrl) return; const novel = { name: novelName, cover: novelCover, - url: novelUrl, + path: novelUrl.replace(this.site, ''), }; novels.push(novel); @@ -56,8 +56,8 @@ class LightNovelBrasil implements Plugin.PluginBase { return novels; } - async parseNovelAndChapters(novelUrl: string): Promise { - const url = novelUrl; + async parseNovel(novelPath: string): Promise { + const url = this.site + novelPath; const headers = new Headers(); const result = await fetchApi(url, { headers }); const body = await result.text(); @@ -65,12 +65,11 @@ class LightNovelBrasil implements Plugin.PluginBase { let loadedCheerio = parseHTML(body); const novel: Plugin.SourceNovel = { - url, + path: novelPath, + name: loadedCheerio('.entry-title').text(), chapters: [], }; - novel.name = loadedCheerio('.entry-title').text(); - novel.cover = loadedCheerio('img.wp-post-image').attr('data-src') || loadedCheerio('img.wp-post-image').attr('src'); @@ -103,22 +102,22 @@ class LightNovelBrasil implements Plugin.PluginBase { loadedCheerio('.eplister') .find('li') - .each(function () { + .each((idx, ele) => { const chapterName = - loadedCheerio(this).find('.epl-num').text() + + loadedCheerio(ele).find('.epl-num').text() + ' - ' + - loadedCheerio(this).find('.epl-title').text(); + loadedCheerio(ele).find('.epl-title').text(); - const releaseDate = loadedCheerio(this).find('.epl-date').text().trim(); + const releaseDate = loadedCheerio(ele).find('.epl-date').text().trim(); - const chapterUrl = loadedCheerio(this).find('a').attr('href'); + const chapterUrl = loadedCheerio(ele).find('a').attr('href'); if (!chapterUrl) return; chapter.push({ name: chapterName, releaseTime: releaseDate, - url: chapterUrl, + path: chapterUrl.replace(this.site, ''), }); }); @@ -126,9 +125,9 @@ class LightNovelBrasil implements Plugin.PluginBase { return novel; } - async parseChapter(chapterUrl: string): Promise { + async parseChapter(chapterPath: string): Promise { const headers = new Headers(); - const result = await fetchApi(chapterUrl, { headers }); + const result = await fetchApi(this.site + chapterPath, { headers }); const body = await result.text(); const loadedCheerio = parseHTML(body); @@ -151,15 +150,15 @@ class LightNovelBrasil implements Plugin.PluginBase { const novels: Plugin.NovelItem[] = []; - loadedCheerio('article.bs').each(function () { - const novelName = loadedCheerio(this).find('.ntitle').text().trim(); - const novelCover = loadedCheerio(this).find('img').attr('src'); - const novelUrl = loadedCheerio(this).find('a').attr('href'); + loadedCheerio('article.bs').each((idx, ele) => { + const novelName = loadedCheerio(ele).find('.ntitle').text().trim(); + const novelCover = loadedCheerio(ele).find('img').attr('src'); + const novelUrl = loadedCheerio(ele).find('a').attr('href'); if (!novelUrl) return; novels.push({ name: novelName, - url: novelUrl, + path: novelUrl.replace(this.site, ''), cover: novelCover, }); }); diff --git a/plugins/spanish/hasutl.broken.ts b/plugins/spanish/hasutl.ts similarity index 67% rename from plugins/spanish/hasutl.broken.ts rename to plugins/spanish/hasutl.ts index ff385c6..bd45c37 100644 --- a/plugins/spanish/hasutl.broken.ts +++ b/plugins/spanish/hasutl.ts @@ -6,16 +6,15 @@ import { Filters } from '@libs/filterInputs'; class HasulTL implements Plugin.PluginBase { id = 'HasuTL'; name = 'Hasu Translations'; - icon = 'src/es/hasutl/icon.png'; + icon = 'src/es/hasutl/icon.jpg'; site = 'https://hasutl.wordpress.com/'; - filters?: Filters | undefined; version = '1.0.0'; - baseUrl = this.site; + async popularNovels( pageNo: number, options: Plugin.PopularNovelsOptions, ): Promise { - let url = this.baseUrl + 'light-novels-activas/'; + let url = this.site + 'light-novels-activas/'; const result = await fetch(url); const body = await result.text(); @@ -24,11 +23,11 @@ class HasulTL implements Plugin.PluginBase { 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((idx, ele) => { + const novelName = loadedCheerio(ele).find('.wp-block-button').text(); + const novelCover = loadedCheerio(ele).find('img').attr('src'); - let novelUrl = loadedCheerio(this) + let novelUrl = loadedCheerio(ele) .find('.wp-block-button > a') .attr('href'); @@ -37,16 +36,15 @@ class HasulTL implements Plugin.PluginBase { const novel = { name: novelName, cover: novelCover, - url: novelUrl, + path: novelUrl.replace(this.site, ''), }; - novels.push(novel); }); return novels; } - async parseNovelAndChapters(novelUrl: string): Promise { - const url = novelUrl; + async parseNovel(novelPath: string): Promise { + const url = this.site + novelPath; const result = await fetch(url); const body = await result.text(); @@ -54,13 +52,9 @@ class HasulTL implements Plugin.PluginBase { let loadedCheerio = parseHTML(body); let novel: Plugin.SourceNovel = { - url, + path: novelPath, + name: loadedCheerio('.post-header').text(), }; - - 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()!; @@ -70,19 +64,19 @@ class HasulTL implements Plugin.PluginBase { loadedCheerio('.wp-block-media-text__content') .find('a') - .each(function () { - const chapterName = loadedCheerio(this).text().trim(); + .each((idx, ele) => { + const chapterName = loadedCheerio(ele).text().trim(); const releaseDate = null; - let chapterUrl = loadedCheerio(this).attr('href'); + let chapterUrl = loadedCheerio(ele).attr('href'); if (!chapterUrl) return; const chapter = { name: chapterName, releaseTime: releaseDate, - url: chapterUrl, + path: chapterUrl.replace(this.site, ''), }; novelChapters.push(chapter); @@ -92,8 +86,8 @@ class HasulTL implements Plugin.PluginBase { return novel; } - async parseChapter(chapterUrl: string): Promise { - const url = chapterUrl; + async parseChapter(chapterPath: string): Promise { + const url = this.site + chapterPath; const result = await fetch(url); const body = await result.text(); @@ -108,7 +102,7 @@ class HasulTL implements Plugin.PluginBase { searchTerm: string, pageNo: number, ): Promise { - const url = `${this.baseUrl}?s=${searchTerm}&post_type=wp-manga`; + const url = `${this.site}?s=${searchTerm}&post_type=wp-manga`; const result = await fetch(url); const body = await result.text(); @@ -117,23 +111,23 @@ class HasulTL implements Plugin.PluginBase { let novels: Plugin.NovelItem[] = []; - loadedCheerio('.post-container').each(function () { - const novelName = loadedCheerio(this).find('.post-header').text(); + loadedCheerio('.post-container').each((idx, ele) => { + const novelName = loadedCheerio(ele).find('.post-header').text(); if ( !novelName.includes('Cap') && !novelName.includes('Vol') && !novelName.includes('Light Novels') ) { - const novelCover = loadedCheerio(this).find('img').attr('src'); + const novelCover = loadedCheerio(ele).find('img').attr('src'); - let novelUrl = loadedCheerio(this).find('a').attr('href'); + let novelUrl = loadedCheerio(ele).find('a').attr('href'); if (!novelUrl) return; const novel = { name: novelName, cover: novelCover, - url: novelUrl, + path: novelUrl.replace(this.site, ''), }; novels.push(novel); diff --git a/plugins/spanish/novelasligera.broken.ts b/plugins/spanish/novelasligera.ts similarity index 76% rename from plugins/spanish/novelasligera.broken.ts rename to plugins/spanish/novelasligera.ts index 132c5fb..766b63a 100644 --- a/plugins/spanish/novelasligera.broken.ts +++ b/plugins/spanish/novelasligera.ts @@ -4,18 +4,18 @@ import { Plugin } from '@typings/plugin'; import { Filters } from '@libs/filterInputs'; class Ligera implements Plugin.PluginBase { - id = 'ligera.com'; + id = 'novelasligera'; 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, ): Promise { - let url = this.baseUrl; + let url = this.site; const result = await fetch(url); const body = await result.text(); @@ -24,21 +24,21 @@ class Ligera implements Plugin.PluginBase { let novels: Plugin.NovelItem[] = []; - loadedCheerio('.elementor-column').each(function () { - const novelName = loadedCheerio(this) + loadedCheerio('.elementor-column').each((idx, ele) => { + const novelName = loadedCheerio(ele) .find('.widget-image-caption.wp-caption-text') .text(); if (novelName) { - const novelCover = loadedCheerio(this) + const novelCover = loadedCheerio(ele) .find('a > img') .attr('data-lazy-src'); - let novelUrl = loadedCheerio(this).find('a').attr('href'); + let novelUrl = loadedCheerio(ele).find('a').attr('href'); if (!novelUrl) return; const novel = { name: novelName, cover: novelCover, - url: novelUrl, + path: novelUrl.replace(this.site, ''), }; novels.push(novel); @@ -47,8 +47,8 @@ class Ligera implements Plugin.PluginBase { return novels; } - async parseNovelAndChapters(novelUrl: string): Promise { - const url = this.baseUrl + 'novela/' + novelUrl; + async parseNovel(novelPath: string): Promise { + const url = this.site + novelPath; // console.log(url); @@ -57,13 +57,14 @@ class Ligera implements Plugin.PluginBase { let loadedCheerio = parseHTML(body); - let novel: Plugin.SourceNovel = { url }; - - novel.name = loadedCheerio('h1').text(); + let novel: Plugin.SourceNovel = { + path: novelPath, + name: loadedCheerio('h1').text(), + }; novel.cover = loadedCheerio('.elementor-widget-container') .find('img') - .attr('src'); + .attr('data-lazy-src'); loadedCheerio('.elementor-row') .find('p') @@ -97,15 +98,15 @@ class Ligera implements Plugin.PluginBase { loadedCheerio('.elementor-tab-content') .find('li') - .each(function () { - const chapterName = loadedCheerio(this).text(); + .each((idx, ele) => { + const chapterName = loadedCheerio(ele).text(); const releaseDate = null; - const chapterUrl = loadedCheerio(this).find('a').attr('href'); + const chapterUrl = loadedCheerio(ele).find('a').attr('href'); if (!chapterUrl) return; const chapter = { name: chapterName, releaseTime: releaseDate, - url: chapterUrl, + path: chapterUrl.replace(this.site, ''), }; novelChapters.push(chapter); @@ -115,8 +116,8 @@ class Ligera implements Plugin.PluginBase { return novel; } - async parseChapter(chapterUrl: string): Promise { - const url = chapterUrl; + async parseChapter(chapterPath: string): Promise { + const url = this.site + chapterPath; // console.log(url); const result = await fetch(url); @@ -136,7 +137,7 @@ class Ligera implements Plugin.PluginBase { searchTerm: string, pageNo: number, ): Promise { - const url = this.baseUrl + '?s=' + searchTerm + '&post_type=wp-manga'; + const url = this.site + '?s=' + searchTerm + '&post_type=wp-manga'; // console.log(url); const result = await fetch(url); @@ -146,9 +147,9 @@ class Ligera implements Plugin.PluginBase { 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'); + loadedCheerio('.inside-article').each((idx, ele) => { + const novelCover = loadedCheerio(ele).find('img').attr('src'); + let novelUrl = loadedCheerio(ele).find('a').attr('href'); let novelName; @@ -165,7 +166,7 @@ class Ligera implements Plugin.PluginBase { const novel = { name: novelName, cover: novelCover, - url: novelUrl, + path: novelUrl.replace(this.site, ''), }; novels.push(novel); diff --git a/plugins/spanish/novelawuxia.broken.ts b/plugins/spanish/novelawuxia.ts similarity index 77% rename from plugins/spanish/novelawuxia.broken.ts rename to plugins/spanish/novelawuxia.ts index 0b97d68..e160f55 100644 --- a/plugins/spanish/novelawuxia.broken.ts +++ b/plugins/spanish/novelawuxia.ts @@ -5,13 +5,12 @@ import { defaultCover } from '@libs/defaultCover'; import { Filters } from '@libs/filterInputs'; class ReinoWuxia implements Plugin.PluginBase { - id = 'awuxia.com'; + id = 'reinowuxia'; name = 'ReinoWuxia'; - icon = 'src/es/novelawuxia/icon.png'; + icon = 'src/es/reinowuxia/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()); } @@ -19,7 +18,7 @@ class ReinoWuxia implements Plugin.PluginBase { pageNo: number, options: Plugin.PopularNovelsOptions, ): Promise { - let url = this.baseUrl + 'p/todas-las-novelas.html'; + let url = this.site + 'p/todas-las-novelas.html'; const result = await fetchApi(url, { method: 'GET', @@ -48,7 +47,7 @@ class ReinoWuxia implements Plugin.PluginBase { const novel = { name: novelName, cover: novelCover, - url: novelUrl, + path: novelUrl.replace(this.site, ''), }; novels.push(novel); @@ -56,17 +55,18 @@ class ReinoWuxia implements Plugin.PluginBase { return novels; } - async parseNovelAndChapters(novelUrl: string): Promise { - const url = novelUrl; + async parseNovel(novelPath: string): Promise { + const url = this.site + novelPath; const result = await fetchApi(url); const body = await result.text(); let loadedCheerio = parseHTML(body); - let novel: Plugin.SourceNovel = { url }; - - novel.name = loadedCheerio('h1.post-title').text().trim(); + let novel: Plugin.SourceNovel = { + path: novelPath, + name: loadedCheerio('h1.post-title').text().trim(), + }; novel.cover = loadedCheerio('div.separator').find('a').attr('href'); @@ -94,13 +94,17 @@ class ReinoWuxia implements Plugin.PluginBase { let novelChapters: Plugin.ChapterItem[] = []; - loadedCheerio('div').each(function () { - const detailName = loadedCheerio(this).text(); + loadedCheerio('div').each((idx, rootEle) => { + const detailName = loadedCheerio(rootEle).text(); if (detailName.includes('Sinopsis')) { novel.summary = - loadedCheerio(this).next().text() !== '' - ? loadedCheerio(this).next().text().replace('Sinopsis', '').trim() - : loadedCheerio(this) + loadedCheerio(rootEle).next().text() !== '' + ? loadedCheerio(rootEle) + .next() + .text() + .replace('Sinopsis', '') + .trim() + : loadedCheerio(rootEle) .next() .next() .text() @@ -109,22 +113,25 @@ class ReinoWuxia implements Plugin.PluginBase { } if (detailName.includes('Lista de CapĂ­tulos')) { - loadedCheerio(this) + loadedCheerio(rootEle) .find('a') - .each(function (res) { - const chapterName = loadedCheerio(this).text(); - let chapterUrl = loadedCheerio(this).attr('href'); + .each((idx, ele) => { + const chapterName = loadedCheerio(ele).text(); + const chapterPath = loadedCheerio(ele) + .attr('href') + ?.replace(this.site, ''); const releaseDate = null; if ( chapterName && - chapterUrl && + chapterPath && + chapterPath !== '/' && !novelChapters.some(chap => chap.name === chapterName) ) { const chapter = { name: chapterName, releaseTime: releaseDate, - url: chapterUrl, + path: chapterPath, }; novelChapters.push(chapter); @@ -137,8 +144,8 @@ class ReinoWuxia implements Plugin.PluginBase { return novel; } - async parseChapter(chapterUrl: string): Promise { - const url = chapterUrl; + async parseChapter(chapterPath: string): Promise { + const url = this.site + chapterPath; const result = await fetchApi(url); const body = await result.text(); @@ -153,7 +160,7 @@ class ReinoWuxia implements Plugin.PluginBase { searchTerm: string, pageNo: number, ): Promise { - const url = `${this.baseUrl}search?q=${searchTerm}`; + const url = `${this.site}search?q=${searchTerm}`; const result = await fetchApi(url); const body = await result.text(); @@ -183,7 +190,7 @@ class ReinoWuxia implements Plugin.PluginBase { const novel = { name: novelName, cover: novelCover, - url: novelUrl, + path: novelUrl.replace(this.site, ''), }; novels.push(novel); diff --git a/plugins/spanish/oasistranslations.broken.ts b/plugins/spanish/oasistranslations.ts similarity index 70% rename from plugins/spanish/oasistranslations.broken.ts rename to plugins/spanish/oasistranslations.ts index 4be244c..5d7616d 100644 --- a/plugins/spanish/oasistranslations.broken.ts +++ b/plugins/spanish/oasistranslations.ts @@ -2,17 +2,8 @@ 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'; - -const baseUrl = site; - class Oasis implements Plugin.PluginBase { - id = 'oasisTL.wp'; + id = 'oasistranslations'; name = 'Oasis Translations'; site = 'https://oasistranslations.wordpress.com/'; version = '1.0.0'; @@ -22,7 +13,7 @@ class Oasis implements Plugin.PluginBase { pageNo: number, options: Plugin.PopularNovelsOptions, ): Promise { - let url = baseUrl; + let url = this.site; const result = await fetchApi(url); const body = await result.text(); @@ -33,19 +24,19 @@ class Oasis implements Plugin.PluginBase { loadedCheerio('.menu-item-1819') .find('.sub-menu > li') - .each(function () { - const novelName = loadedCheerio(this).text(); + .each((idx, ele) => { + const novelName = loadedCheerio(ele).text(); if (!novelName.match(/Activas|Finalizadas|Dropeadas/)) { - const novelCover = loadedCheerio(this).find('img').attr('src'); + const novelCover = loadedCheerio(ele).find('img').attr('src'); - let novelUrl = loadedCheerio(this).find('a').attr('href'); + let novelUrl = loadedCheerio(ele).find('a').attr('href'); if (!novelUrl) return; const novel = { name: novelName, cover: novelCover, - url: novelUrl, + path: novelUrl.replace(this.site, ''), }; novels.push(novel); @@ -54,21 +45,21 @@ class Oasis implements Plugin.PluginBase { return novels; } - async parseNovelAndChapters(novelUrl: string): Promise { - const url = novelUrl; + async parseNovel(novelPath: string): Promise { + const url = this.site + novelPath; 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(); - + let novel: Plugin.SourceNovel = { + path: novelPath, + name: loadedCheerio('h1.entry-title') + .text() + .replace(/[\t\n]/g, '') + .trim(), + }; novel.cover = loadedCheerio('img[loading="lazy"]').attr('src'); loadedCheerio('.entry-content > p').each(function (res) { @@ -94,17 +85,17 @@ class Oasis implements Plugin.PluginBase { // if ($(".entry-content").find("li").length) { loadedCheerio('.entry-content') .find('a') - .each(function () { - let chapterUrl = loadedCheerio(this).attr('href'); + .each((idx, ele) => { + let chapterUrl = loadedCheerio(ele).attr('href'); - if (chapterUrl && chapterUrl.includes(baseUrl)) { - const chapterName = loadedCheerio(this).text(); + if (chapterUrl && chapterUrl.includes(this.site)) { + const chapterName = loadedCheerio(ele).text(); const releaseDate = null; const chapter = { name: chapterName, releaseTime: releaseDate, - url: chapterUrl, + path: chapterUrl.replace(this.site, ''), }; novelChapters.push(chapter); @@ -115,8 +106,8 @@ class Oasis implements Plugin.PluginBase { return novel; } - async parseChapter(chapterUrl: string): Promise { - const url = chapterUrl; + async parseChapter(chapterPath: string): Promise { + const url = this.site + chapterPath; const result = await fetchApi(url); const body = await result.text(); @@ -135,7 +126,7 @@ class Oasis implements Plugin.PluginBase { ): Promise { searchTerm = searchTerm.toLowerCase(); - let url = baseUrl; + let url = this.site; const result = await fetchApi(url); const body = await result.text(); @@ -145,19 +136,19 @@ class Oasis implements Plugin.PluginBase { let novels: Plugin.NovelItem[] = []; loadedCheerio('.menu-item-1819') .find('.sub-menu > li') - .each(function () { - const novelName = loadedCheerio(this).text(); + .each((idx, ele) => { + const novelName = loadedCheerio(ele).text(); if (!novelName.match(/Activas|Finalizadas|Dropeadas/)) { - const novelCover = loadedCheerio(this).find('img').attr('src'); + const novelCover = loadedCheerio(ele).find('img').attr('src'); - let novelUrl = loadedCheerio(this).find('a').attr('href'); + let novelUrl = loadedCheerio(ele).find('a').attr('href'); if (!novelUrl) return; const novel = { name: novelName, cover: novelCover, - url: novelUrl, + path: novelUrl.replace(this.site, ''), }; novels.push(novel); diff --git a/plugins/spanish/skynovels.broken.ts b/plugins/spanish/skynovels.ts similarity index 88% rename from plugins/spanish/skynovels.broken.ts rename to plugins/spanish/skynovels.ts index c952dce..d0b8a5b 100644 --- a/plugins/spanish/skynovels.broken.ts +++ b/plugins/spanish/skynovels.ts @@ -3,12 +3,11 @@ import { Filters } from '@libs/filterInputs'; import { Plugin } from '@typings/plugin'; class SkyNovels implements Plugin.PluginBase { - id = 'skynovels.net'; + id = 'skynovels'; name = 'SkyNovels'; site = 'https://www.skynovels.net/'; version = '1.0.0'; icon = 'src/es/skynovels/icon.png'; - baseUrl = this.site; async popularNovels( pageNo: number, @@ -27,18 +26,17 @@ class SkyNovels implements Plugin.PluginBase { 'https://api.skynovels.net/api/get-image/' + res.image + '/novels/false'; - const novelUrl = - this.baseUrl + 'novelas/' + res.id + '/' + res.nvl_name + '/'; + const path = 'novelas/' + res.id + '/' + res.nvl_name + '/'; - const novel = { name: novelName, url: novelUrl, cover: novelCover }; + const novel = { name: novelName, path, cover: novelCover }; novels.push(novel); }); return novels; } - async parseNovelAndChapters(novelUrl: string): Promise { - const novelId = novelUrl.split('/')[4]; + async parseNovel(novelPath: string): Promise { + const novelId = novelPath.split('/')[1]; const url = 'https://api.skynovels.net/api/novel/' + novelId + '/reading?&q'; @@ -47,9 +45,10 @@ class SkyNovels implements Plugin.PluginBase { const item = body?.novel?.[0]; - let novel: Plugin.SourceNovel = { url: novelUrl }; - - novel.name = item?.nvl_title; + let novel: Plugin.SourceNovel = { + path: novelPath, + name: item?.nvl_title || 'Untitled', + }; novel.cover = 'https://api.skynovels.net/api/get-image/' + @@ -69,12 +68,12 @@ class SkyNovels implements Plugin.PluginBase { 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 chapterPath = novelPath + chapter.id + '/' + chapter.chp_name; const chap = { name: chapterName, releaseTime: releaseDate, - url: chapterUrl, + path: chapterPath, }; novelChapters.push(chap); @@ -85,8 +84,8 @@ class SkyNovels implements Plugin.PluginBase { return novel; } - async parseChapter(chapterUrl: string): Promise { - let chapterId: string = chapterUrl.split('/')[6]; + async parseChapter(chapterPath: string): Promise { + let chapterId: string = chapterPath.split('/')[3]; const url = `https://api.skynovels.net/api/novel-chapter/${chapterId}`; const result = await fetchApi(url); @@ -120,10 +119,9 @@ class SkyNovels implements Plugin.PluginBase { 'https://api.skynovels.net/api/get-image/' + res.image + '/novels/false'; - const novelUrl = - this.baseUrl + 'novelas/' + res.id + '/' + res.nvl_name + '/'; + const path = 'novelas/' + res.id + '/' + res.nvl_name + '/'; - const novel = { name: novelName, url: novelUrl, cover: novelCover }; + const novel = { name: novelName, path, cover: novelCover }; novels.push(novel); }); diff --git a/plugins/spanish/yukitls.broken.ts b/plugins/spanish/yukitls.ts similarity index 69% rename from plugins/spanish/yukitls.broken.ts rename to plugins/spanish/yukitls.ts index befb3ea..439ccc8 100644 --- a/plugins/spanish/yukitls.broken.ts +++ b/plugins/spanish/yukitls.ts @@ -3,28 +3,19 @@ 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'; - -const baseUrl = site; - class Yuuki implements Plugin.PluginBase { - id = 'yuukitls.com'; + id = 'yuukitls'; 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, ): Promise { - let url = baseUrl; + let url = this.site; const result = await fetchApi(url); const body = await result.text(); @@ -35,18 +26,18 @@ class Yuuki implements Plugin.PluginBase { loadedCheerio('.quadmenu-navbar-collapse ul li:nth-child(2)') .find('li') - .each(function () { - const novelName = loadedCheerio(this) + .each((idx, ele) => { + const novelName = loadedCheerio(ele) .text() .replace(/[\s\n]+/g, ' '); - const novelCover = loadedCheerio(this).find('img').attr('src'); + const novelCover = loadedCheerio(ele).find('img').attr('src'); - let novelUrl = loadedCheerio(this).find('a').attr('href'); + let novelUrl = loadedCheerio(ele).find('a').attr('href'); if (!novelUrl) return; const novel = { name: novelName, cover: novelCover, - url: novelUrl, + path: novelUrl.replace(this.site, ''), }; novels.push(novel); @@ -54,8 +45,8 @@ class Yuuki implements Plugin.PluginBase { return novels; } - async parseNovelAndChapters(novelUrl: string): Promise { - const url = novelUrl; + async parseNovel(novelPath: string): Promise { + const url = this.site + novelPath; const result = await fetchApi(url); const body = await result.text(); @@ -63,14 +54,13 @@ class Yuuki implements Plugin.PluginBase { let loadedCheerio = parseHTML(body); let novel: Plugin.SourceNovel = { - url, + path: novelPath, + 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'); loadedCheerio('.entry-content') @@ -98,17 +88,17 @@ class Yuuki implements Plugin.PluginBase { if (loadedCheerio('.entry-content').find('li').length) { loadedCheerio('.entry-content') .find('li') - .each(function () { - let chapterUrl = loadedCheerio(this).find('a').attr('href'); + .each((idx, ele) => { + let chapterUrl = loadedCheerio(ele).find('a').attr('href'); - if (chapterUrl && chapterUrl.includes(baseUrl)) { - const chapterName = loadedCheerio(this).text(); + if (chapterUrl && chapterUrl.includes(this.site)) { + const chapterName = loadedCheerio(ele).text(); const releaseDate = null; const chapter = { name: chapterName, releaseTime: releaseDate, - url: chapterUrl, + path: chapterUrl.replace(this.site, ''), }; novelChapters.push(chapter); @@ -117,17 +107,17 @@ class Yuuki implements Plugin.PluginBase { } else { loadedCheerio('.entry-content') .find('p') - .each(function () { - let chapterUrl = loadedCheerio(this).find('a').attr('href'); + .each((idx, ele) => { + let chapterUrl = loadedCheerio(ele).find('a').attr('href'); - if (chapterUrl && chapterUrl.includes(baseUrl)) { - const chapterName = loadedCheerio(this).text(); + if (chapterUrl && chapterUrl.includes(this.site)) { + const chapterName = loadedCheerio(ele).text(); const releaseDate = null; const chapter = { name: chapterName, releaseTime: releaseDate, - url: chapterUrl, + path: chapterUrl.replace(this.site, ''), }; novelChapters.push(chapter); @@ -139,8 +129,8 @@ class Yuuki implements Plugin.PluginBase { return novel; } - async parseChapter(chapterUrl: string): Promise { - const url = chapterUrl; + async parseChapter(chapterPath: string): Promise { + const url = this.site + chapterPath; const result = await fetchApi(url); const body = await result.text(); @@ -156,7 +146,7 @@ class Yuuki implements Plugin.PluginBase { ): Promise { searchTerm = searchTerm.toLowerCase(); - let url = baseUrl; + let url = this.site; const result = await fetchApi(url); const body = await result.text(); @@ -167,17 +157,17 @@ class Yuuki implements Plugin.PluginBase { 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'); + .each((idx, ele) => { + const novelName = loadedCheerio(ele).text(); + const novelCover = loadedCheerio(ele).find('img').attr('src'); - let novelUrl = loadedCheerio(this).find('a').attr('href'); + let novelUrl = loadedCheerio(ele).find('a').attr('href'); if (!novelUrl) return; const novel = { name: novelName, cover: novelCover, - url: novelUrl, + path: novelUrl.replace(this.site, ''), }; novels.push(novel); diff --git a/scripts/icon_reloading.ts b/scripts/icon_reloading.ts index 648abd6..3a21a50 100644 --- a/scripts/icon_reloading.ts +++ b/scripts/icon_reloading.ts @@ -57,7 +57,7 @@ used.add(path.join(root, '..', 'icons', 'coverNotAvailable.webp')); if (!skip[id] && icon && site) { const image = await fetch( - `https://www.google.com/s2/favicons?domain=${site}&sz=${size}`, + `https://www.google.com/s2/favicons?domain=${site}&sz=${size}&type=png`, ) .then(res => res.arrayBuffer()) .then(res => Buffer.from(res));