Skip to content

fix(english/fucknovelpia): throw on rate-limited pages instead of empty chapters - #2553

Open
RibatTRW wants to merge 2 commits into
lnreader:masterfrom
RibatTRW:fm/lnreader-fucknovelpia-empty-chapter
Open

RibatTRW wants to merge 2 commits into
lnreader:masterfrom
RibatTRW:fm/lnreader-fucknovelpia-empty-chapter

Conversation

@RibatTRW

@RibatTRW RibatTRW commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Fix

Closes #2540. fucknovelpia.com intermittently serves anti-scrape pages instead of chapter content (nginx 403, a custom 429 "Blocked" page, a Cloudflare 429 page) — none containing the .reader wrapper. parseChapter ignored the HTTP status and returned '' when .reader was missing, so a throttled request rendered as a false empty chapter. The reported chapter is fine: on a 200 it serves the full ~13.5k chars. Reproduced pre-fix: a burst of 12 rapid calls turned a 429 into a zero-length chapter.

  • All fetches go through a shared helper sending browser-like headers, waiting out one 429 (honoring Retry-After, capped at 10s), and throwing with the HTTP status on refusal.
  • parseChapter throws when a 200 page has no reader markup instead of returning ''.
  • Version 1.1.1 → 1.1.2.

Verification

Burst re-test post-fix: 9 calls OK (retried 429s recovered to 200), 3 honest HTTP 429 throws, 0 silent empties. The reported chapter returns 13,577 chars with neighbors intact; parseNovel intact (1377 chapters with summary and cover). check:plugin passes all four steps; eslint, prettier, and build:compile clean on the touched file (repo-wide lint/format failures are pre-existing in untouched files).

Review follow-up

An AI review of this PR found one defect, fixed in the second commit:

  • Fixed: the site's real 429 responses (Cloudflare) have no Retry-After header. Number(null) is 0, so the retry fired immediately instead of after the intended 2s fallback. Across three live trials, an immediate retry never recovered, while a 2–5s wait sometimes did. The header is now parsed with parseInt, so a missing or non-numeric value falls back to 2s. Verified with a stubbed 429 response and no header: the wait before the retry went from 0 ms to 2000 ms.
  • No other defects confirmed. Every fetch path goes through fetchHtml, the live chapter/novel/search/updates pages return 200 with the expected markup, and the version bump to 1.1.2 still covers the unreleased change.

Ran: npm run check:plugin -- plugins/english/fucknovelpia.ts (all four checks pass), plus eslint and prettier --check on the file (both clean). No new tests, per the maintainers' request.

AI-authored change (original fix and review follow-up); no human review.

RibatTRW and others added 2 commits September 22, 2026 18:02
…ty chapters

fucknovelpia intermittently serves anti-scrape pages (nginx 403, a custom
"Blocked" 429 page, or a Cloudflare rate-limit page) whose bodies contain
no .reader markup. parseChapter ignored the HTTP status and returned ''
whenever .reader was missing, so a single throttled request rendered as an
empty chapter in LNReader (reproduced: HTTP 429 body has no reader markup,
parseChapter returned 0 chars).

Route all plugin fetches through a shared helper that sends browser-like
headers, waits out a 429 once (honoring Retry-After, capped at 10s), and
throws with the HTTP status on a refused response. parseChapter now also
throws when a 200 page has no reader markup instead of reporting a false
empty chapter.

Closes lnreader#2540

AI-authored (pi agent), human-reviewed before merge.

Co-Authored-By: firstmate-crewmate <crewmate@firstmate.local>
The site's 429 responses omit Retry-After; Number(null) is 0, so the
single retry fired immediately and hit the limiter again. Parse the
header explicitly so the 2s fallback applies.

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.

[FuckNovelpia] Empty chapter: City of Witches — Chapter 268

1 participant