From 3eed4fed24a62f47d799a3d7fea374a11757e758 Mon Sep 17 00:00:00 2001 From: Palloxin <75091899+Palloxin@users.noreply.github.com> Date: Sun, 2 Feb 2025 14:06:03 +0100 Subject: [PATCH] perf: LightnovelWP - Faster and Safer Regex (#1476) * LightnovelWP - faster and safer regex * version increment + a forgot regex --- scripts/multisrc/lightnovelwp/template.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/multisrc/lightnovelwp/template.ts b/scripts/multisrc/lightnovelwp/template.ts index cd65593..cfc1a7a 100644 --- a/scripts/multisrc/lightnovelwp/template.ts +++ b/scripts/multisrc/lightnovelwp/template.ts @@ -42,7 +42,7 @@ class LightNovelWPPlugin implements Plugin.PluginBase { this.icon = `multisrc/lightnovelwp/${metadata.id.toLowerCase()}/icon.png`; this.site = metadata.sourceSite; const versionIncrements = metadata.options?.versionIncrements || 0; - this.version = `1.1.${5 + versionIncrements}`; + this.version = `1.1.${6 + versionIncrements}`; this.options = metadata.options ?? ({} as LightNovelWPOptions); this.filters = metadata.filters satisfies Filters; @@ -96,14 +96,14 @@ class LightNovelWPPlugin implements Plugin.PluginBase { html = load(html).html(); // fix "'" beeing replaced by "’" (html entities) const novels: Plugin.NovelItem[] = []; - const articles = html.match(//g) || []; + const articles = html.match(//g) || []; articles.forEach(article => { const [, novelUrl, novelName] = - article.match(//) || []; + article.match(/]*?src="([^\"]*)"[^>]*?(?: data-src="([^\"]*)")?[^>]*>/) || []; let novelPath; if (novelUrl.includes(this.site)) { @@ -434,8 +434,8 @@ class LightNovelWPPlugin implements Plugin.PluginBase { } return ( data - .match(/