Skip to content

Commit f87532e

Browse files
committed
🎉 Release v1.7.6
1 parent d719784 commit f87532e

7 files changed

Lines changed: 66 additions & 59 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
### ✨ 新特性
44

55
- 支持繁体中文(台湾) 、简体中文互转
6-
7-
- 新增书源6:[全本小说网](https://github.com/freeok/so-novel/issues/82)
6+
- 新增书源 6:[全本小说网](https://quanben5.com/) (https://github.com/freeok/so-novel/issues/82)
87

98
### 🐛 Bug 修复
109

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ APP。其实这些方案足够很多人用了,但总会有众口难调的情
5151
### 🍨 Scoop 安装
5252

5353
```bash
54-
# 若搜不到 so-novel,请先执行下面这一行命令
55-
scoop bucket add spc https://ghp.ci/https://github.com/lzwme/scoop-proxy-cn
54+
scoop bucket add spc https://gh.idayer.com/github.com/lzwme/scoop-proxy-cn
5655
scoop install so-novel
5756
```
5857

config.ini

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[base]
2-
# 语言 (可选值:zh_CN, zh_TW, zh_Hant)
2+
# 书籍内容的语言 (可选值:zh_CN, zh_TW, zh_Hant)
33
language = zh_CN
4-
# 启用书源 (只能选一个,可选值:1、2、3、4、5,不指定则随机使用)
4+
# 启用书源 (只能选一个,可选值:1, 2, 3, 4, 5, 6,不指定则随机使用)
55
source-id =
66
# 下载路径,绝对相对均可 (Windows 路径分隔符不要用 \ ,用 \\ 或 /)
77
download-path = downloads
@@ -14,19 +14,19 @@ interactive-mode = 1
1414

1515
[crawl]
1616
# 爬取最小间隔 (毫秒)
17-
min = 200
17+
min = 400
1818
# 爬取最大间隔 (毫秒)
19-
max = 500
19+
max = 1000
2020
# 爬取线程数,-1 表示自动设置
2121
threads = -1
2222

2323
[retry]
2424
# 最大重试次数 (针对首次下载失败的章节)
2525
max-attempts = 3
2626
# 重试爬取最小间隔 (毫秒)
27-
min = 1000
27+
min = 2000
2828
# 重试爬取最大间隔 (毫秒)
29-
max = 2500
29+
max = 5000
3030

3131
[proxy]
3232
# 是否启用 HTTP 代理 (1 开,0 关)

input/readme.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Linux 用户
88
运行 linux-run.sh
99

1010

11-
使用方法
11+
交互模式 2 (interactive-mode = 2) 使用方法
1212
1. 先按 Tab 键显示选项
1313
2. 再按 Tab 键切换选项
1414
3. 然后按 Enter 键选中
@@ -30,7 +30,7 @@ Linux 用户
3030
- 希望增加某个书源
3131
- 希望增加某个新功能
3232
上述情况请在此反馈:https://github.com/freeok/so-novel/issues/new/choose
33-
非上述情况在此反馈:https://github.com/freeok/so-novel/issues/new
33+
非上述情况在此反馈:https://github.com/freeok/so-novel/discussions/new/choose
3434

3535

3636
项目主页:https://github.com/freeok/so-novel

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.pcdd</groupId>
88
<artifactId>so-novel</artifactId>
9-
<version>1.7.5</version>
9+
<version>1.7.6</version>
1010
<packaging>jar</packaging>
1111

1212
<name>so-novel</name>

src/main/java/com/pcdd/sonovel/parse/SearchResultParser6.java

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
package com.pcdd.sonovel.parse;
22

33
import cn.hutool.core.io.resource.ResourceUtil;
4+
import cn.hutool.core.lang.Console;
45
import cn.hutool.core.lang.TypeReference;
56
import cn.hutool.core.text.UnicodeUtil;
67
import cn.hutool.core.util.ReUtil;
78
import cn.hutool.core.util.StrUtil;
89
import cn.hutool.http.HtmlUtil;
910
import cn.hutool.http.HttpRequest;
11+
import cn.hutool.http.HttpResponse;
1012
import cn.hutool.json.JSONUtil;
1113
import cn.hutool.script.ScriptUtil;
1214
import com.pcdd.sonovel.convert.ChineseConverter;
@@ -23,6 +25,7 @@
2325
import org.jsoup.select.Elements;
2426

2527
import java.util.ArrayList;
28+
import java.util.Collections;
2629
import java.util.List;
2730
import java.util.Map;
2831

@@ -56,21 +59,26 @@ public List<SearchResult> parse(String keyword) {
5659
if (config.getProxyEnabled() == 1)
5760
req.setHttpProxy(config.getProxyHost(), config.getProxyPort());
5861

59-
String body = req.execute().body();
60-
String s = UnicodeUtil.toString(body);
61-
String s2 = HtmlUtil.unescape(s)
62-
.replace("\\r", "")
63-
.replace("\\n", "")
64-
.replace("\\t", "")
65-
.replace("\\/", "/")
66-
.replace("\\\"", "'");
67-
String s3 = ReUtil.getGroup0("\\{(.*?)\\}", s2);
62+
try (HttpResponse resp = req.execute()) {
63+
String body = resp.body();
64+
String s = UnicodeUtil.toString(body);
65+
String s2 = HtmlUtil.unescape(s)
66+
.replace("\\r", "")
67+
.replace("\\n", "")
68+
.replace("\\t", "")
69+
.replace("\\/", "/")
70+
.replace("\\\"", "'");
71+
String s3 = ReUtil.getGroup0("\\{(.*?)\\}", s2);
6872

69-
String beginIndex = "\"content\":";
70-
String ans = s3.substring(s3.indexOf(beginIndex) + beginIndex.length(), s3.lastIndexOf("}"));
71-
List<SearchResult> firstPageResults = getSearchResults(Jsoup.parse(ans));
73+
String beginIndex = "\"content\":";
74+
String ans = s3.substring(s3.indexOf(beginIndex) + beginIndex.length(), s3.lastIndexOf("}"));
75+
List<SearchResult> firstPageResults = getSearchResults(Jsoup.parse(ans));
76+
return SearchResultsHandler.handle(firstPageResults);
7277

73-
return SearchResultsHandler.handle(firstPageResults);
78+
} catch (Exception e) {
79+
Console.error(e.getMessage());
80+
return Collections.emptyList();
81+
}
7482
}
7583

7684
@SneakyThrows

src/test/java/com/pcdd/sonovel/NewSourceTest.java

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -33,39 +33,6 @@ class NewSourceTest {
3333
config.setSourceId(6);
3434
}
3535

36-
@Test
37-
void crackSearch() {
38-
String kw = "我吃西红柿";
39-
String js = ResourceUtil.readUtf8Str("js/rule-6.js");
40-
Object key = ScriptUtil.invoke(js, "getParamB", kw);
41-
42-
Source source = new Source(6);
43-
Rule.Search ruleSearch = source.rule.getSearch();
44-
String param = ruleSearch.getData().formatted(key, kw);
45-
/* JSONObject obj = JSONUtil.parseObj(param);
46-
System.out.println(JSONUtil.toJsonPrettyStr(obj)); */
47-
48-
Map<String, String> map = JSONUtil.toBean(param, Map.class);
49-
HttpRequest req = HttpRequest
50-
.get(ruleSearch.getUrl())
51-
.header("Referer", ruleSearch.getUrl() + "search.html")
52-
.formStr(map);
53-
54-
System.out.println(req.form());
55-
String body = req.execute().body();
56-
String s = UnicodeUtil.toString(body);
57-
String s2 = HtmlUtil.unescape(s)
58-
.replace("\\r", "")
59-
.replace("\\n", "")
60-
.replace("\\t", "")
61-
.replace("\\/", "/")
62-
.replace("\\\"", "'");
63-
String s4 = ReUtil.getGroup0("\\{(.*?)\\}", s2);
64-
JSONObject jsonObject = JSONUtil.parseObj(s4);
65-
String html = jsonObject.getStr("content");
66-
System.out.println(Jsoup.parse(html));
67-
}
68-
6936
@Test
7037
void searchParse() {
7138
SearchResultParser sr = new SearchResultParser(config);
@@ -97,4 +64,38 @@ void chapterParse() {
9764
System.out.println(chapterParser.parse(chapter));
9865
}
9966

67+
68+
@Test
69+
void crackSearch6() {
70+
String kw = "我吃西红柿";
71+
String js = ResourceUtil.readUtf8Str("js/rule-6.js");
72+
Object key = ScriptUtil.invoke(js, "getParamB", kw);
73+
74+
Source source = new Source(config);
75+
Rule.Search ruleSearch = source.rule.getSearch();
76+
String param = ruleSearch.getData().formatted(kw, key);
77+
JSONObject obj = JSONUtil.parseObj(param);
78+
System.out.println(JSONUtil.toJsonPrettyStr(obj));
79+
80+
Map<String, String> map = JSONUtil.toBean(param, Map.class);
81+
HttpRequest req = HttpRequest
82+
.get(ruleSearch.getUrl())
83+
.header("Referer", ruleSearch.getUrl() + "search.html")
84+
.formStr(map);
85+
86+
System.out.println(req.form());
87+
String body = req.execute().body();
88+
String s = UnicodeUtil.toString(body);
89+
String s2 = HtmlUtil.unescape(s)
90+
.replace("\\r", "")
91+
.replace("\\n", "")
92+
.replace("\\t", "")
93+
.replace("\\/", "/")
94+
.replace("\\\"", "'");
95+
String s4 = ReUtil.getGroup0("\\{(.*?)\\}", s2);
96+
JSONObject jsonObject = JSONUtil.parseObj(s4);
97+
String html = jsonObject.getStr("content");
98+
System.out.println(Jsoup.parse(html));
99+
}
100+
100101
}

0 commit comments

Comments
 (0)