From 1870aef60e18ce238e48c0a577bbb2b6300f40bb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Mar 2026 02:11:33 +0000 Subject: [PATCH 1/2] Initial plan From 03503115fd6b21878310e1c5c2bd9c69f708abfc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Mar 2026 02:18:53 +0000 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=E6=96=87=E5=8F=94=E5=8F=94(WS)?= =?UTF-8?q?=E5=9F=9F=E5=90=8D=E6=89=A9=E5=B1=95=20+=20=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: qaiu <29825328+qaiu@users.noreply.github.com> --- .../cn/qaiu/parser/PanDomainTemplate.java | 36 ++++++++++++- .../cn/qaiu/parser/PanDomainTemplateTest.java | 52 +++++++++++++++++++ 2 files changed, 86 insertions(+), 2 deletions(-) diff --git a/parser/src/main/java/cn/qaiu/parser/PanDomainTemplate.java b/parser/src/main/java/cn/qaiu/parser/PanDomainTemplate.java index c241d11..ee40514 100644 --- a/parser/src/main/java/cn/qaiu/parser/PanDomainTemplate.java +++ b/parser/src/main/java/cn/qaiu/parser/PanDomainTemplate.java @@ -142,9 +142,41 @@ public enum PanDomainTemplate { compile("https://qfile\\.qq\\.com/q/(?.+)"), "https://qfile.qq.com/q/{shareKey}", QQscTool.class), - // https://f.ws59.cn/f/或者https://www.wenshushu.cn/f/ + // https://f.ws59.cn/f/ 或者 https://www.wenshushu.cn/f/ 等多个镜像域名 + /* + f.wsNN.cn (如 f.ws59.cn, f.ws28.cn 等) + www.wenshushu.cn + 新增域名: + www.wenxiaozhan.net + www.wenxiaozhan.cn + www.wss.show + www.ws28.cn + www.wss.email + www.wss1.cn + www.ws59.cn + www.wss.cc + www.wss.pet + www.wss.ink + www.wenxiaozhan.com + www.wenshushu.com + www.wss.zone + */ WS("文叔叔", - compile("https://(f\\.ws(\\d{2})\\.cn|www\\.wenshushu\\.cn)/f/(?.+)"), + compile("https://(f\\.ws(\\d{2})\\.cn|" + + "www\\.wenxiaozhan\\.net|" + + "www\\.wenxiaozhan\\.cn|" + + "www\\.wss\\.show|" + + "www\\.ws28\\.cn|" + + "www\\.wss\\.email|" + + "www\\.wss1\\.cn|" + + "www\\.ws59\\.cn|" + + "www\\.wss\\.cc|" + + "www\\.wss\\.pet|" + + "www\\.wss\\.ink|" + + "www\\.wenxiaozhan\\.com|" + + "www\\.wenshushu\\.com|" + + "www\\.wss\\.zone|" + + "www\\.wenshushu\\.cn)/f/(?.+)"), "https://www.wenshushu.cn/f/{shareKey}", WsTool.class), // https://www.123pan.com/s/ diff --git a/parser/src/test/java/cn/qaiu/parser/PanDomainTemplateTest.java b/parser/src/test/java/cn/qaiu/parser/PanDomainTemplateTest.java index 55021ef..4370cb9 100644 --- a/parser/src/test/java/cn/qaiu/parser/PanDomainTemplateTest.java +++ b/parser/src/test/java/cn/qaiu/parser/PanDomainTemplateTest.java @@ -7,11 +7,14 @@ import java.util.Arrays; import java.util.Set; import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; +import java.util.regex.Pattern; import java.util.stream.Collectors; import static java.util.regex.Pattern.compile; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; /** * @author QAIU @@ -77,6 +80,55 @@ public class PanDomainTemplateTest { } + @Test + public void testWsPatternMatching() { + Pattern wsPattern = PanDomainTemplate.WS.getPattern(); + + // 历史域名 + String[] positiveUrls = { + "https://f.ws59.cn/f/f25625rv6p6", + "https://f.ws28.cn/f/somekey123", + "https://www.wenshushu.cn/f/abc123", + // 新增域名 + "https://www.wenxiaozhan.net/f/testkey1", + "https://www.wenxiaozhan.cn/f/testkey2", + "https://www.wss.show/f/testkey3", + "https://www.ws28.cn/f/testkey4", + "https://www.wss.email/f/testkey5", + "https://www.wss1.cn/f/testkey6", + "https://www.ws59.cn/f/testkey7", + "https://www.wss.cc/f/testkey8", + "https://www.wss.pet/f/testkey9", + "https://www.wss.ink/f/testkey10", + "https://www.wenxiaozhan.com/f/testkey11", + "https://www.wenshushu.com/f/testkey12", + "https://www.wss.zone/f/testkey13", + }; + + for (String url : positiveUrls) { + Matcher m = wsPattern.matcher(url); + assertTrue("WS pattern should match: " + url, m.matches()); + assertNotNull("KEY group should not be null for: " + url, m.group("KEY")); + } + + // 验证 KEY 提取正确性 + Matcher m1 = wsPattern.matcher("https://f.ws59.cn/f/f25625rv6p6"); + assertTrue(m1.matches()); + assertEquals("f25625rv6p6", m1.group("KEY")); + + Matcher m2 = wsPattern.matcher("https://www.wenshushu.cn/f/abc123"); + assertTrue(m2.matches()); + assertEquals("abc123", m2.group("KEY")); + + // 负例:错误路径不匹配 + assertFalse("Wrong path should not match", + wsPattern.matcher("https://www.wenshushu.cn/x/abc123").matches()); + + // 负例:非白名单域名不匹配 + assertFalse("Non-whitelisted domain should not match", + wsPattern.matcher("https://www.evil.com/f/abc123").matches()); + } + @Test public void verifyDuplicates() {