Skip to content

fix(NovelMania): load chapter text from truncated streamed responses - #2607

Merged
rajarsheechatterjee merged 2 commits into
lnreader:masterfrom
arthurbritol:patch-1
Sep 29, 2026
Merged

rajarsheechatterjee merged 2 commits into
lnreader:masterfrom
arthurbritol:patch-1

Conversation

@arthurbritol

@arthurbritol arthurbritol commented Sep 28, 2026 •

Copy link
Copy Markdown

Problem

Chapters of Novel Mania open blank in the app. parseChapter reads the
chapter text from the React SSR $R data stream embedded in the page, but
the document the app receives is cut off (~36 KB, ending in the middle of
the matches array), so the chapter data is never present and an empty
chapter is returned. The same page loads fine in a desktop browser, where
the stream is complete and content:"..." is present.

Changes

  • Send browser-like headers (User-Agent, Accept, Accept-Language, Referer
    and the nm_vid / PARAGLIDE_LOCALE cookies; nm_vid is a random id).
  • Read the page with up to 5 strategies (text() / arrayBuffer(), with
    default, identity and gzip Accept-Encoding) and stop at the first one
    that contains the end-of-stream marker $_TSR.e(). If none is complete,
    keep the longest body.
  • Make the content regex tolerant to quoted keys and whitespace.
  • Decode \/ and \' in decodeJsString.
  • Throw an explicit error when no chapter text is found, instead of
    returning an empty chapter that looks like a successful load.
  • Bump version to 2.0.2.

Notes

  • I confirmed the truncation ($_TSR.e() missing, HTML cut at the same
    length on every request) and that the combination of the changes above
    fixes it, but I did not isolate which single change is responsible.
  • Novel list, search and chapter list are untouched.

Testing

Tested in the LNReader app (Poco X8 Pro / Android 16): chapters of
"86: Eighty Six" load correctly again.

  • Update version code if an existing plugin was modified
  • Test changes in Plugin Playground or the app
  • Commit messages follow type(scope): description
WhatsApp Image 2026-09-28 at 17 08 57

The site now serves chapter pages as a streamed React SSR response. In the
app the document was arriving truncated (~36 KB, missing the chapter data),
so `parseChapter` returned an empty chapter.

- Send browser-like headers (User-Agent, Accept-Language, Referer, cookies)
- Retry with different read strategies (text/arrayBuffer, Accept-Encoding
  identity/gzip) until the stream end marker (`$_TSR.e()`) is present
- Make the `content` regex tolerant to quoted keys/whitespace
- Throw a clear error instead of returning an empty chapter
- Bump version to 2.0.2

Tested in the app: chapters of "86: Eighty Six" load correctly again.

- [x] Update version code if an existing plugin was modified
- [x] Test changes in Plugin Playground or the app
- [ ] Reference related issues in the PR body
- [x] Commit messages follow `type(scope): description`
@greptile-apps

greptile-apps Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[Medium risk] Fixes chapter text extraction from a web scraper.

The PR should not merge until chapter parsing reliably uses a completed response rather than a longer incomplete one.

Findings

  1. P1 Completed response gets discarded ▶
  2. P2 Rejected requests get retried ▶

Summary

The PR adds browser-like chapter requests, several response-reading strategies, more tolerant SSR content parsing, and an explicit error for missing chapter text. It also bumps Novel Mania to 2.0.2.

  • A shorter completed response can be discarded in favor of an earlier incomplete one.
  • HTTP rejection responses can trigger all five attempts before a generic error is shown.

Reviews (1) · Last reviewed commit: "fix(NovelMania): fix chapters loading bl..."

Comment thread plugins/portuguese/novelmania.ts Outdated
Comment thread plugins/portuguese/novelmania.ts Outdated
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@rajarsheechatterjee
rajarsheechatterjee merged commit 662d998 into lnreader:master Sep 29, 2026
3 checks passed
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Oct 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants