mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2026-04-10 19:06:55 +00:00
Compare commits
3 Commits
ed8fd66d1e
...
4a843194a3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4a843194a3 | ||
|
|
03503115fd | ||
|
|
1870aef60e |
@@ -142,9 +142,41 @@ public enum PanDomainTemplate {
|
||||
compile("https://qfile\\.qq\\.com/q/(?<KEY>.+)"),
|
||||
"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/(?<KEY>.+)"),
|
||||
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/(?<KEY>.+)"),
|
||||
"https://www.wenshushu.cn/f/{shareKey}",
|
||||
WsTool.class),
|
||||
// https://www.123pan.com/s/
|
||||
|
||||
@@ -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 <a href="https://qaiu.top">QAIU</a>
|
||||
@@ -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() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user