Conversation
|
| * scripts. Decode every payload into one searchable text blob. | ||
| */ | ||
| function extractFlightText(html: string): string { | ||
| const re = /self\.__next_f\.push\(\[1,"([\s\S]*?)"\]\)<\/script>/g; |
There was a problem hiding this comment.
| function parseChapterPage(flight: string): string | null { | ||
| if (/"locked":true/.test(flight)) return LOCKED_MESSAGE; | ||
| const m = /"body":\["([\s\S]*?)"\],"translatorNotes"/.exec(flight); | ||
| if (!m) return null; |
There was a problem hiding this comment.
Please add captured-payload tests for search and chapter parsing. The live checker accepts an empty search result and reads only the first chapter, so it cannot catch changes that make the query marker, locked-chapter check, or body extraction show unrelated results or unreadable chapters.
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!
Adds a source plugin for Nightjar Reads (https://nightjarreads.com), an English novel site running on Next.js. The site embeds its data in Next.js React Flight payloads, which the plugin decodes and parses.
Features:
Verification:
npm run check:plugin -- plugins/english/nightjarreads.tspasses all 4 checks (popularNovels, searchNovels, parseNovel, parseChapter)