From a8df57f1659b0ac82bfd31c8f960604f940350a8 Mon Sep 17 00:00:00 2001 From: Codex Date: Tue, 13 Oct 2026 23:58:33 +0200 Subject: [PATCH] Recognize additional WeebCentral chapter labels and record source pilot --- scraper/plugins/weebcentral.js | 2 +- scraper/test/scraper.test.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scraper/plugins/weebcentral.js b/scraper/plugins/weebcentral.js index 7e83b0e..cf92892 100644 --- a/scraper/plugins/weebcentral.js +++ b/scraper/plugins/weebcentral.js @@ -16,7 +16,7 @@ function catalog({ html, url }) { for (const match of html.matchAll(re)) { const text = decode(match[3]).replace(/\s+/g, ' '); const season = Number(text.match(/^S(\d+)\s*-/i)?.[1] || 0) || null; - const regular = text.match(/\b(?:Chapter|Rating|Episode|Night|Log|Act)\s*[.:]?\s*([0-9]+(?:\.[0-9]+)?)/i)?.[1]; + const regular = text.match(/\b(?:Chapter|Rating|Episode|Night|Log|Act|Scene|Kapitel|File|Battle)\s*[.:]?\s*([0-9]+(?:\.[0-9]+)?)/i)?.[1]; const prologue = text.match(/Prologue(?:\s+([0-9]+))?/i)?.[1]; const number = regular || (prologue ? `0.${prologue.padStart(2, '0')}` : /Prologue/i.test(text) ? '0' : null); if (number) found.push({ diff --git a/scraper/test/scraper.test.js b/scraper/test/scraper.test.js index 2cb9360..eae2bcb 100644 --- a/scraper/test/scraper.test.js +++ b/scraper/test/scraper.test.js @@ -245,8 +245,8 @@ test('paused legacy work is validated, published, and converted to incremental m }); test('WeebCentral fragments preserve chapter and page order', () => { - const chapters = parseChapters('Prologue 1Chapter 12Chapter 12.5S2 - Chapter 1Rating 442Last ReadEpisode 128Last ReadEpisode: 78Last ReadNight 182Last ReadLog. 65Act 60.6', 'https://weebcentral.com/s'); - assert.deepEqual(chapters.map(item => item.number), ['0.01', '12', '12.5', '1', '442', '128', '78', '182', '65', '60.6']); + const chapters = parseChapters('Prologue 1Chapter 12Chapter 12.5S2 - Chapter 1Rating 442Last ReadEpisode 128Last ReadEpisode: 78Last ReadNight 182Last ReadLog. 65Act 60.6Scene 155Kapitel 162File 83Battle 281', 'https://weebcentral.com/s'); + assert.deepEqual(chapters.map(item => item.number), ['0.01', '12', '12.5', '1', '442', '128', '78', '182', '65', '60.6', '155', '162', '83', '281']); assert.deepEqual(chapters[3].book, { number: 2, title: 'Season 2' }); const pages = parsePageUrls('', 'https://weebcentral.com/c'); assert.deepEqual(pages, ['https://weebcentral.com/001.png', 'https://img.example/002.webp']);