From 0836f02ab86f99ff1176427cae31dcee67811a60 Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Wed, 22 Apr 2026 13:19:10 +0700 Subject: [PATCH] refactor(loldle): source all champion data from loldle.net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit loldle.net's JS bundle ships the complete set of classic-mode axes in plaintext, so ddragon merging is no longer needed. Scraper now produces the final schema directly. Schema changes: drop title, skinCount, image, and genre (ddragon-only). Replace genre (class tags like Fighter/Mage) with species (Human/Darkin/ Vastayan) — the axis loldle.net actually uses. Promote region to a multi-value field so multi-region champions compare correctly. Handlers no longer show "Name — Title" on win/giveup. --- .github/workflows/scrape-loldle-data.yml | 17 +- scripts/scrape-loldle-data.js | 94 +- src/modules/loldle/champions-data.js | 3249 +++++----------------- src/modules/loldle/champions.json | 3249 +++++----------------- src/modules/loldle/compare.js | 11 +- src/modules/loldle/handlers.js | 6 +- tests/modules/loldle/compare.test.js | 26 +- tests/modules/loldle/render.test.js | 2 +- 8 files changed, 1443 insertions(+), 5211 deletions(-) diff --git a/.github/workflows/scrape-loldle-data.yml b/.github/workflows/scrape-loldle-data.yml index cc4d318..5b92d33 100644 --- a/.github/workflows/scrape-loldle-data.yml +++ b/.github/workflows/scrape-loldle-data.yml @@ -1,11 +1,12 @@ name: scrape-loldle-data # Rebuilds src/modules/loldle/champions.json every Monday 06:00 UTC by -# scraping loldle.net's JS bundle + merging ddragon championFull. -# Opens a PR if the output changed. Manually triggerable from Actions tab. +# scraping loldle.net's JS bundle (sole source of truth for classic-mode +# fields). Opens a PR if the output changed. Manually triggerable from the +# Actions tab. # -# Note: the bundled data is shipped with the Worker — the change only takes -# effect after `npm run deploy` is run on the updated main branch. +# Note: the bundled data ships with the Worker — the change only takes effect +# after `npm run deploy` is run on the updated main branch. on: schedule: @@ -41,11 +42,9 @@ jobs: title: "data: weekly loldle.net champion refresh" body: | Automated weekly refresh of `src/modules/loldle/champions.json` - from loldle.net + ddragon championFull. - - Fields sourced from loldle.net: `gender`, `attackType`, `lane`, - `region`, `releaseDate`. Display fields (`title`, `resource`, - `genre`, `skinCount`, `image`) come from ddragon. + from loldle.net's JS bundle — the canonical source for all + classic-mode fields (`gender`, `species`, `resource`, + `attackType`, `region`, `lane`, `releaseDate`). Review the diff, merge, then run `npm run deploy` to ship. add-paths: | diff --git a/scripts/scrape-loldle-data.js b/scripts/scrape-loldle-data.js index bc3896d..f295a88 100644 --- a/scripts/scrape-loldle-data.js +++ b/scripts/scrape-loldle-data.js @@ -1,16 +1,15 @@ #!/usr/bin/env node /** - * @file scrape-loldle-data — rebuilds src/modules/loldle/champions.json by - * scraping loldle.net for canonical game fields (gender, positions, - * range_type, regions, release_date) and merging with ddragon championFull - * for display fields (title, resource, genre tags, skin count, sprite image). + * @file scrape-loldle-data — rebuilds src/modules/loldle/champions.json from + * loldle.net's JS bundle, the canonical source for the classic-mode axes: + * gender, species, resource, attackType, region, lane, releaseDate. + * + * loldle.net embeds the full champion array in plaintext inside its JS bundle + * at `