Skip to content

fix(indonesian/sakuranovel): update chapter body selector for current site markup - #2573

Open
RibatTRW wants to merge 4 commits into
lnreader:masterfrom
RibatTRW:fm/lnreader-sakuranovel-2571-empty-chapter
Open

RibatTRW wants to merge 4 commits into
lnreader:masterfrom
RibatTRW:fm/lnreader-sakuranovel-2571-empty-chapter

Conversation

@RibatTRW

@RibatTRW RibatTRW commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Closes #2571

What was wrong

parseChapter anchored the chapter body on div:contains('Daftar Isi') +, but the site now renders chapter bodies inside .entry-content as p.ds-markdown-paragraph. The stale selector matched nothing, so every chapter opened as "tidak ada konten yang bisa dibaca".

What changed

  • parseChapter now tries .tldariinggrissendiribrojangancopy .entry-content, then .entry-content, then p.ds-markdown-paragraph, and keeps the old Daftar Isi path (with its original cleanup) as a last resort.
  • The "Baca novel lain di sakuranovel" promo line is stripped on every path.
  • Version 1.0.1 -> 1.0.2.

Update (Clean Coder review fixes, 9db150f)

  • Named CHAPTER_CONTENT_SELECTORS / PROMO_TEXT constants with why-comments (the obfuscated wrapper class is the site's own, not a typo), one why-comment per fallback tier, .map().get().join('') paragraph assembly, and the legacy class removal scoped to the chapter container (legacy.find(...).remove() instead of the site-wide loadedCheerio(...).remove()).
  • Re-ran on the new head: check:plugin (INCONCLUSIVE — sakuranovel.id serves a Cloudflare HTTP 403, so no live chapter read was possible), eslint on the file, prettier --check, build:compile, and the offline selector harness against the repo's own cheerio (11/11 pass, including old-vs-new scoping probe).

Verification

  • check:plugin, prettier --check, eslint and build:compile clean locally.
  • Offline harness against the repo's own cheerio: the old logic returns empty on current markup; the new logic returns the full chapter with the promo removed; byte-identical to v1.0.1 on archived old markup.
  • sakuranovel.id serves this machine and the CI runners a Cloudflare challenge (HTTP 403), so no live chapter read was possible and the live check reports INCONCLUSIVE, not a failure.

Note

This repository has no unit-test suite (AGENTS.md), so no test files were added; each extraction path was covered by the offline harness fixtures.

AI-authored; please weight review accordingly.

… site markup

The chapter pages now render the body inside
.tldariinggrissendiribrojangancopy .entry-content as
p.ds-markdown-paragraph elements, so the old
div:contains('Daftar Isi') + anchor resolves to nothing and
parseChapter returned an empty string ("tidak ada konten yang
bisa dibaca"). Extract from the new container, strip the
site promo paragraph, fall back to the legacy selector.

Closes lnreader#2571

Co-Authored-By: Muse Spark <noreply@muse-spark.ai>
@RibatTRW
RibatTRW marked this pull request as draft September 25, 2026 12:07
@greptile-apps

greptile-apps Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium risk] Updates chapter content extraction for a novel scraper plugin.

The PR appears safe to merge, though retained regression coverage for the extraction paths would be useful.

Findings

  1. P2 New extraction lacks regression tests ▶

Summary

The plugin now tries current chapter-content containers and markdown paragraphs before the legacy selector, removes the known promotional paragraph, and updates its version to 1.0.2.

Reviews (5) · Last reviewed commit: "fix(indonesian/sakuranovel): name fallba..."

Comment thread plugins/indonesian/sakuranovel.ts Outdated
Comment thread plugins/indonesian/sakuranovel.ts Outdated
Comment on lines +140 to +158
const contentSelectors = [
'.tldariinggrissendiribrojangancopy .entry-content',
'.entry-content',
];
for (const selector of contentSelectors) {
const content = loadedCheerio(selector).first();
if (!content.length) continue;
content.find("p:contains('Baca novel lain di sakuranovel')").remove();
const chapterText = (content.html() || '').trim();
if (chapterText) return chapterText;
}

return chapterText;
let paragraphs = '';
loadedCheerio('p.ds-markdown-paragraph').each((i, el) => {
paragraphs += loadedCheerio(el).toString();
});
if (paragraphs.trim()) return paragraphs;

return loadedCheerio("div:contains('Daftar Isi') +").html() || '';

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 New extraction lacks regression tests These container, paragraph, and legacy paths have no retained chapter-markup fixtures. The live chapter check was blocked, so adding fixtures for current and older markup would help catch empty chapters or broken fallbacks without relying on site access.

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!

RibatTRW and others added 2 commits September 25, 2026 20:23
…ar Isi fallback

On the retained legacy path, strip the first inner div (anti-scrape /
navigation markup) before returning the sibling HTML, mirroring the
v1.0.1 cleanup. Guarded against multi-class values.

Addresses Greptile review on lnreader#2573.

Co-Authored-By: Muse Spark <noreply@muse-spark.ai>
…allback

The p.ds-markdown-paragraph fallback concatenated every match,
including the site promo line. Skip paragraphs containing
'Baca novel lain di sakuranovel', mirroring the entry-content
branches above.

Co-Authored-By: Muse Spark <noreply@muse-spark.ai>
@RibatTRW
RibatTRW marked this pull request as ready for review September 25, 2026 12:46
…oval

Apply Clean Coder review: hoist content selectors and promo text to
commented constants, scope the legacy class removal to the chapter
container, and use map/get/join for paragraph assembly.

Co-Authored-By: firstmate-crewmate <crewmate@firstmate.local>
@RibatTRW
RibatTRW marked this pull request as draft September 25, 2026 13:26
@RibatTRW
RibatTRW marked this pull request as ready for review September 25, 2026 13:35
@RibatTRW
RibatTRW marked this pull request as draft September 25, 2026 13:36
@RibatTRW
RibatTRW marked this pull request as ready for review September 25, 2026 13:40
@RibatTRW
RibatTRW marked this pull request as draft September 25, 2026 13:41
@RibatTRW
RibatTRW marked this pull request as ready for review September 25, 2026 13:43

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.

[sakura.id] Empty chapter: Gaikotsu Kishi-sama, Tadaima Isekai e Odekake-chuu — , Tadaima Isekai e Odekake-chuu Volume 01 Prologue

1 participant