From a72ab256f789e2da1a09c8d4c5d5fb87091eba18 Mon Sep 17 00:00:00 2001 From: Justin COLLON <48163201+error7404@users.noreply.github.com> Date: Thu, 30 May 2024 18:41:49 +0200 Subject: [PATCH] Fix(Madara & lighnovelwp): remove site url regardless of this.site (#965) * remove site url regardless of this.site & riwyat new url * MTL-Novel fix empty novels --- scripts/multisrc/lightnovelwp/template.ts | 6 +++--- scripts/multisrc/madara/sources.json | 7 ++++--- scripts/multisrc/madara/template.ts | 11 ++++++++--- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/scripts/multisrc/lightnovelwp/template.ts b/scripts/multisrc/lightnovelwp/template.ts index 0052558..4dc74a1 100644 --- a/scripts/multisrc/lightnovelwp/template.ts +++ b/scripts/multisrc/lightnovelwp/template.ts @@ -81,7 +81,7 @@ class LightNovelWPPlugin implements Plugin.PluginBase { novels.push({ name: novelName, cover: image.attr('data-src') || image.attr('src') || defaultCover, - path: novelUrl.replace(this.site, ''), + path: novelUrl.replace(/https?:\/\/.*?\//, '/'), }); } }); @@ -113,7 +113,7 @@ class LightNovelWPPlugin implements Plugin.PluginBase { const $ = await this.getCheerio(this.site + novelPath, false); const novel: Plugin.SourceNovel = { - path: novelPath.replace(this.site, ''), + path: novelPath.replace(/https?:\/\/.*?\//, '/'), name: 'Untitled', }; @@ -242,7 +242,7 @@ class LightNovelWPPlugin implements Plugin.PluginBase { if (isFreeChapter) chapters.push({ name: chapterName, - path: chapterUrl.replace(this.site, ''), + path: chapterUrl.replace(/https?:\/\/.*?\//, '/'), releaseTime: releaseTime, }); }); diff --git a/scripts/multisrc/madara/sources.json b/scripts/multisrc/madara/sources.json index 9aeba75..782b82c 100644 --- a/scripts/multisrc/madara/sources.json +++ b/scripts/multisrc/madara/sources.json @@ -134,12 +134,12 @@ }, { "id": "riwyat", - "sourceSite": "https://riwyat.com/", + "sourceSite": "https://riwyat.org/", "sourceName": "Riwyat", "options": { "useNewChapterEndpoint": true, "lang": "Arabic", - "versionIncrements": 1 + "versionIncrements": 2 } }, { @@ -184,7 +184,8 @@ "sourceSite": "https://mtl-novel.com/", "sourceName": "MTL-Novel", "options": { - "useNewChapterEndpoint": true + "useNewChapterEndpoint": false, + "versionIncrements": 1 } }, { diff --git a/scripts/multisrc/madara/template.ts b/scripts/multisrc/madara/template.ts index 82eb3eb..5992e67 100644 --- a/scripts/multisrc/madara/template.ts +++ b/scripts/multisrc/madara/template.ts @@ -69,7 +69,12 @@ class MadaraPlugin implements Plugin.PluginBase { : letter; }) .join(''); - $el.html($el.html()?.replace($el.text(), reversedLetters).replace('\n', '
') || ''); + $el.html( + $el + .html() + ?.replace($el.text(), reversedLetters) + .replace('\n', '
') || '', + ); }); } return text; @@ -125,7 +130,7 @@ class MadaraPlugin implements Plugin.PluginBase { const novel: Plugin.NovelItem = { name: novelName, cover: novelCover, - path: novelUrl.replace(this.site, ''), + path: novelUrl.replace(/https?:\/\/.*?\//, '/'), }; novels.push(novel); }, @@ -249,7 +254,7 @@ class MadaraPlugin implements Plugin.PluginBase { chapters.push({ name: chapterName, - path: chapterUrl.replace(this.site, ''), + path: chapterUrl.replace(/https?:\/\/.*?\//, '/'), releaseTime: releaseDate || null, chapterNumber: totalChapters - chapterIndex, });