v2.0.2发布

This commit is contained in:
xiongxiaoyang
2020-05-18 14:51:02 +08:00
parent 92ce982899
commit 231b94f1da
8 changed files with 9 additions and 8 deletions

View File

@ -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;

View File

@ -18,5 +18,5 @@ public class Constants {
/**
* 爬取小说http请求中无效的内容长度
*/
public static final int INVALID_HTML_LENGTH = 1000;
public static final int INVALID_HTML_LENGTH = 1500;
}