修复管理后台运行爬虫程序时控制台报错的问题

This commit is contained in:
xiongxiaoyang 2019-12-12 14:31:37 +08:00
parent 64f6dc393e
commit 45abe9745a
2 changed files with 5 additions and 9 deletions

View File

@ -166,7 +166,7 @@ public class BookCrawlServiceImpl implements BookCrawlService {
} }
} }
new Thread(() -> { /*new Thread(() -> {
for (int j = 21; j <= 29; j++) { for (int j = 21; j <= 29; j++) {
@ -402,7 +402,7 @@ public class BookCrawlServiceImpl implements BookCrawlService {
} }
}).start(); }).start();*/
} }
@ -567,7 +567,6 @@ public class BookCrawlServiceImpl implements BookCrawlService {
//查询章节内容 //查询章节内容
String body3 = getByHttpClient(contentUrl); String body3 = getByHttpClient(contentUrl);
if (body3 != null) { if (body3 != null) {
Pattern contentPattten = Pattern.compile("章节错误,点此举报(.*)加入书签,方便阅读");
String start = "『章节错误,点此举报』"; String start = "『章节错误,点此举报』";
String end = "『加入书签,方便阅读』"; String end = "『加入书签,方便阅读』";
String content = body3.substring(body3.indexOf(start) + start.length(), body3.indexOf(end)); String content = body3.substring(body3.indexOf(start) + start.length(), body3.indexOf(end));
@ -580,11 +579,8 @@ public class BookCrawlServiceImpl implements BookCrawlService {
bookContent.setContent(content); bookContent.setContent(content);
bookContent.setIndexNum(indexNum); bookContent.setIndexNum(indexNum);
contentList.add(bookContent); contentList.add(bookContent);
//System.out.println(indexName);
} else {
break;
} }
} }
indexNum++; indexNum++;
@ -616,7 +612,7 @@ public class BookCrawlServiceImpl implements BookCrawlService {
} finally { } finally {
matcher2.find(); matcher2.find();
isFind = matcher2.find();//需要找两次应为有两个一样的路径匹配 isFind = matcher2.find();
scoreFind = scoreMatch.find(); scoreFind = scoreMatch.find();
isBookNameMatch = bookNameMatch.find(); isBookNameMatch = bookNameMatch.find();
isFindAuthor = authoreMatch.find(); isFindAuthor = authoreMatch.find();

View File

@ -67,7 +67,7 @@
<insert id="save" parameterType="com.java2nb.books.domain.BookDO" useGeneratedKeys="true" keyProperty="id"> <insert id="save" parameterType="com.java2nb.books.domain.BookDO" useGeneratedKeys="true" keyProperty="id">
insert into book insert into book
( (
`id`,
`catId`, `catId`,
`pic_url`, `pic_url`,
`book_name`, `book_name`,
@ -82,7 +82,7 @@
) )
values values
( (
#{id},
#{catid}, #{catid},
#{picUrl}, #{picUrl},
#{bookName}, #{bookName},