Skip to content

Commit 8042bf9

Browse files
committed
🔍 优化书源规则
1 parent 57e4e8d commit 8042bf9

20 files changed

Lines changed: 31 additions & 27 deletions

src/main/java/com/pcdd/sonovel/convert/ChineseConverter.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ private <T> T applyConversion(T obj, Function<String, String> convertFunc) {
4848
book.setCategory(convertIfNotNull(book.getCategory(), convertFunc));
4949
book.setLatestChapter(convertIfNotNull(book.getLatestChapter(), convertFunc));
5050
book.setLatestUpdate(convertIfNotNull(book.getLatestUpdate(), convertFunc));
51-
book.setIsEnd(convertIfNotNull(book.getIsEnd(), convertFunc));
51+
book.setStatus(convertIfNotNull(book.getStatus(), convertFunc));
5252
return (T) book;
5353
}
5454

@@ -62,8 +62,11 @@ private <T> T applyConversion(T obj, Function<String, String> convertFunc) {
6262
sr.setBookName(convertIfNotNull(sr.getBookName(), convertFunc));
6363
sr.setAuthor(convertIfNotNull(sr.getAuthor(), convertFunc));
6464
sr.setIntro(convertIfNotNull(sr.getIntro(), convertFunc));
65+
sr.setCategory(convertIfNotNull(sr.getCategory(), convertFunc));
6566
sr.setLatestChapter(convertIfNotNull(sr.getLatestChapter(), convertFunc));
6667
sr.setLatestUpdate(convertIfNotNull(sr.getLatestUpdate(), convertFunc));
68+
sr.setWordCount(convertIfNotNull(sr.getWordCount(), convertFunc));
69+
sr.setStatus(convertIfNotNull(sr.getStatus(), convertFunc));
6770
return (T) sr;
6871
}
6972

src/main/java/com/pcdd/sonovel/model/Book.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ public class Book {
1818
private String coverUrl;
1919
private String latestChapter;
2020
private String latestUpdate;
21-
private String isEnd;
21+
private String status;
2222

2323
}

src/main/java/com/pcdd/sonovel/model/Rule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public static class Book {
5555
private String coverUrl;
5656
private String latestChapter;
5757
private String latestUpdate;
58-
private String isEnd;
58+
private String status;
5959
}
6060

6161
@Data

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,14 @@ private List<SearchResult> getSearchResults(String url, Connection.Response resp
115115
return Collections.emptyList();
116116
}
117117

118-
SearchResult build = SearchResult.builder()
118+
SearchResult sr = SearchResult.builder()
119119
.url(bookUrl)
120120
.bookName(book.getBookName())
121121
.author(book.getAuthor())
122122
.latestChapter(book.getLatestChapter())
123123
.latestUpdate(book.getLatestUpdate())
124124
.build();
125-
list.add(build);
125+
list.add(ChineseConverter.convert(sr, this.rule.getLanguage(), config.getLanguage()));
126126
Thread.sleep(CrawlUtils.randomInterval(config));
127127

128128
return list;

src/main/resources/rule/rule-1.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
"author": "meta[property=\"og:novel:author\"]",
2121
"intro": "meta[property=\"og:description\"]",
2222
"category": "meta[property=\"og:novel:category\"]",
23-
"coverUrl": "meta[property=\"og:image\"]",
24-
"isEnd": false
23+
"coverUrl": "meta[property=\"og:image\"]"
2524
},
2625
"toc": {
2726
"result": "#list > dl > dd > a",

src/main/resources/rule/rule-10.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"coverUrl": "meta[name=\"og:image\"]",
2222
"latestChapter": "meta[name=\"og:novel:latest_chapter_name\"]",
2323
"latestUpdate": "meta[name=\"og:novel:update_time\"]",
24-
"isEnd": "meta[name=\"og:novel:status\"]"
24+
"status": "meta[name=\"og:novel:status\"]"
2525
},
2626
"toc": {
2727
"result": ".full_chapters > div:nth-child(1) > a",

src/main/resources/rule/rule-11.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222
"category": "meta[property=\"og:novel:category\"]",
2323
"coverUrl": "meta[property=\"og:image\"]",
2424
"latestChapter": "meta[property=\"og:novel:latest_chapter_name\"]",
25-
"latestUpdate": "meta[property=\"og:novel:update_time\"]",
26-
"isEnd": false
25+
"latestUpdate": "meta[property=\"og:novel:update_time\"]"
2726
},
2827
"toc": {
2928
"result": "#list > dl > dd > a",

src/main/resources/rule/rule-12.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"coverUrl": "meta[property=\"og:image\"]",
2929
"latestChapter": "meta[property=\"og:novel:latest_chapter_name\"]",
3030
"latestUpdate": "meta[property=\"og:novel:update_time\"]",
31-
"isEnd": "meta[property=\"og:novel:status\"]"
31+
"status": "meta[property=\"og:novel:status\"]"
3232
},
3333
"toc": {
3434
"url": "https://www.0xs.net/list/%s.html",

src/main/resources/rule/rule-13.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"coverUrl": ".item > a > img",
2626
"latestChapter": ".item > div > ul > li:nth-child(1) > a",
2727
"latestUpdate": ".item > div > ul > li:nth-child(1) > i",
28-
"isEnd": ".item > div > p:nth-child(2) > span:nth-child(1)"
28+
"status": ".item > div > p:nth-child(2) > span:nth-child(1)"
2929
},
3030
"toc": {
3131
"result": "#list > ul > li > a"

src/main/resources/rule/rule-14.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"coverUrl": ".imgbox > img",
2626
"latestChapter": "meta[property=\"og:novel:lastest_chapter_name\"]",
2727
"latestUpdate": "meta[property=\"og:novel:update_time\"]",
28-
"isEnd": "meta[property=\"og:novel:status\"]"
28+
"status": "meta[property=\"og:novel:status\"]"
2929
},
3030
"toc": {
3131
"result": ".row.row-section > div > div:nth-child(4) > ul > li > a",

0 commit comments

Comments
 (0)