Skip to content

feat: add Baka-Tsuki plugin (english) - #2380

Merged
rajarsheechatterjee merged 4 commits into
lnreader:masterfrom
pdmacinnes:feat/baka-tsuki-plugin
Aug 8, 2026
Merged

feat: add Baka-Tsuki plugin (english)#2380
rajarsheechatterjee merged 4 commits into
lnreader:masterfrom
pdmacinnes:feat/baka-tsuki-plugin

Conversation

@pdmacinnes

@pdmacinnes pdmacinnes commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Checklist

  • Update version code if an existing plugin was modified — new plugin, currently 1.1.0
  • Test changes in Plugin Playground or the app — see Verification below
  • Reference related issues in the PR body — no existing issue requests this source

Adds an English source plugin for Baka-Tsuki.

Baka-Tsuki runs MediaWiki 1.43 with an open read API, so the plugin talks to api.php rather than scraping rendered pages. That removes the usual wiki-scraper fragilities: sidebar/footer stripping and skin-layout drift.

Behaviour

  • BrowseCategory:Light novel (English) (160 titles), fetched once per session behind a shared promise and sliced 40/page. Covers batched 50 per request; failures fall back to the placeholder.
  • Filters — status (Active / Completed / Stalled / Inactive) and A–Z / Z–A.
  • Latestlist=recentchanges, with chapter edits rolled up to their parent project.
  • Search — title-first ranking (exact > prefix > substring > token) over the cached catalogue, augmented by prefixsearch and full-text. Page 2+ falls through to offset-paginated search.
  • Metadata — genres from Category:Genre - *, status from the project status categories, author from the author category. Author is omitted rather than guessed when it does not look like a personal name.

Notes for review

A few decisions that are not obvious from the diff:

  • Chapter lists are scraped, deliberately. Links are read from the project page in document order. list=allpages&apprefix= is the tidier API route but sorts alphabetically, which places Chapter 10 before Chapter 2. Chapters sort by volume ascending with ungrouped entries last.
  • Prefix aliasing. Chapters are not always filed under the full page title — Anohana: The Flower We Saw That Day keeps its chapters at Anohana:Part 1 Chapter 1. Both the full title and its first colon-segment are accepted; matching only the former returned zero chapters.
  • Chapter pages are filtered out of search by a strict colon rule. Filtering on "contains a colon" alone would break real projects (Anohana: …), and an English-word list leaked :Tome 1 Chapitre 1, :Tom 1 Rozdział 2, :Tập 2, :Act 1. Catalogue members are exempt, so outside the catalogue any colon disqualifies.
  • Empty projects are hidden from search. 32 of the 160 catalogue entries have no sub-pages at all. A surveyed suspicion list keeps the common case free of requests; each hit is verified with one bounded existence probe before being hidden, so a project that gains chapters un-hides itself. Probes fail open — a failed probe never hides a novel.
  • exintro is unusable here. Project pages open with wiki housekeeping, so the summary prefers an explicit synopsis section and filters boilerplate.
  • Array.from over spread for Set/Map iterators, since the repo targets ES5 without downlevelIteration.

Verification

Exercised against the live wiki across four differently shaped projects — standard (Absolute Duo, 58 ch), slash-titled (Fate/Zero, 119 ch), colon-titled (Anohana: …, 24 ch), irregular (Hidan no Aria, 45 ch) — plus missing-page and empty-project handling. All 57 checks pass.

Request budget: parseNovel 4 (chapter release times are batched 50/request and capped at 4 batches), parseChapter exactly 1. tsc --noEmit, eslint and prettier are clean locally.

Happy to adjust anything to house style.

Adds an English source plugin for Baka-Tsuki, built on the wiki's
MediaWiki API rather than HTML scraping.

- Catalogue unions the English-tagged categories (trusted verbatim) with
  the language-agnostic status categories filtered by a language-suffix
  pattern, since neither source alone is both complete and English-only.
  Cached per session behind a shared promise.
- Search ranks title-first (exact > prefix > substring > token) over the
  cached catalogue, augmented by prefixsearch and full-text. Chapter
  sub-pages are excluded by catalogue membership plus a strict colon
  rule, which holds across languages where enumerating chapter words
  ("Tome", "Rozdzial", "Tap") does not.
- Chapter lists are read from the project page in document order, the one
  place scraping beats the API: allpages is alphabetical and would place
  Chapter 10 before Chapter 2. Accepts both the full page title and its
  first colon-segment as a prefix, since some projects file chapters
  under a short name.
- Volume "Full Text" pages are dropped where individual chapters exist
  and kept where they are the only readable entry.
- Genres, status and author are derived from page categories; author is
  omitted rather than guessed when it does not look like a personal name.
- Summary prefers a synopsis section, as the lead section is usually wiki
  housekeeping.
- showLatestNovels maps to recentchanges, rolled up to parent projects.

Verified against the live wiki across four differently shaped projects
(standard, slash-titled, colon-titled, irregular): 51/51 checks pass.
parseNovel uses 4 requests, parseChapter exactly 1.
Drops the union with the language-agnostic status categories. Those are
now read only to populate the status map, so browse lists exactly the 160
titles in Category:Light novel (English), romanised as the wiki has them.

Also rejects parenthesised translation siblings ("Fate/Zero (Bielarus)")
from search results, which the colon rule did not catch.
Chapters sort by volume ascending with ungrouped entries last. Projects
with no sub-pages are hidden from search, verified per-hit so a revived
project un-hides itself.
@rajarsheechatterjee
rajarsheechatterjee merged commit 84b6176 into lnreader:master Aug 8, 2026
2 checks passed
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.

2 participants