Repository navigation
fix(english/lncrawler): keep chapter heading and add search filters - #2754
rajarsheechatterjee merged 3 commits into
Conversation
- Keep the API's leading <h1> in chapter bodies so readers see the chapter title (including its number) in the chapter header. - Add filter support to popularNovels/searchNovels via the search API: languages, status, sort_by, sort_order and adult content, with popular = popularity desc and Latest = last_updated desc. - Bump version to 1.1.0. Co-Authored-By: opencode <ai@opencode.dev>
[Medium impact] The change reaches readers who browse or read novels through LNCrawler. Fix the lost language choice before merging; readers can otherwise receive chapters in a language they did not select. Findings
SummaryKeeps the chapter heading and adds language, status, sort, and adult-content filters to LNCrawler. Raises
Reviews (1) · Last reviewed commit: "fix(english/lncrawler): keep chapter hea..." · Reviewed by Greptile |
| for (const language of filters?.languages?.value || []) { | ||
| if (language) params.append('languages', language); |
There was a problem hiding this comment.
Chapters ignore the chosen language
Selecting a non-English language changes the catalog request, but opening a matching novel still calls chooseSource, which prefers English whenever English chapters exist. Cards carry only the novel slug, so the language choice never reaches the chapter source choice. Carry the selected language into the saved path and use it when choosing the source.
Knowledge Base Used: English source plugins
There was a problem hiding this comment.
Addressed in a045b06: the catalog now carries the selected languages in the novel path (slug?lang=a,b), and chooseSource prefers a source in one of those languages (first listed first) over the default English preference. Bare-slug/safe fallback (English-first) kept for paths saved before this change.
| status: { | ||
| type: FilterTypes.Picker, | ||
| label: 'Status', | ||
| value: '', | ||
| options: STATUS_OPTIONS, |
There was a problem hiding this comment.
Filters cannot be cleared individually
The four new pickers default to '', but none offers an option for that value. After choosing a status, readers cannot return just that field to “All” without resetting their other choices. The default sort and adult-content settings have the same problem. Add a labeled empty option to each picker so readers can clear each choice independently.
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!
There was a problem hiding this comment.
Addressed in a045b06: every picker (status/sort/order/adult) now starts with an empty-value option (All / Default) so any single filter can be reset without touching the others.
| .replace(/^\s*<h1\b[^>]*>[\s\S]*?<\/h1>\s*/i, '') | ||
| .trim(); | ||
| return sanitizeChapterHtml(withoutTitle); | ||
| return sanitizeChapterHtml(res.body.trim()); |
There was a problem hiding this comment.
Exported headings appear twice
The retained chapter heading reaches EPUB export unchanged. createEpub already adds its own heading before the returned content, so exported LNCrawler chapters now start with two headings. Keep the heading for reading, but make the export path avoid adding another when the content already has one.
There was a problem hiding this comment.
Keeping the heading is intentional here: without it readers opened chapters with no title/number at all in the chapter header (this was reported by users reading on the app). The heading in the body faithfully mirrors what the source API provides for every chapter. The EPUB-export duplication is app-side — createEpub could skip adding its own title when the chapter content already starts with a heading (same guard other heading-preserving plugins would benefit from). Happy to revisit the opposite way if the app-side guard lands first.
There was a problem hiding this comment.
That makes sense. The source heading is needed for the in-app reading experience, and the EPUB duplication is better handled by a generic guard in createEpub than by stripping or altering this plugin’s content. I’m withdrawing the finding; it shouldn’t block this PR.
Tip: You can customize Greptile's behavior for this repo with .greptile/rules.md and .greptile/config.json.
…rable filters - Catalog cards carry the chosen languages in their path (slug?lang=a,b); parseNovel now prefers a chapter source in one of those languages over the default English preference. - Add All/Default (empty) options to status, sort, order and adult pickers so each filter can be cleared individually. - Make novel slug extraction robust for bare-slug and resolved URLs. - Bump version to 1.1.1. Co-Authored-By: opencode <ai@opencode.dev>
Co-Authored-By: opencode <ai@opencode.dev>
What
<h1>from the chapter body (parseChapterBody), assuming the app already shows the title. In practice readers lost the chapter title/number inside the chapter view. The heading is now kept — LNCrawler titles include the chapter number (e.g.Chapter 1 - 1: Nightmare Begins).popularNovels/searchNovelsnow use the API's filter params discovered from the site frontend:languages(20 ISO languages, repeated param),status,sort_by(title/rating/date_added/popularity/trending/last_updated),sort_order(asc/desc),adult(hide/show/only).popularity desc; the Latest toggle =last_updated desc; English when no filters are passed (search interface has no options param).Validation performed
npm run check:plugin -- plugins/english/lncrawler.ts→ all 4 live checks PASS (20 novels, search OK, 1433 chapters, 9439-char chapter).npx tsc --noEmit -p tsconfig.production.jsonclean; prettier and lint clean for the file.Authored with the OpenCode AI agent (Co-Authored-By trailer in commits).