mirror of
https://github.com/201206030/novel-plus.git
synced 2025-06-24 12:46:38 +00:00
v2.0.2发布
This commit is contained in:
@ -256,9 +256,10 @@ public class CrawlParser {
|
||||
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);
|
||||
if (forEntity.getStatusCode() == HttpStatus.OK) {
|
||||
String body = forEntity.getBody();
|
||||
log.debug("body长度:"+body.length());
|
||||
if(body.length() < Constants.INVALID_HTML_LENGTH){
|
||||
log.debug("获取html页面内容失败");
|
||||
Thread.sleep(10 + new Random().nextInt(60));
|
||||
Thread.sleep( new Random().nextInt(10*1000));
|
||||
return getByHttpClient(url);
|
||||
}
|
||||
return body;
|
||||
|
@ -18,5 +18,5 @@ public class Constants {
|
||||
/**
|
||||
* 爬取小说http请求中无效的内容长度
|
||||
*/
|
||||
public static final int INVALID_HTML_LENGTH = 1000;
|
||||
public static final int INVALID_HTML_LENGTH = 1500;
|
||||
}
|
||||
|
Reference in New Issue
Block a user