From d3313a460ee26ee4c21c301ed12b784bca0f1905 Mon Sep 17 00:00:00 2001 From: Batorian <53831711+Batorian@users.noreply.github.com> Date: Sun, 19 Oct 2025 06:44:56 +0200 Subject: [PATCH] feat: Add AkuTranslations to Novel Updates (#1842) * added AkuTranslations * sort content into

elements * remove a
element when joining * fix line breaks * revert test versions --- src/plugins/english/novelupdates.ts | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/plugins/english/novelupdates.ts b/src/plugins/english/novelupdates.ts index 22e9a9b..e59d803 100644 --- a/src/plugins/english/novelupdates.ts +++ b/src/plugins/english/novelupdates.ts @@ -6,7 +6,7 @@ import { Plugin } from '@typings/plugin'; class NovelUpdates implements Plugin.PluginBase { id = 'novelupdates'; name = 'Novel Updates'; - version = '0.9.3'; + version = '0.9.4'; icon = 'src/en/novelupdates/icon.png'; customCSS = 'src/en/novelupdates/customCSS.css'; site = 'https://www.novelupdates.com/'; @@ -172,6 +172,29 @@ class NovelUpdates implements Plugin.PluginBase { const targetDomain = domain.find(d => !unwanted.includes(d)); switch (targetDomain) { + // Last edited in 0.9.4 by Batorian - 15/10/2025 + case 'akutranslations': { + try { + const apiUrl = chapterPath.replace('/novel', '/api/novel'); + const response = await fetchApi(apiUrl); + const json = await response.json(); + + if (!json?.content) { + throw new Error('Invalid API response structure.'); + } + + chapterContent = json.content + .trim() + .split(/\n+/) + .map((p: string) => p.trim()) + .filter((p: string) => p.length > 0) + .map((p: string) => `

${p}

`) + .join('\n'); + break; + } catch (error) { + throw new Error(`Failed to parse AkuTranslations chapter: ${error}`); + } + } // Last edited in 0.9.0 by Batorian - 19/03/2025 case 'anotivereads': { chapterTitle = loadedCheerio('#comic-nav-name').first().text(); @@ -289,10 +312,6 @@ class NovelUpdates implements Plugin.PluginBase { const url = `${parts[0]}//${parts[2]}/api/public/chapter-by-slug/${novelSlug}/${chapterSlug}`; const response = await fetchApi(url); - if (!response.ok) { - throw new Error(`Failed to fetch chapter: ${response.status}`); - } - const json = await response.json(); if (!json?.data?.currentChapter) { throw new Error('Invalid API response structure.');