From c170d06106a0e8f9ee8c203f8eb74c0ca8065c04 Mon Sep 17 00:00:00 2001 From: Raiyn Aydin Date: Wed, 11 Nov 2026 06:34:24 +0800 Subject: [PATCH 1/6] feat(spanish): add Novelas Topcur source --- plugins/spanish/novelastopcur.ts | 358 ++++++++++++++++++++ public/static/src/es/novelastopcur/icon.png | Bin 0 -> 1217 bytes 2 files changed, 358 insertions(+) create mode 100644 plugins/spanish/novelastopcur.ts create mode 100644 public/static/src/es/novelastopcur/icon.png diff --git a/plugins/spanish/novelastopcur.ts b/plugins/spanish/novelastopcur.ts new file mode 100644 index 0000000000..bd80e0d67a --- /dev/null +++ b/plugins/spanish/novelastopcur.ts @@ -0,0 +1,358 @@ +import { fetchApi } from '@libs/fetch'; +import { Plugin } from '@/types/plugin'; +import { load as loadCheerio } from 'cheerio'; +import { defaultCover } from '@libs/defaultCover'; +import { NovelStatus } from '@libs/novelStatus'; + +// The site is a Blogger blog: the catalogue is a static page, every novel is a +// static page whose body holds the synopsis and the chapter links, and every +// chapter is a regular post (/YYYY/MM/slug.html). +const SITE_HOST = /^animeshoy12\.blogspot\./i; +const CATALOGUE_PATH = '/p/lista-de-novelas.html'; +const NOVEL_PATH = /^\/p\/[^/]+\.html$/; +const CHAPTER_PATH = /^\/\d{4}\/\d{2}\/[^/]+\.html$/; +// Links to posts that are not chapters (power-level guides and the like) have +// no number in their text. +const CHAPTER_TEXT = /\d|pr[oó]logo|ep[ií]logo|extra|especial|prefacio/i; +// "Anterior - Índice - Siguiente" and the author's donation/sharing lines. +const NAVIGATION = + /^[\s\-–—|]*(?:anterior|[ií]ndice|siguiente|volver)\b[\s\-–—|a-záéíóúñ]*$/i; +const PROMOTION = + /patreon|esponsor|anslid|compart(?:ir|an)\b|ayudar[ií]a mucho|m[aá]s cap[ií]tulos|muchas gracias por todo/i; +const SEPARATOR = /^[\s\-–—_=.·|~*]*$/; +// Left over at the very end of a chapter once the links are gone. +const TRAILING = /^[\s\-–—_=.·|~*]*(?:tambi[eé]n\s*:?)?[\s\-–—_=.·|~*]*$/i; +const SYNOPSIS_START = + /^(?:[^:]{0,40}?[-–]\s*)?(?:leer\s+)?sin[oó]psis\s*\d*\s*:?\s*(.*)$/i; +const SYNOPSIS_STOP = + /^(?:t[ií]tulos?\b|otros\s+t[ií]tulos|nota\b|todos\s+los\s+vol|vol[uú]menes?\b|volumen\b|sin[oó]psis\s*\d|del mismo autor|g[eé]neros?\s*:|autor\s*:|estado\s*:|tipo\s*:)/i; +const LABEL = /^(autor|estado|g[eé]neros?|tipo)\s*:\s*(.*)$/i; +// Two or more consecutive empty blocks (spacing between paragraphs). +const BLANK_BLOCKS = + /(?:<(?:div|p)[^>]*>(?:<(?:span|b|i|u)[^>]*>)*(?:| |\s)*(?:<\/(?:span|b|i|u)>)*<\/(?:div|p)>\s*){2,}/gi; +const SUMMARY_LIMIT = 3000; +const COVER_SIZE = 's400'; + +class NovelasTopcur implements Plugin.PluginBase { + id = 'novelastopcur'; + name = 'Novelas Topcur'; + site = 'https://animeshoy12.blogspot.com'; + icon = 'src/es/novelastopcur/icon.png'; + version = '1.0.0'; + + private async request(path: string) { + const response = await fetchApi(this.resolveUrl(path)); + if (!response.ok) { + throw new Error(`Novelas Topcur: HTTP ${response.status}.`); + } + return response; + } + + private clean(text: string): string { + return text.replace(/[\s\u00a0]+/g, ' ').trim(); + } + + /** Turns an href into a site-relative path, or undefined for other sites. */ + private sitePath(href: string | undefined): string | undefined { + if (!href) return undefined; + try { + const url = new URL(href, this.site); + return SITE_HOST.test(url.hostname) ? url.pathname : undefined; + } catch { + return undefined; + } + } + + /** Blogger serves covers at any size: ask for a sharper one than the grid's. */ + private cover(src: string | undefined): string { + if (!src || src.startsWith('data:') || /notavailable/i.test(src)) { + return defaultCover; + } + return src + .replace(/=(?:[ws]\d+(?:-h\d+)?)(?:-[a-z0-9]+)*$/i, `=${COVER_SIZE}`) + .replace(/\/(?:w\d+-h\d+|s\d+)(?:-[a-z0-9]+)*\//i, `/${COVER_SIZE}/`); + } + + /** "Nano Machine Novela Español" -> "Nano Machine" */ + private title(text: string): string { + return this.clean(text) + .replace(/^\d+\s*\.\s*/, '') + .replace(/\s*\bnovela(?:\s+espa[ñn]ol)?\s*$/i, '') + .replace(/^lista de cap[ií]tulos\s+mga\b/i, 'Martial God Asura') + .trim(); + } + + /** "NANO MACHINE" -> "Nano Machine"; mixed-case titles are left alone. */ + private titleCase(text: string): string { + if (text.length < 5 || text !== text.toUpperCase()) return text; + return text + .toLowerCase() + .replace( + /(^|\s)(\S)/g, + (_, space, letter) => space + letter.toUpperCase(), + ); + } + + private normalize(text: string): string { + return text.toLowerCase().normalize('NFD').replace(/[̀-ͯ]/g, ''); + } + + /** + * The catalogue is one page: every novel appears as a numbered link with its + * cover image linked to the same novel page, in no fixed order. + */ + private async catalogue(): Promise { + const $ = loadCheerio(await (await this.request(CATALOGUE_PATH)).text()); + const entries = new Map< + string, + { parts: string[]; cover: string | undefined } + >(); + $('.post-body a[href]').each((_, link) => { + const path = this.sitePath($(link).attr('href')); + if (!path || !NOVEL_PATH.test(path) || path === CATALOGUE_PATH) return; + const entry = entries.get(path) || { parts: [], cover: undefined }; + const text = this.title($(link).text()); + if (text && !entry.parts.includes(text)) entry.parts.push(text); + entry.cover ||= $(link).find('img').first().attr('src'); + entries.set(path, entry); + }); + const novels: Plugin.NovelItem[] = []; + entries.forEach((entry, path) => { + const name = this.title(entry.parts.join(' ')); + if (!name) return; + novels.push({ name, path, cover: this.cover(entry.cover) }); + }); + return novels; + } + + async popularNovels(pageNo: number): Promise { + // The catalogue is a single page without pagination. + if (pageNo > 1) return []; + return this.catalogue(); + } + + /** Plain-text lines of an HTML fragment, one per block or line break. */ + private lines(fragment: string): string[] { + const text = loadCheerio( + fragment + .replace(//gi, '\n') + .replace(/<\/(?:div|p|li|h\d|tr)>/gi, '\n'), + ).text(); + return text + .split('\n') + .map(line => this.clean(line)) + .filter(Boolean); + } + + private status(text: string | undefined): NovelStatus | undefined { + if (!text) return undefined; + if (/finaliz|complet|termin/i.test(text)) return NovelStatus.Completed; + if (/paus|hiatus/i.test(text)) return NovelStatus.OnHiatus; + if (/cancel|abandon/i.test(text)) return NovelStatus.Cancelled; + if (/activ|en curso|emisi[oó]n|publicando/i.test(text)) { + return NovelStatus.Ongoing; + } + return undefined; + } + + async parseNovel(novelPath: string): Promise { + const $ = loadCheerio(await (await this.request(novelPath)).text()); + const body = $('.post-body').first(); + if (!body.length) { + throw new Error('Novelas Topcur: the novel page has no content.'); + } + + const isChapter = (link: ReturnType) => { + const path = this.sitePath(link.attr('href')); + return ( + !!path && CHAPTER_PATH.test(path) && CHAPTER_TEXT.test(link.text()) + ); + }; + + const seen = new Set(); + const listed: { name: string; path: string }[] = []; + body.find('a[href]').each((_, el) => { + const link = $(el); + if (!isChapter(link)) return; + const path = this.sitePath(link.attr('href'))!; + const name = this.clean(link.text()); + if (!name || seen.has(path)) return; + seen.add(path); + listed.push({ name, path }); + }); + + // Newer novels keep their chapters on other sites; the page only links to + // them. Say so instead of presenting a truncated list as the whole novel. + const elsewhere = new Set(); + body.find('a[href]').each((_, el) => { + try { + const url = new URL($(el).attr('href') || '', this.site); + if ( + !SITE_HOST.test(url.hostname) && + /^\/novela\/|^\/\d{4}\/\d{2}\//.test(url.pathname) + ) { + elsewhere.add(url.hostname.replace(/^www\./i, '')); + } + } catch { + // Ignore malformed links. + } + }); + const hosts = Array.from(elsewhere).join(', '); + if (!listed.length) { + throw new Error( + hosts + ? `Novelas Topcur: los capítulos de esta novela están en ${hosts}, no en este blog.` + : 'Novelas Topcur: no chapters were found.', + ); + } + + // Every title repeats the novel's name ("Nano Machine (Novela) Capitulo + // 1"): drop the prefix shared by most chapters, but keep distinguishing + // ones such as "SPECIAL MGA (Qiang Xuantian) Capitulo 11". + const prefixOf = (name: string) => + /^(.*?)\s*(?=\bcap[ií]tulo\b)/i.exec(name)?.[1] || ''; + const counts = new Map(); + listed.forEach(({ name }) => { + const prefix = prefixOf(name); + if (prefix) counts.set(prefix, (counts.get(prefix) || 0) + 1); + }); + let commonPrefix = ''; + counts.forEach((count, prefix) => { + if (count > (counts.get(commonPrefix) || 0)) commonPrefix = prefix; + }); + const stripPrefix = (counts.get(commonPrefix) || 0) * 2 >= listed.length; + + const chapters: Plugin.ChapterItem[] = listed.map(({ name, path }) => { + let chapterName = + stripPrefix && commonPrefix && prefixOf(name) === commonPrefix + ? name.slice(commonPrefix.length).trim() + : name; + // Some lists only link the number. + if (/^\d+(?:\.\d+)?$/.test(chapterName)) { + chapterName = `Capítulo ${chapterName}`; + } + const number = + /\bcap[ií]tulo\s*(\d+(?:\.\d+)?)/i.exec(name)?.[1] || + /\bC(\d+(?:\.\d+)?)\b/.exec(name)?.[1]; + return { + name: chapterName, + path, + chapterNumber: number ? Number(number) : undefined, + }; + }); + + // Everything before the first chapter link is the novel's description. + const bodyHtml = body.html() || ''; + const firstLink = /]*href="[^"]*\/\d{4}\/\d{2}\/[^"]+"/i.exec( + bodyHtml, + ); + const header = this.lines( + firstLink ? bodyHtml.slice(0, firstLink.index) : bodyHtml, + ); + + const labels: Record = {}; + header.forEach((line, index) => { + const match = LABEL.exec(line); + if (!match) return; + const key = match[1].toLowerCase().replace('é', 'e'); + const value = + match[2] || (LABEL.test(header[index + 1]) ? '' : header[index + 1]); + if (value && !labels[key]) labels[key] = value; + }); + + let summary = ''; + const start = header.findIndex(line => SYNOPSIS_START.test(line)); + if (start >= 0) { + const parts = [SYNOPSIS_START.exec(header[start])![1]]; + for (const line of header.slice(start + 1)) { + if (SYNOPSIS_STOP.test(line) || SEPARATOR.test(line)) break; + parts.push(line); + } + summary = parts.filter(Boolean).join('\n').slice(0, SUMMARY_LIMIT).trim(); + } + + if (hosts) { + summary += `${summary ? '\n\n' : ''}Nota: los capítulos que faltan están en ${hosts}.`; + } + + const name = + this.titleCase( + this.title($('h3.post-title, h1.post-title').first().text()), + ) || + this.title($('title').text()) || + 'Untitled'; + const genres = labels.genero || labels.generos; + + return { + path: novelPath, + name, + cover: this.cover(body.find('img[src]').first().attr('src')), + author: labels.autor, + genres: genres || undefined, + status: this.status(labels.estado), + summary: summary || undefined, + chapters, + }; + } + + async parseChapter(chapterPath: string): Promise { + const $ = loadCheerio(await (await this.request(chapterPath)).text()); + const body = $('.post-body').first(); + body + .find('script, style, noscript, iframe, ins, form, .adsbygoogle') + .remove(); + // Drop the "Anterior - Índice - Siguiente" line and the author's sharing and + // donation lines. Only short blocks are touched so that a wrapper around + // the story text is never removed. + body.find('div, p, span').each((_, el) => { + const text = this.clean($(el).text()); + if ( + text.length < 250 && + (NAVIGATION.test(text) || PROMOTION.test(text)) + ) { + $(el).remove(); + } + }); + // Trim the empty and separator-only blocks left at the end, innermost first. + for (let guard = 0; guard < 100; guard++) { + const last = body + .find('*') + .filter( + (_, el) => + !$(el).children().length && !$(el).is('img, br, hr, figure'), + ) + .last(); + if (!last.length || !TRAILING.test(this.clean(last.text()))) break; + last.remove(); + } + + // The text is spaced with runs of empty blocks: keep a single one. + const chapter = (body.html()?.trim() || '').replace( + BLANK_BLOCKS, + '

', + ); + if (this.clean(loadCheerio(chapter).text()).length < 100) { + throw new Error('Novelas Topcur: no readable chapter text found.'); + } + return chapter; + } + + async searchNovels( + searchTerm: string, + pageNo: number, + ): Promise { + // The blog's own search only finds individual chapter posts, so series are + // matched against the catalogue's titles instead (a single page). + const tokens = this.normalize(searchTerm).split(/\s+/).filter(Boolean); + if (!tokens.length || pageNo > 1) return []; + const novels = await this.catalogue(); + return novels.filter(novel => { + const name = this.normalize(novel.name); + return tokens.every(token => name.includes(token)); + }); + } + + resolveUrl = (path: string) => new URL(path, this.site).href; +} + +export default new NovelasTopcur(); diff --git a/public/static/src/es/novelastopcur/icon.png b/public/static/src/es/novelastopcur/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3ece6433a377c28877f1f34a18b63a044450e844 GIT binary patch literal 1217 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1|%QND7OGo3dtTpz6=aiY77hwEes65fI|H(?D8gRi>Fdh=iknMJ#Q4=_ ztqnjS)e_f;l9a@fRIB8oR3OD*WME{bYiOuzXb@s#WMyPvWooExU|?lnP}AOc14Tn_ zeoAIqC2kG8w=7eD8Z_WGlw{_n7MCRE7U0$sbzWjO0|WCyPZ!6Kid%2*czc8-N*w!` zens!qjEUVx0=!y^0#kHFJU6ulC0KNyFgSC;wUN~=pyaMdtmCd3nE^{uX1HmFMNLfQ zR@T~;m{fMXM@M(P<++~Aht}0ZaTT8{F1aVaU9gc^L9CU`O!aXP3mo*-XPKYV_{q?_#i>!0yd*5vyc7ICldc`;||&)ouY zVt=l$dFQGuw*1|XuXT>s+;n>8to{1+(4?!@AJ;sbd-~k+-?j;NS1q0K=>78V(@k~m zGXI#lcjC->C-&WKbFAcv$c${c@WA0)t~rYrgTB9i&dG>(mx^z_;rnv)&Hq~IuDgbN z&X-%o{#Gy5s~3=4_hUw7#~f?na`~&fpVYjZ&By!t@vFQi2h$(1r0#p0z}R(ab?JV- zE6W$&zP`TUWJ;1=qu+Lhuj^+`xj84&c!GrZ(S2+oyI3`J_O{N8TWxfIOPZuwkNoj{ zd?veC3#{f^6mD~x>CesMaO+dWx6%a{bq}P}$3GDbdk~zxyGTb_^+0s)hu2B-=Fgh?_~f*R?RVz96g%+v_+?-Bdi!rO z*2`tCCl#AX1$<)+HSG`lyufef@#ANlLyqWtGrcI9tGvy6cgBU>zuQVZ^R`+pW?fPH zPi*P+cN)dzx90@LcUerRmb+#*+vxtDYqe(SR~XLf=30c-_|9ba<#njK^#1J3yAKoe zf`h-z=S&xmaf+^9Zgk$m)8W9A#B}UYSt}xb3r%1BZsYWY z+Rm&D4S#p4Zut9nyZAAw!>kp*_p!2yuex#iLhnN+h658Xr@nY0wcFqJf657lcX0d&YN8)JV@L+2KCps|VkcEXpnPfEk>@ M)78&qol`;+01|idYXATM literal 0 HcmV?d00001 From b4a5f452e6597e3e8147b684c21dc10ae1a57e98 Mon Sep 17 00:00:00 2001 From: Raiyn Aydin Date: Wed, 11 Nov 2026 10:12:22 +0800 Subject: [PATCH 2/6] no-mistakes(review): Narrow Topcur promotion filter regex --- plugins/spanish/novelastopcur.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/spanish/novelastopcur.ts b/plugins/spanish/novelastopcur.ts index bd80e0d67a..673bbb9ff8 100644 --- a/plugins/spanish/novelastopcur.ts +++ b/plugins/spanish/novelastopcur.ts @@ -18,7 +18,7 @@ const CHAPTER_TEXT = /\d|pr[oó]logo|ep[ií]logo|extra|especial|prefacio/i; const NAVIGATION = /^[\s\-–—|]*(?:anterior|[ií]ndice|siguiente|volver)\b[\s\-–—|a-záéíóúñ]*$/i; const PROMOTION = - /patreon|esponsor|anslid|compart(?:ir|an)\b|ayudar[ií]a mucho|m[aá]s cap[ií]tulos|muchas gracias por todo/i; + /patreon|esponsor|anslid|compart(?:an|ir)(?:lo)?\s+(?:la\s+)?(?:novela|p[aá]gina|esta)|ayudar[ií]a mucho|m[aá]s cap[ií]tulos\s+(?:gratis|en|:|\()|muchas gracias por todo/i; const SEPARATOR = /^[\s\-–—_=.·|~*]*$/; // Left over at the very end of a chapter once the links are gone. const TRAILING = /^[\s\-–—_=.·|~*]*(?:tambi[eé]n\s*:?)?[\s\-–—_=.·|~*]*$/i; From 0e8dde211701865a334b8f0f11f9357d71cd79a0 Mon Sep 17 00:00:00 2001 From: Raiyn Aydin Date: Wed, 11 Nov 2026 10:13:01 +0800 Subject: [PATCH 3/6] no-mistakes(review): Tighten Topcur promotion filter regex --- plugins/spanish/novelastopcur.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/spanish/novelastopcur.ts b/plugins/spanish/novelastopcur.ts index 673bbb9ff8..821b4490e7 100644 --- a/plugins/spanish/novelastopcur.ts +++ b/plugins/spanish/novelastopcur.ts @@ -18,7 +18,7 @@ const CHAPTER_TEXT = /\d|pr[oó]logo|ep[ií]logo|extra|especial|prefacio/i; const NAVIGATION = /^[\s\-–—|]*(?:anterior|[ií]ndice|siguiente|volver)\b[\s\-–—|a-záéíóúñ]*$/i; const PROMOTION = - /patreon|esponsor|anslid|compart(?:an|ir)(?:lo)?\s+(?:la\s+)?(?:novela|p[aá]gina|esta)|ayudar[ií]a mucho|m[aá]s cap[ií]tulos\s+(?:gratis|en|:|\()|muchas gracias por todo/i; + /patreon|esponsor|anslid|compart(?:an|ir)(?:lo)?\s+(?:la\s+)?(?:novela|p[aá]gina)\b|compart\w*\s+(?:lo\s+)?\S*\s*ayudar[ií]a mucho|m[aá]s cap[ií]tulos\s+(?:gratis|en|:|\()|muchas gracias por todo/i; const SEPARATOR = /^[\s\-–—_=.·|~*]*$/; // Left over at the very end of a chapter once the links are gone. const TRAILING = /^[\s\-–—_=.·|~*]*(?:tambi[eé]n\s*:?)?[\s\-–—_=.·|~*]*$/i; From eea477d6cb06b07c7e66ecea97e71f4569455122 Mon Sep 17 00:00:00 2001 From: Raiyn Aydin Date: Wed, 11 Nov 2026 10:13:45 +0800 Subject: [PATCH 4/6] no-mistakes(review): Limit Topcur promo removal to upper-case lines --- plugins/spanish/novelastopcur.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/spanish/novelastopcur.ts b/plugins/spanish/novelastopcur.ts index 821b4490e7..725cefa03a 100644 --- a/plugins/spanish/novelastopcur.ts +++ b/plugins/spanish/novelastopcur.ts @@ -17,8 +17,11 @@ const CHAPTER_TEXT = /\d|pr[oó]logo|ep[ií]logo|extra|especial|prefacio/i; // "Anterior - Índice - Siguiente" and the author's donation/sharing lines. const NAVIGATION = /^[\s\-–—|]*(?:anterior|[ií]ndice|siguiente|volver)\b[\s\-–—|a-záéíóúñ]*$/i; -const PROMOTION = - /patreon|esponsor|anslid|compart(?:an|ir)(?:lo)?\s+(?:la\s+)?(?:novela|p[aá]gina)\b|compart\w*\s+(?:lo\s+)?\S*\s*ayudar[ií]a mucho|m[aá]s cap[ií]tulos\s+(?:gratis|en|:|\()|muchas gracias por todo/i; +const DONATION = /patreon|esponsor|anslid/i; +const SHARING = + /compart(?:an|ir)(?:lo)?\s+(?:la\s+)?(?:novela|p[aá]gina)\b|compart\w*\s+(?:lo\s+)?\S*\s*ayudar[ií]a mucho|m[aá]s cap[ií]tulos\s+(?:gratis|en|:|\()|muchas gracias por todo/i; +const isPromotion = (text: string): boolean => + DONATION.test(text) || (text === text.toUpperCase() && SHARING.test(text)); const SEPARATOR = /^[\s\-–—_=.·|~*]*$/; // Left over at the very end of a chapter once the links are gone. const TRAILING = /^[\s\-–—_=.·|~*]*(?:tambi[eé]n\s*:?)?[\s\-–—_=.·|~*]*$/i; @@ -306,10 +309,7 @@ class NovelasTopcur implements Plugin.PluginBase { // the story text is never removed. body.find('div, p, span').each((_, el) => { const text = this.clean($(el).text()); - if ( - text.length < 250 && - (NAVIGATION.test(text) || PROMOTION.test(text)) - ) { + if (text.length < 250 && (NAVIGATION.test(text) || isPromotion(text))) { $(el).remove(); } }); From bf438e6aa3da22d2cfa28151c4d0922574f47168 Mon Sep 17 00:00:00 2001 From: Raiyn Aydin Date: Wed, 11 Nov 2026 10:22:53 +0800 Subject: [PATCH 5/6] no-mistakes(ci): The CI failure was an HTTP 429 from animeshoy12.blogspot.com on the single HTML request `popularNovels` makes. I changed `plugins/spanish/novelastopcur.ts` to read pages and posts through Blogger's JSON feed instead, as the driver instructions asked. A new `document(path)` helper fetches the entry from `/feeds/pages/default` for `/p/...` paths and `/feeds/posts/default` otherwise, using the `path` parameter. It rebuilds `

` with the escaped title plus `
` with the entry content, so the existing selectors work unchanged. If the feed request fails, throws, or has no entry, it falls back once to the old HTML fetch. `catalogue`, `parseNovel` and `parseChapter` now call it. Local checks: prettier is unchanged, eslint is clean, and `npm run check:plugin -- plugins/spanish/novelastopcur.ts` passes all four steps: - `popularNovels`: 127 novels. - `searchNovels`: 1 result. - `parseNovel`: 738 chapters. The driver note expected 733; the site has presumably added chapters since. - `parseChapter`: 22614 characters. I did not run `npm run build:full`. The local check ran against the live site and does not show whether the feed requests avoid the 429 on the CI runner's IP, so that needs a CI re-run. The plugin version stays at 1.0.0 because the plugin is still new in this PR --- plugins/spanish/novelastopcur.ts | 36 +++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/plugins/spanish/novelastopcur.ts b/plugins/spanish/novelastopcur.ts index 725cefa03a..e8f736c723 100644 --- a/plugins/spanish/novelastopcur.ts +++ b/plugins/spanish/novelastopcur.ts @@ -51,6 +51,36 @@ class NovelasTopcur implements Plugin.PluginBase { return response; } + /** + * Loads a page or post through Blogger's public JSON feed (far less likely to + * be rate limited than the HTML) and rebuilds the markup the parsers expect. + * Falls back once to the HTML page when the feed has no usable entry. + */ + private async document(path: string) { + try { + const kind = path.startsWith('/p/') ? 'pages' : 'posts'; + const response = await fetchApi( + `${this.site}/feeds/${kind}/default?alt=json&path=${encodeURIComponent(path)}`, + ); + if (response.ok) { + const entry = (await response.json())?.feed?.entry?.[0]; + const content: string | undefined = entry?.content?.$t; + if (content) { + const title = String(entry.title?.$t || '') + .replace(/&/g, '&') + .replace(//g, '>'); + return loadCheerio( + `

${title}

${content}
`, + ); + } + } + } catch { + // Use the HTML page below. + } + return loadCheerio(await (await this.request(path)).text()); + } + private clean(text: string): string { return text.replace(/[\s\u00a0]+/g, ' ').trim(); } @@ -105,7 +135,7 @@ class NovelasTopcur implements Plugin.PluginBase { * cover image linked to the same novel page, in no fixed order. */ private async catalogue(): Promise { - const $ = loadCheerio(await (await this.request(CATALOGUE_PATH)).text()); + const $ = await this.document(CATALOGUE_PATH); const entries = new Map< string, { parts: string[]; cover: string | undefined } @@ -159,7 +189,7 @@ class NovelasTopcur implements Plugin.PluginBase { } async parseNovel(novelPath: string): Promise { - const $ = loadCheerio(await (await this.request(novelPath)).text()); + const $ = await this.document(novelPath); const body = $('.post-body').first(); if (!body.length) { throw new Error('Novelas Topcur: the novel page has no content.'); @@ -299,7 +329,7 @@ class NovelasTopcur implements Plugin.PluginBase { } async parseChapter(chapterPath: string): Promise { - const $ = loadCheerio(await (await this.request(chapterPath)).text()); + const $ = await this.document(chapterPath); const body = $('.post-body').first(); body .find('script, style, noscript, iframe, ins, form, .adsbygoogle') From 5e38fc21e887c9cdf6c180f315dd3bf9b0f76152 Mon Sep 17 00:00:00 2001 From: Raiyn Aydin Date: Wed, 11 Nov 2026 10:25:45 +0800 Subject: [PATCH 6/6] fix(spanish/novelastopcur): only strip real chapter navigation lines --- plugins/spanish/novelastopcur.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/spanish/novelastopcur.ts b/plugins/spanish/novelastopcur.ts index e8f736c723..684e082072 100644 --- a/plugins/spanish/novelastopcur.ts +++ b/plugins/spanish/novelastopcur.ts @@ -16,7 +16,7 @@ const CHAPTER_PATH = /^\/\d{4}\/\d{2}\/[^/]+\.html$/; const CHAPTER_TEXT = /\d|pr[oó]logo|ep[ií]logo|extra|especial|prefacio/i; // "Anterior - Índice - Siguiente" and the author's donation/sharing lines. const NAVIGATION = - /^[\s\-–—|]*(?:anterior|[ií]ndice|siguiente|volver)\b[\s\-–—|a-záéíóúñ]*$/i; + /^[\s\-–—|]*(?:anterior|[ií]ndice|siguiente)(?:[\s\-–—|]+(?:anterior|[ií]ndice|siguiente))*[\s\-–—|]*$/i; const DONATION = /patreon|esponsor|anslid/i; const SHARING = /compart(?:an|ir)(?:lo)?\s+(?:la\s+)?(?:novela|p[aá]gina)\b|compart\w*\s+(?:lo\s+)?\S*\s*ayudar[ií]a mucho|m[aá]s cap[ií]tulos\s+(?:gratis|en|:|\()|muchas gracias por todo/i;