Skip to content

fix(ar): empty chapter bodies and Riwyat novel metadata (Galaxy Novels, Riwyat, Kol Novel, Free Kol Novel) - #2529

Open
RibatTRW wants to merge 7 commits into
lnreader:masterfrom
RibatTRW:fm/lnreader-arabic-empty-chapters
Open

RibatTRW wants to merge 7 commits into
lnreader:masterfrom
RibatTRW:fm/lnreader-arabic-empty-chapters

Conversation

@RibatTRW

@RibatTRW RibatTRW commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Closes #2522, #2568, #2486, #2483, #2505, #2465, #2501, #2370, #1566, #2442, #2576, #2578

Opening a chapter in these Arabic sources showed "no content", even though the cover, description and chapter list still loaded. Each source broke for a different reason. Four are fixed. The fifth, Markazriwayat, could not be checked at all, so it is listed as not verified instead of fixed.

Source Cause Status
Galaxy Novels chapter links were built from a WordPress post id (…/chapter-<post-id>/, which 404s), and the JSON endpoint the plugin preferred answers Cloudflare 403 to third-party clients fixed
Riwyat $('.text-left') || … never reached its later selectors (a cheerio selection is always truthy), and the theme's invisible decoy blocks were returned as text fixed
Kol Novel the body regex required a bottomnav terminator that the theme dropped, and hard-coded a <div> wrapper where the theme serves <article> fixed; verified through a proxy only, not end-to-end
Free Kol Novel the same regex break, plus chapter links point at kolnovel.com, so the plugin requested free.kolnovel.com/https://kolnovel.com/… fixed; verified through a proxy only, not end-to-end
Markazriwayat not reproduced: the site serves a "Coming Soon" page and 404s every other path not verified; no code changed

This PR also fixes Riwyat's novel metadata on the site's new theme, where name, cover, summary, author, genres, status and rating all came back empty. The fix adds fallbacks that run only after the existing selectors find nothing, so sources on the classic theme keep their current behaviour. Issues #2568, #2576 and #2578 report empty Kol Novel-family chapters; they come from the same template defect and this fix covers them.

Strengthening pass

A second pass reviewed the changes to the two shared templates (madara and lightnovelwp), because dozens of other sources use them. It made three small changes. Each one prevents a specific failure, shown before and after in the evidence below:

  1. madara: image-only chapters render again. The new selector walk kept the first candidate that contains text. An illustration or comic chapter with only <img> inside .text-left has no text, so this PR's first version returned an empty body where master showed the images. A candidate that contains images now counts as content too.
  2. madara and lightnovelwp: missing bodies raise a clear error. When no chapter body is found (a login wall, a locked chapter, or a future markup change), parseChapter used to return "". It now throws Chapter text not found on the page, try to open in webview. The error only replaces cases that returned an empty string, so any chapter that returned text before returns the same text.
  3. Galaxy Novels: no fake chapter text. Any 200 page without a chapter body, such as the novel page, returned <p>Content not available.</p> as though it were the chapter, and a download would have saved that text. The plugin now throws instead.

This pass made no other changes. Kol Novel and Free Kol Novel still cannot be reached from the machine used for testing (TCP timeout), so they remain verified through a proxy only.

Issue #2522

#2522 reports "no content" when opening a chapter on Kol Novel, Free Kol Novel and Riwyat (its labels name Galaxy Novels and Markazriwayat, but the report text names the Kol Novel family and Riwyat). Against today's live sites this PR covers it as follows:

  • Riwyat: fixed and verified. Novel metadata and chapter bodies return on novels that have chapters (see the 2026-09-28 re-verification below: 120 chapters with full metadata and a 9,011-char body; 70 chapters with a 634-char body).
  • Kol Novel and Free Kol Novel: fixed, but only verifiable through a proxy from here. Both hosts still resolve but time out over HTTPS from the test machine, so no end-to-end check:plugin run can reach them (fetch failed → INCONCLUSIVE). The fix was re-verified on live chapter HTML fetched through a proxy: the old regex returns 0 chars and the new selector returns the full body (29,415 chars / 254 paragraphs on the sampled chapter). Free Kol Novel's cross-host chapter links were also re-confirmed.
  • Markazriwayat: still not verified. The site answers direct requests with a Cloudflare challenge and shows a "Coming Soon" page through a reader proxy. No code in this PR touches it.

Currency (2026-09-28)

master has 16 newer commits since this branch's base. They touch the shared madara template (a Translator-author fallback and a Summary fallback) and madara/sources.json (add Tangerine Archive, drop two dead entries), plus unrelated plugins. None of them invalidate this change, the branch is still mergeable, and the head is unchanged (184b85a), so history was not rewritten. The stacked fork branch for the Galaxy full chapter index sits on an earlier point of this branch and is untouched.

Not closed

Verification evidence

First pass

  • Galaxy Novels: npm run check:plugin shows popular 20 ✅, search 1 ✅, parseNovel 30 chapters ✅, parseChapter 13258 chars ✅ (was a 404).
  • Riwyat: popular 12 ✅, search 1 ✅, parseNovel 15 chapters ✅, parseChapter 16910 chars ✅ (was 0 chars).
  • The shared lightnovelwp fix was reproduced independently on a reachable source, TC & Sega: parseChapter FAIL (0 chars) → PASS 5905 chars.
  • Regression sweeps: all 36 lightnovelwp sources before and after showed exactly one status change (TC & Sega, FAIL → PASS). 20 madara sources were identical, and 12 madara sources swept for the metadata fallbacks showed no status or body-length change.
  • kolnovel.com and free.kolnovel.com time out over TCP from the test machine. They were verified by running the plugin's own extraction on live HTML fetched through a text proxy, which gave 14002 chars from the same chapter on both hosts. On a 12-paragraph sample, the old regex returned 0 chars and the new selector returned 1,006. The sites themselves are up; only that network route times out.
  • Checked against this PR's base (8522c771) at dc58567e: Galaxy Novels parseChapter went from FAIL Could not reach site (404) to PASS with 49,502 chars, and Riwyat parseNovel went from FAIL Missing novel name to PASS with full metadata, 100 chapters and a 9,002-char chapter body.
  • A spot sweep of sources this PR does not name found KnoxT, ArNovel, LightNovelHeaven and Ninja identical on head and base. UniversalNovel and MostNovel fail the same way on both, so those failures existed before this PR.

Strengthening pass (head 184b85a vs dc58567)

Fixture before/after, calling the bundled plugins' parseChapter:

Input dc58567 184b85a
madara, .text-left holding only <img> (master returned the images) returns "" returns the <img> paragraphs
madara, page with no chapter body returns "" throws Chapter text not found on the page, try to open in webview.
lightnovelwp, page without .epcontent returns "" throws the same error
lightnovelwp, normal <article class="epcontent"> chapter two paragraphs the same two paragraphs
Galaxy Novels, live novel page served as a chapter (HTTP 200) returns <p>Content not available.</p> throws Chapter text not found on the page, open it in WebView.

Full regression sweep over all 78 madara and 36 lightnovelwp sources plus Galaxy Novels. Every HTTP response was recorded once and replayed to both heads, so both saw identical pages. For each source the sweep ran popular → first novel → first chapter and compared status, name, author, genres, status, rating, summary length, cover, chapter count, body length and a hash of the body. 115 of 115 were identical. Reachability from the test machine:

Template Chapter body OK No chapters No popular list Blocked (403/404/410/503/captcha) Unreachable
madara (78) 26 2 11 19 20
lightnovelwp (36) 8 2 4 12 10

On every reachable lightnovelwp chapter, the text extracted by the old regex and by this PR's selector was identical. Only the HTML serialization differs. On every reachable classic madara chapter, .text-left holds the text, so the selector walk still stops at .text-left, as it did before.

npm run check:plugin on 184b85a:

  • Galaxy Novels: popular 20 ✅, search 1 ✅, parseNovel 30 chapters ✅, parseChapter 49502 chars ✅
  • Riwyat: popular 12 ✅, search 3 ✅, parseNovel 110 chapters ✅, parseChapter 9002 chars ✅
  • Kol Novel, Free Kol Novel: ⚠️ INCONCLUSIVE (fetch failed, TCP timeout on the test machine's route), still verified through a proxy only

npm run build:compile exits 0. eslint and prettier --check pass on all changed files.

Re-verified 2026-09-28 (head 184b85a, no code changes)

Direct probes: galaxynovels.com HTTP 200, cenele.com HTTP 200, kolnovel.com and free.kolnovel.com TCP timeout on 443 (fetch failed), markazriwayat.com HTTP 403 (Cloudflare challenge; reader proxy shows "Coming Soon").

  • Galaxy Novels (npm run check:plugin -- plugins/arabic/galaxynovels.ts): popular 20 ✅, search 1 ✅, parseNovel 30 chapters ✅, parseChapter 49502 chars ✅.
  • Riwyat (npm run check:plugin -- "plugins/arabic/Riwyat[madara].ts"): popular 12 ✅, search 1 ✅, parseNovel ❌ FAIL "No chapters returned" — the harness checks the first popular novel (cont/pain-novel/), whose own ajax/chapters/ endpoint currently answers "Manga has no chapter yet", so the site itself lists zero chapters there. Targeted runs on novels that have chapters still pass: cont/i-can-see-through-e/ → 120 chapters, full metadata (author, genres, Ongoing status, rating 8.4, cover, 905-char summary), first-chapter body 9,011 chars; cont/starting-over/ → 70 chapters, first-chapter body 634 chars.
  • Kol Novel / Free Kol Novel (npm run check:plugin on both generated plugins): ⚠️ INCONCLUSIVE at siteReachability (fetch failed) — the direct route still times out, so end-to-end verification remains impossible from here. Proxy re-verification on live HTML: the sampled Kol chapter (Chrysalis 162) serves <div class="epcontent entry-content"> with no bottomnav; the old regex returns 0 chars and this PR's $('.epcontent').first().find('p') selector returns 29,415 chars (254 paragraphs). The Free novel page still lists chapter links as absolute kolnovel.com URLs, and the path normalization was unit-verified (old: free.kolnovel.com/https://kolnovel.com/…, new: /…); the same Free chapter's content was confirmed present through a reader proxy.
  • Markazriwayat (npm run check:plugin -- plugins/arabic/Markazriwayat.ts): ⚠️ INCONCLUSIVE (HTTP 403 Cloudflare). Still not verified; no code changed.
  • npm run build:compile exits 0; eslint and prettier --check pass on all changed files.

This PR was written by AI coding agents working for the PR author (the strengthening pass by Claude Opus 5.5, this description refresh by Muse Spark). No human has reviewed the code, so please review it with that in mind.

parseNovel preferred the data-chapter-id attribute (a WordPress post id)
over the chapter link and built `…/chapter-<post-id>/` paths, which the
site answers with 404 — only `…/chapter-<number>/<slug>/` resolves, so
every chapter list it produced was unusable.

parseChapter then asked `wp-json/wor-reader-app/v1/chapters/<id>` first;
that route exists but Cloudflare answers 403 to every non-app client
(reproduced from a real browser with a same-origin fetch), and the HTML
fallback looked for selectors the theme no longer ships. Read the body
from the article marked up as https://schema.org/Chapter instead, taking
the first candidate that actually contains text.

Fixes the chapter body for Galaxy Novels (issue lnreader#2522).
`$('.text-left') || $('.text-right') || …` never reaches the second
selector: a cheerio selection object is always truthy, so a page without
`.text-left` returned an empty chapter instead of trying the rest. Walk
the selectors and keep the first one that actually contains text, and add
the anchors the Madara-derived themes read from (`.text-content`,
`.text-chapter-content`, `novel-chapter`, `.reading-content`).

The riwyat source (cenele.com) also hides scraped-text decoys in
`<section inert data-nosnippet>` blocks that its inline CSS makes
invisible and wraps the body in a per-request random class, so its
customJs now drops those sections along with in-body style/script tags
and the app-promo blocks.

Fixes the chapter body for Riwyat (issue lnreader#2522).
The chapter body regex required a `<div class="epcontent …">` wrapper and
a `<div class="bottomnav">` terminator, and sliced the raw document
between them. Newer installs render the body as
`<article class="epcontent …">` and close it with `<nav class="bottomnav">`
or with nothing at all, so the regex stopped matching and every chapter
came back empty. Select the body itself and return its paragraphs.

Chapter links that point at the main site (free.kolnovel.com links
kolnovel.com) are now reduced to their path, because parseChapter always
re-prefixes `this.site` and the absolute URL produced
`https://free.kolnovel.com/https://kolnovel.com/…`.

Fixes the chapter body for Kol Novel and Free Kol Novel (issue lnreader#2522).
@RibatTRW

Copy link
Copy Markdown
Contributor Author

bro the markaz riwayat website is not even up... i need help with kol novel also, i am able to get the words and characters but the website itself is not up for me...

Riwyat (cenele.com) migrated to a custom NHV theme whose novel pages no
longer render the classic Madara detail blocks, so parseNovel returned an
empty name, cover, summary, author and genres. Try each existing selector
first and only fall through to the theme-specific markup (h1.nhv-novel-title,
.nhv-novel-cover img, .nhv-novel-synopsis p, .nhv-novel-meta author links,
.nhv-novel-genres a, .nhv-novel-status, .nhv-simple-rating__avg) when it
yields nothing, leaving classic-theme sources unchanged.

Pairs with the parseChapter selector-chain fix for the same source; this
change stays out of parseChapter and sources.json.

AI-authored change, no human review claimed.
@RibatTRW RibatTRW changed the title fix(ar): empty chapter bodies in Galaxy Novels, Riwyat, Kol Novel and Free Kol Novel fix(ar): empty chapter bodies and Riwyat novel metadata (Galaxy Novels, Riwyat, Kol Novel, Free Kol Novel) Sep 24, 2026
…odies

- madara: a chapter candidate that holds only images (illustration or comic
  chapters) counts as content again; the text-only test skipped it and
  returned an empty body where master rendered the images.
- madara, lightnovelwp: throw a clear error when no chapter body is found
  instead of returning an empty string.
- galaxynovels: throw instead of returning "Content not available." as if it
  were the chapter text.
Resolve plugins/multisrc/lightnovelwp/template.ts: keep master's lnreader#2611
chapter HTML/image handling and sanitizing, select `.epcontent` (div or
article) per this PR, and throw when the body is missing or empty.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[kolnovel] Empty chapter: the dominating — العودة بنجاح

1 participant