Skip to content

feat(english): add ReChapters source plugin - #2613

Open
RibatTRW wants to merge 2 commits into
lnreader:masterfrom
RibatTRW:fm/lnreader-rechapters-2485
Open

RibatTRW wants to merge 2 commits into
lnreader:masterfrom
RibatTRW:fm/lnreader-rechapters-2485

Conversation

@RibatTRW

@RibatTRW RibatTRW commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Adds a standalone English plugin for ReChapters.

Closes #2485

What it supports

The site is a Next.js app with a public JSON API, so the plugin uses that API in most places instead of scraping HTML:

  • popularNovels: /api/search, 20 per page. It pages by building the site's offset cursor. "Latest" sorts by last chapter update. Filters: sort (popularity, latest update, rating, rating count, chapter count, word count) and status (ongoing / completed).
  • searchNovels: /api/search?q=… sorted by relevance, with the same paging.
  • parseNovel: title, author, synopsis and cover come from the book page's JSON-LD (the author field is accepted as an array, a single object or a string); genres come from the tag list and status from the status pill. The complete chapter list is fetched from /api/book/{id}/chapters/buckets, then each bucket of about 100 chapters is fetched in ascending order, 5 buckets at a time.
  • parseChapter: /api/book/…/content (no login needed for these chapters). Long chapters are split into several pages, and all of them are fetched. The text blocks are plain text, and they are HTML-escaped into <p> elements, so the output can't contain markup, on* attributes or javascript: URLs.
  • Icon: the site's own app icon, resized to 96×96.

The site has wallet and purchase endpoints. Every chapter I sampled across about 25 popular novels was free (accessLevel: 0, isVip: false), so the plugin has no special handling for paid chapters.

How it was tested

  • npm run check:plugin -- plugins/english/rechapters.ts: all four checks PASS (popular: 20 novels, search: 20 results, parseNovel: 1432 chapters, parseChapter: 10255 chars).
  • I ran an extra script against the live site with the bundled plugin:
    • popular pages 1 and 2 don't overlap;
    • the latest, status and sort filters return different lists;
    • an empty search returns [];
    • status is correct for a completed novel (Lord of the Mysteries) and an ongoing one (Shadow Slave, 3195 chapters, all in order);
    • a chapter split over two pages returns all 103 paragraphs;
    • with synthetic JSON-LD, the author is read correctly when author is an array, a single object, a string, a mixed array, or missing/null.
  • eslint and prettier --check pass on the new file, and npm run build:compile succeeds. Repo-wide npm run lint still reports errors, but they are in files this PR doesn't change (plugins/arabic/rewayatfans.ts, plugins/english/wetriedtls.ts).
  • I have not tested it in the LNReader app or the playground.

This PR was written by an AI agent (Claude Code), and no human has reviewed it yet.

@greptile-apps

greptile-apps Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[Medium risk] Adds a new novel source plugin for a reading site.

The PR appears safe to merge, with two non-blocking improvements to book loading and chapter-page tests.

Findings

  1. P2 Single author breaks book loading ▶
  2. P2 Later chapter pages go unchecked ▶

Summary

Adds ReChapters as an English source in LNReader. Readers can browse and search books, view book details and chapter lists, and read chapter text.

  • Popular lists include sort and status filters, with 20 books per page.
  • Book pages supply details and ordered chapter lists; chapter reading includes all text pages.

Reviews (1) · Last reviewed commit: "feat(english): add ReChapters source plu..."

Comment thread plugins/english/rechapters.ts Outdated
Comment on lines +199 to +200
const authors = (ld.author || [])
.map(a => (a.name || '').trim())

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Single author breaks book loading

If a book page supplies author as one object instead of an array, parseNovel calls .map on it and throws. The reader cannot open that book. Check the value’s shape before mapping it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 855c6e0. The JSON-LD author value is now normalized before names are read: an array, a single Person object, a plain string, or a missing/null value all work. I tested each shape (plus a mixed array) with synthetic JSON-LD, and a live novel still parses its authors.

Comment on lines +275 to +278
const first = await getApi<ChapterContentData>(base);
const pages = [first];
for (let p = 2; p <= first.pageMetas.length; p++) {
pages.push(await getApi<ChapterContentData>(base + '?weightPage=' + p));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Later chapter pages go unchecked

The routine plugin check reads one sample chapter but does not check a fixed two-page response. A later change to pageMetas or weightPage could drop the rest of a long chapter while that check still passes. Add a test that verifies text from both pages.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not adding a test here: this repo has no unit-test harness for plugins, and building one is out of scope for this PR. I checked the two-page path against the live site instead: book/shadow-slave-r2k2ivbd6ez4/gpp58s44jc is split over two weight pages (50 + 53 blocks), and parseChapter returned all 103 paragraphs.

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.

Rechapters

1 participant