Conversation
… 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>
|
| 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() || ''; |
There was a problem hiding this comment.
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!
…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>
…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>
Closes #2571
What was wrong
parseChapteranchored the chapter body ondiv:contains('Daftar Isi') +, but the site now renders chapter bodies inside.entry-contentasp.ds-markdown-paragraph. The stale selector matched nothing, so every chapter opened as "tidak ada konten yang bisa dibaca".What changed
parseChapternow tries.tldariinggrissendiribrojangancopy .entry-content, then.entry-content, thenp.ds-markdown-paragraph, and keeps the oldDaftar Isipath (with its original cleanup) as a last resort.1.0.1->1.0.2.Update (Clean Coder review fixes,
9db150f)CHAPTER_CONTENT_SELECTORS/PROMO_TEXTconstants 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-wideloadedCheerio(...).remove()).check:plugin(INCONCLUSIVE — sakuranovel.id serves a Cloudflare HTTP 403, so no live chapter read was possible),eslinton 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,eslintandbuild:compileclean locally.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.