Repository navigation
Conversation
- author: read the byline (one author link per creator) and fall back to its text, so translated works no longer show up to 58 names and anonymous works are no longer blank - stats: read dl.stats dt/dd pairs; the old dd.stats li a.tag matches nothing - summary: scope to .summary blockquote.userstuff, not every blockquote - classify responses: a guest login page, the adult interstitial, a Cloudflare challenge and a 429 all arrive as usable-looking responses today, so a restricted work parsed as an Untitled novel with a blank chapter. They now throw the matching PluginError with an actionable message. - add offline fixture tests in scripts/test-ao3.js (pnpm check:plugin cannot reach AO3 from a non-browser TLS stack) version: 1.2.0
[Medium impact] The changes affect AO3 reading and discovery flows, but stay within that plugin. Reject unhandled HTTP failures before merging so server errors cannot become blank chapters or incorrect chapter lists. Findings
SummaryUpdates the AO3 plugin to
Acknowledged behavior: JKJapona explicitly intends HTTP 503 to be reported as a bot check, as stated in the PR description and tests. Reviews (1) · Last reviewed commit: "fix(english/ao3): scope byline, stats an..." · Reviewed by Greptile |
| return { kind: 'adult-gate', html }; | ||
| } | ||
|
|
||
| return { kind: 'ok', html }; |
There was a problem hiding this comment.
Server errors become blank chapters
classifyPage accepts HTTP failures such as 500 and 502 as ok when their bodies lack the listed markers. fetchApi does not reject HTTP errors, so a plain “Bad Gateway” page reaches the parsers. parseChapter returns an empty string, while a failed chapter index makes parseNovel replace the chapter list with one fallback entry.
The previous checkResponse rejected these responses. Keep the specific classifications, then reject any remaining response where res.ok is false.
Fixes four parsing defects in the AO3 plugin (version
1.1.0→1.2.0).a[rel="author"]on the page — a translated fic listed 58 authors.byline a[rel="author"], joined with,; falls back to the byline text for anonymous worksdd.stats li a.tagmatches nothing — the block was always emptydl.statsdt/ddpairsblockquote.userstuff(up to 3) — author's notes leaked in.summary blockquote.userstuffPluginErrorDetails
a[rel="author"]per creator in.byline, but also links the authors of translations and related works inside the notes. Scoping to the byline fixes the 58-name case and leaves co-written works correct (InfiniteTickingClock37, Spiritmander13).dl.statsdt/dd..summary blockquote.userstuffis the only summary container; the other blockquotes on the page are notes.fetchPagenow classifies every response intook / adult-gate / login-required / challenge / rate-limited / not-foundand throws the matching canonicalPluginError(AuthRequired,Captcha,RateLimited,NovelNotFound,InvalidResponse), so a restricted work says "log in" instead of showing nothing. The login page is identified by two signals — no#chaptersand (restricted=trueor a/users/loginfinal URL) — so a normal page that merely links torestricted=truestill parses. There is a test for that case.Tests
scripts/test-ao3.js— 15 tests, no network:The fixtures in
scripts/fixtures/ao3/are real pages captured as a guest (~206 KB;<style>/<script>stripped, nothing reads them). They cover a 58-author work, a co-written work, an anonymous work, a one-shot, a restricted login page, the adult interstitial and a 188-chapter index. The test builds the plugin with esbuild and stubs only@libs/fetch;@libs/pluginErroris compiled for real, so the asserted error codes are the production ones. Not wired intopackage.json, matchingscripts/test-royalroad.js.Verification
node --test scripts/test-ao3.jstsc --noEmit -p tsconfig.jsonao3.ts(108 pre-existing repo-wide)node scripts/live-check-plugin.js plugins/english/ao3.tsOn the live check: AO3 sits behind Cloudflare, which rejects a non-browser TLS fingerprint regardless of headers. In the same minute Chromium got 200 (with and without cookies) while Node
fetchgot 429 andcurl429/503.check:plugintherefore cannot validate this plugin from a server network; the fixture tests are the real signal. This is also why rate limit and challenge map to INCONCLUSIVE rather than FAIL.