Skip to content

fix(arabic/galaxynovels): list all chapters via static manifest (stacks on #2529) - #13

Open
RibatTRW wants to merge 6 commits into
fm/lnreader-arabic-empty-chaptersfrom
fm/lnreader-galaxy-full-index
Open

RibatTRW wants to merge 6 commits into
fm/lnreader-arabic-empty-chaptersfrom
fm/lnreader-galaxy-full-index

Conversation

@RibatTRW

@RibatTRW RibatTRW commented Sep 24, 2026 •

Copy link
Copy Markdown
Owner

Fix

Stacks on lnreader#2529 — merge after it. This branch sits on that PR's head, so the diff here is only the chapter-list fix on top. Fixes lnreader#2490.

Galaxy Novels novel pages render only the latest 30 chapters (data-per-page="30", 30 data-chapter-id items) with an empty data-index-url, so parseNovel fell through to the page list and returned just the latest 30 — chapters 1–621 of a 651-chapter novel were unreachable.

parseNovel now reads data-manifest-url from the chapters container and loads the full index the way the site's own reader does: the manifest's pack_url file holding every chapter, with live_tail merged over the pack by chapter id (newest wins), sorted ascending. When the manifest is absent, unreachable, or malformed it returns null and parseNovel falls back to the existing HTML list — never an empty list. Only the chapters-container manifest is used; the second manifest on the page covers the VIP time-locked schedule and is ignored, matching the total the site itself renders. Chapter-body and lock handling are untouched. Version 1.1.1 → 1.1.2.

Verification (live, 2026-09-24)

check:plugin: 30 chapters before, 651 after; popular (20), search (1), and chapter steps pass. Served counts equal the manifest's own totals in the same run (651/651, 3155/3155, 234/234), numbering contiguous 1..N with no gaps or duplicates; a previously unreachable first chapter returns full text. Fallback proven with manifest requests blocked (30 page-derived chapters, not empty). build:compile and build:multisrc pass; eslint clean on the touched file (2 repo-wide errors pre-existing). AI-authored change, no human review.

RibatTRW and others added 6 commits September 16, 2026 20:11
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).
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.
The novel page only renders the latest 30 chapters and data-index-url
is empty, so parseNovel now reads data-manifest-url from the chapters
container, merges the pack file with live_tail the way the site reader
does, and falls back to the page-derived list when the manifest is
absent or malformed.

This change was authored by an AI coding agent.

Co-Authored-By: firstmate-crewmate <crewmate@firstmate.local>
@RibatTRW

Copy link
Copy Markdown
Owner Author

This change now lives in lnreader#2529. It was cherry-picked there unchanged as 99d71f3 (Galaxy Novels 1.1.1 → 1.1.2). lnreader#2529 now closes lnreader#2667 and lnreader#2490.

Re-checked against the live site on 2026-10-11. The chapter manifest path still works:

  • i-can-copy-talents: 3155 of 3155 chapters (manifest total 3155)
  • after-billions-of-deaths-…: 156 of 156
  • the-auction-returns-…: 1797 of 1797

Each list is numbered 1..N with no gaps, and chapter 1 opens. Before the fix each novel showed only the latest 30.

lnreader#2529 also adds one follow-up for this plugin: when it falls back to the 30 chapters on the novel page, it now lists them oldest first.

Screenshots below are from this repo's plugin playground, run in headless Chromium, not from the LNReader app.

This comment was written by an AI coding agent working for the PR author.

Before (1.1.1): only 30 chapters, newest first

After (1.1.2): 156 chapters, chapter 1 first

After: the list ends at chapter 156

After: i-can-copy-talents lists 3155 chapters

After: the list ends at chapter 3164 (position 3155)

After: chapter 1 opens with its text

@RibatTRW
RibatTRW force-pushed the fm/lnreader-arabic-empty-chapters branch from be436fd to 13ba9a5 Compare November 3, 2026 22:49
@RibatTRW
RibatTRW force-pushed the fm/lnreader-arabic-empty-chapters branch from c87fddb to 5e19ac2 Compare November 18, 2026 22:51
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.

1 participant