v2.0.3发布

This commit is contained in:
xiongxiaoyang 2019-12-06 10:13:04 +08:00
parent dc707a49ed
commit cdf1d0c084
5 changed files with 16 additions and 15 deletions

View File

@ -161,15 +161,15 @@ novel-admin :平台后台管理系统源码(独立项目,按需安装)
**演示地址2**
[点击前往](https://book.100boot.cn/)(前台,推荐)(未上线漫画专区功能
[点击前往](https://book.100boot.cn/)(前台)
**演示地址3**
[点击前往](http://www.jsy66.vip/)未上线漫画专区功能
[点击前往](http://www.jsy66.vip/)前台
##### 演示地址4备用
[点击前往](http://47.106.243.172:8888)(前台)(已上线漫画专区)
[点击前往](http://47.106.243.172:8888)(前台)
[点击前往 ](http://47.106.243.172:8888) (后台) (**后台爬虫程序运行会占用大量服务器资源,试用人数过多,服务器压力大,现暂停演示** )

View File

@ -10,7 +10,7 @@
</parent>
<groupId>xyz.zinglizingli</groupId>
<artifactId>novel-front</artifactId>
<version>2.0.2.beta</version>
<version>2.0.3.beta</version>
<name>novel-front</name>
<description>小说精品楼-前台web网站</description>

View File

@ -102,8 +102,8 @@ public class SearchFilter implements Filter {
try {
OutputStream out = resp.getOutputStream();
if(requestURI.contains("/localPic/")){
OutputStream out = resp.getOutputStream();
InputStream input = new FileInputStream(new File(picSavePath+requestURI));
byte[] b = new byte[4096];
for (int n; (n = input.read(b)) != -1;) {
@ -193,6 +193,7 @@ public class SearchFilter implements Filter {
String realUrl = "https://images.dmzj.com/" + requestURI.substring(15);
ResponseEntity<Resource> resEntity = restTemplate.exchange(realUrl, HttpMethod.GET, requestEntity, Resource.class);
InputStream input = resEntity.getBody().getInputStream();
OutputStream out = resp.getOutputStream();
byte[] b = new byte[4096];
for (int n; (n = input.read(b)) != -1;) {
out.write(b, 0, n);

View File

@ -38,7 +38,9 @@ public class CrawlBooksSchedule {
@Autowired
private BookService bookService;
RestTemplate restTemplate = RestTemplateUtil.getInstance("utf-8");
RestTemplate utf8RestTemplate = RestTemplateUtil.getInstance("utf-8");
RestTemplate isoRestTemplate = RestTemplateUtil.getInstance("iso-8859-1");
@Value("${books.lowestScore}")
private Float lowestScore;
@ -166,10 +168,9 @@ public class CrawlBooksSchedule {
String picSrc = picMather.group(1);
if(picSaveType == 2 && StringUtils.isNotBlank(picSrc)){
restTemplate = RestTemplateUtil.getInstance("iso-8859-1");
HttpHeaders headers = new HttpHeaders();
HttpEntity<String> requestEntity = new HttpEntity<>(null, headers);
ResponseEntity<Resource> resEntity = restTemplate.exchange(picSrc, HttpMethod.GET, requestEntity, Resource.class);
ResponseEntity<Resource> resEntity = isoRestTemplate.exchange(picSrc, HttpMethod.GET, requestEntity, Resource.class);
InputStream input = resEntity.getBody().getInputStream();
picSrc = "/localPic/" + updateTimeStr.substring(0,4)+"/"+updateTimeStr.substring(5,7)+"/"+updateTimeStr.substring(8,10)
+ UUIDUtils.getUUID32()
@ -528,11 +529,10 @@ public class CrawlBooksSchedule {
String picSrc = picMather.group(1);
if(picSaveType == 2 && StringUtils.isNotBlank(picSrc)){
restTemplate = RestTemplateUtil.getInstance("iso-8859-1");
HttpHeaders headers = new HttpHeaders();
headers.add("Referer","https://www.biqudao.com");
HttpEntity<String> requestEntity = new HttpEntity<>(null, headers);
ResponseEntity<Resource> resEntity = restTemplate.exchange(picSrc, HttpMethod.GET, requestEntity, Resource.class);
ResponseEntity<Resource> resEntity = isoRestTemplate.exchange(picSrc, HttpMethod.GET, requestEntity, Resource.class);
InputStream input = resEntity.getBody().getInputStream();
picSrc = "/localPic/" + updateTimeStr.substring(0,2)+"/"+updateTimeStr.substring(3,5)+"/"+updateTimeStr.substring(6,8)
+ UUIDUtils.getUUID32()
@ -670,7 +670,7 @@ public class CrawlBooksSchedule {
}
private String getByHttpClient(String catBookListUrl) {
private String getByHttpClient(String url) {
try {
/* HttpClient httpClient = new DefaultHttpClient();
HttpGet getReq = new HttpGet(catBookListUrl);
@ -683,7 +683,7 @@ public class CrawlBooksSchedule {
return null;
}*/
//经测试restTemplate比httpClient效率高出很多倍所有选择restTemplate
ResponseEntity<String> forEntity = restTemplate.getForEntity(catBookListUrl, String.class);
ResponseEntity<String> forEntity = utf8RestTemplate.getForEntity(url, String.class);
if (forEntity.getStatusCode() == HttpStatus.OK) {
return forEntity.getBody();
} else {

View File

@ -4,8 +4,8 @@ server:
spring:
datasource:
url: jdbc:mysql://127.0.0.1:3306/books?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
username: root
password: test123456
username: books
password: books
# url: jdbc:mysql://127.0.0.1:3306/books?useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
# username: root
# password: test123456
@ -77,7 +77,7 @@ crawl:
pic:
save:
type: 1 #图片保存方式, 1不保存使用网络图片 2本地保存
path: d:/pic #图片保存路径
path: /var/pic #图片保存路径
search: