mirror of
https://github.com/201206030/novel-plus.git
synced 2025-07-04 16:26:40 +00:00
Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
efb136e3be | |||
7955db0e3c | |||
60dc28c5ed | |||
1534220f0c | |||
0830f6ffeb | |||
adc83db64e | |||
9c11f22816 | |||
24abe7714f | |||
a9fc80eba1 |
@ -9,7 +9,7 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
👉 <a href='https://novel.xxyopen.com'>官网</a> | 👉 <a href='https://www.bilibili.com/video/BV1Zo4y187Mi'>项目演示</a> | 👉 <a href='https://docs.xxyopen.com/course/novelplus/1.html'>安装教程</a>
|
👉 <a href='https://novel.xxyopen.com'>官网</a> | 👉 <a href='http://117.72.165.13:8888'>演示站点</a> | 👉 <a href='https://docs.xxyopen.com/course/novelplus/1.html'>安装教程</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
## 项目介绍
|
## 项目介绍
|
||||||
@ -22,7 +22,7 @@ TXT 文本存储)、阅读主题切换、多爬虫源自动采集和更新数
|
|||||||
|
|
||||||
- 学习版:[GitHub](https://github.com/201206030/novel) | [码云](https://gitee.com/novel_dev_team/novel)
|
- 学习版:[GitHub](https://github.com/201206030/novel) | [码云](https://gitee.com/novel_dev_team/novel)
|
||||||
| [保姆级教程](https://docs.xxyopen.com)
|
| [保姆级教程](https://docs.xxyopen.com)
|
||||||
- **应用版**:[GitHub](https://github.com/201206030/novel-plus) | [码云](https://gitee.com/novel_dev_team/novel-plus)
|
- **应用版**:[GitHub](https://github.com/201206030/novel-plus) | [码云](https://gitee.com/novel_dev_team/novel-plus) | [演示站点](http://117.72.165.13:8888)
|
||||||
- 微服务版:[GitHub](https://github.com/201206030/novel-cloud) | [码云](https://gitee.com/novel_dev_team/novel-cloud)
|
- 微服务版:[GitHub](https://github.com/201206030/novel-cloud) | [码云](https://gitee.com/novel_dev_team/novel-cloud)
|
||||||
|
|
||||||
## 项目结构
|
## 项目结构
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<groupId>com.java2nb</groupId>
|
<groupId>com.java2nb</groupId>
|
||||||
<artifactId>novel-admin</artifactId>
|
<artifactId>novel-admin</artifactId>
|
||||||
<version>5.1.3</version>
|
<version>5.1.5</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>novel-admin</name>
|
<name>novel-admin</name>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>novel</artifactId>
|
<artifactId>novel</artifactId>
|
||||||
<groupId>com.java2nb</groupId>
|
<groupId>com.java2nb</groupId>
|
||||||
<version>5.1.3</version>
|
<version>5.1.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@ import org.springframework.http.*;
|
|||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Administrator
|
* @author Administrator
|
||||||
@ -16,7 +16,7 @@ public class HttpUtil {
|
|||||||
|
|
||||||
private static final String DEFAULT_CHARSET = "utf-8";
|
private static final String DEFAULT_CHARSET = "utf-8";
|
||||||
|
|
||||||
private static final Map<String, RestTemplate> REST_TEMPLATE_MAP = new HashMap<>();
|
private static final Map<String, RestTemplate> REST_TEMPLATE_MAP = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public static String getByHttpClientWithChrome(String url, String charset) {
|
public static String getByHttpClientWithChrome(String url, String charset) {
|
||||||
log.debug("Get url:{}", url);
|
log.debug("Get url:{}", url);
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>novel</artifactId>
|
<artifactId>novel</artifactId>
|
||||||
<groupId>com.java2nb</groupId>
|
<groupId>com.java2nb</groupId>
|
||||||
<version>5.1.3</version>
|
<version>5.1.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -100,6 +100,22 @@ public class CrawlParser {
|
|||||||
.replaceAll("<p>\\s*</p>", "")
|
.replaceAll("<p>\\s*</p>", "")
|
||||||
.replaceAll("<p>", "")
|
.replaceAll("<p>", "")
|
||||||
.replaceAll("</p>", "<br/>");
|
.replaceAll("</p>", "<br/>");
|
||||||
|
// 小说简介过滤
|
||||||
|
String filterDesc = ruleBean.getFilterDesc();
|
||||||
|
if (StringUtils.isNotBlank(filterDesc)) {
|
||||||
|
String[] filterRules = filterDesc.replace("\r\n", "\n").split("\n");
|
||||||
|
for (String filterRule : filterRules) {
|
||||||
|
if (StringUtils.isNotBlank(filterRule)) {
|
||||||
|
desc = desc.replaceAll(filterRule, "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 去除小说简介前后空格
|
||||||
|
desc = desc.trim();
|
||||||
|
// 去除小说简介末尾冗余的小说名
|
||||||
|
if (desc.endsWith(bookName)) {
|
||||||
|
desc = desc.substring(0, desc.length() - bookName.length());
|
||||||
|
}
|
||||||
//设置书籍简介
|
//设置书籍简介
|
||||||
book.setBookDesc(desc);
|
book.setBookDesc(desc);
|
||||||
if (StringUtils.isNotBlank(ruleBean.getStatusPatten())) {
|
if (StringUtils.isNotBlank(ruleBean.getStatusPatten())) {
|
||||||
@ -151,7 +167,7 @@ public class CrawlParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean parseBookIndexAndContent(String sourceBookId, Book book, RuleBean ruleBean,
|
public boolean parseBookIndexAndContent(String sourceBookId, Book book, RuleBean ruleBean,
|
||||||
Map<Integer, BookIndex> existBookIndexMap, CrawlBookChapterHandler handler) throws InterruptedException{
|
Map<Integer, BookIndex> existBookIndexMap, CrawlBookChapterHandler handler) throws InterruptedException {
|
||||||
|
|
||||||
Date currentDate = new Date();
|
Date currentDate = new Date();
|
||||||
|
|
||||||
@ -238,6 +254,8 @@ public class CrawlParser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 去除小说内容末尾的所有换行
|
||||||
|
content = removeTrailingBrTags(content);
|
||||||
//插入章节目录和章节内容
|
//插入章节目录和章节内容
|
||||||
BookIndex bookIndex = new BookIndex();
|
BookIndex bookIndex = new BookIndex();
|
||||||
bookIndex.setIndexName(indexName);
|
bookIndex.setIndexName(indexName);
|
||||||
@ -314,4 +332,12 @@ public class CrawlParser {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除字符串末尾的所有 <br> 类似标签(允许各种空格)
|
||||||
|
*/
|
||||||
|
public static String removeTrailingBrTags(String str) {
|
||||||
|
return str.replaceAll("(?i)(?:\\s*<\\s*br\\s*/?\\s*>)++(?:\\s|\\u3000)*$", "");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,7 @@ public class RuleBean {
|
|||||||
private String visitCountPatten;
|
private String visitCountPatten;
|
||||||
private String descStart;
|
private String descStart;
|
||||||
private String descEnd;
|
private String descEnd;
|
||||||
|
private String filterDesc;
|
||||||
private String upadateTimePatten;
|
private String upadateTimePatten;
|
||||||
private String upadateTimeFormatPatten;
|
private String upadateTimeFormatPatten;
|
||||||
private String bookIndexUrl;
|
private String bookIndexUrl;
|
||||||
|
@ -118,6 +118,9 @@
|
|||||||
示例:<b></p></b>
|
示例:<b></p></b>
|
||||||
<li><input type="text" id="descEnd" class="s_input icon_key" placeholder="小说简介结束截取字符串:">
|
<li><input type="text" id="descEnd" class="s_input icon_key" placeholder="小说简介结束截取字符串:">
|
||||||
</li>
|
</li>
|
||||||
|
示例:<b><span\s+class="allshow">([^/]+)</span></b>
|
||||||
|
<li><textarea id="filterDesc"
|
||||||
|
placeholder="过滤简介(多个内容换行)" rows="5" cols="52"></textarea></li>
|
||||||
示例:<b>更新:(\d+-\d+-\d+\s\d+:\d+:\d+)</a></b>
|
示例:<b>更新:(\d+-\d+-\d+\s\d+:\d+:\d+)</a></b>
|
||||||
<li><input type="text" id="upadateTimePatten" class="s_input icon_key"
|
<li><input type="text" id="upadateTimePatten" class="s_input icon_key"
|
||||||
placeholder="小说更新时间的正则表达式:"></li>
|
placeholder="小说更新时间的正则表达式:"></li>
|
||||||
@ -338,6 +341,9 @@
|
|||||||
|
|
||||||
crawlRule.descEnd = descEnd;
|
crawlRule.descEnd = descEnd;
|
||||||
|
|
||||||
|
var filterDesc = $("#filterDesc").val();
|
||||||
|
crawlRule.filterDesc = filterDesc;
|
||||||
|
|
||||||
var upadateTimePatten = $("#upadateTimePatten").val();
|
var upadateTimePatten = $("#upadateTimePatten").val();
|
||||||
|
|
||||||
if (upadateTimePatten.length > 0) {
|
if (upadateTimePatten.length > 0) {
|
||||||
|
@ -119,6 +119,9 @@
|
|||||||
示例:<b></p></b>
|
示例:<b></p></b>
|
||||||
<li><input type="text" id="descEnd" class="s_input icon_key" placeholder="小说简介结束截取字符串:">
|
<li><input type="text" id="descEnd" class="s_input icon_key" placeholder="小说简介结束截取字符串:">
|
||||||
</li>
|
</li>
|
||||||
|
示例:<b><span\s+class="allshow">([^/]+)</span></b>
|
||||||
|
<li><textarea id="filterDesc"
|
||||||
|
placeholder="过滤简介(多个内容换行)" rows="5" cols="52"></textarea></li>
|
||||||
示例:<b>更新:(\d+-\d+-\d+\s\d+:\d+:\d+)</a></b>
|
示例:<b>更新:(\d+-\d+-\d+\s\d+:\d+:\d+)</a></b>
|
||||||
<li><input type="text" id="upadateTimePatten" class="s_input icon_key"
|
<li><input type="text" id="upadateTimePatten" class="s_input icon_key"
|
||||||
placeholder="小说更新时间的正则表达式:"></li>
|
placeholder="小说更新时间的正则表达式:"></li>
|
||||||
@ -266,6 +269,7 @@
|
|||||||
$("#visitCountPatten").val(crawlRule.visitCountPatten);
|
$("#visitCountPatten").val(crawlRule.visitCountPatten);
|
||||||
$("#descStart").val(crawlRule.descStart);
|
$("#descStart").val(crawlRule.descStart);
|
||||||
$("#descEnd").val(crawlRule.descEnd);
|
$("#descEnd").val(crawlRule.descEnd);
|
||||||
|
$("#filterDesc").val(crawlRule.filterDesc);
|
||||||
$("#upadateTimePatten").val(crawlRule.upadateTimePatten);
|
$("#upadateTimePatten").val(crawlRule.upadateTimePatten);
|
||||||
$("#upadateTimeFormatPatten").val(crawlRule.upadateTimeFormatPatten);
|
$("#upadateTimeFormatPatten").val(crawlRule.upadateTimeFormatPatten);
|
||||||
$("#bookIndexUrl").val(crawlRule.bookIndexUrl);
|
$("#bookIndexUrl").val(crawlRule.bookIndexUrl);
|
||||||
@ -424,6 +428,9 @@
|
|||||||
|
|
||||||
crawlRule.descEnd = descEnd;
|
crawlRule.descEnd = descEnd;
|
||||||
|
|
||||||
|
var filterDesc = $("#filterDesc").val();
|
||||||
|
crawlRule.filterDesc = filterDesc;
|
||||||
|
|
||||||
var upadateTimePatten = $("#upadateTimePatten").val();
|
var upadateTimePatten = $("#upadateTimePatten").val();
|
||||||
|
|
||||||
if (upadateTimePatten.length > 0) {
|
if (upadateTimePatten.length > 0) {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>novel</artifactId>
|
<artifactId>novel</artifactId>
|
||||||
<groupId>com.java2nb</groupId>
|
<groupId>com.java2nb</groupId>
|
||||||
<version>5.1.3</version>
|
<version>5.1.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
2
pom.xml
2
pom.xml
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<groupId>com.java2nb</groupId>
|
<groupId>com.java2nb</groupId>
|
||||||
<artifactId>novel</artifactId>
|
<artifactId>novel</artifactId>
|
||||||
<version>5.1.3</version>
|
<version>5.1.5</version>
|
||||||
<modules>
|
<modules>
|
||||||
<module>novel-common</module>
|
<module>novel-common</module>
|
||||||
<module>novel-front</module>
|
<module>novel-front</module>
|
||||||
|
Reference in New Issue
Block a user