diff --git a/assets/crawl_index.png b/assets/crawl_index.png index fcbdfce..7731011 100644 Binary files a/assets/crawl_index.png and b/assets/crawl_index.png differ diff --git a/novel-crawl/src/main/java/com/java2nb/novel/core/crawl/CrawlParser.java b/novel-crawl/src/main/java/com/java2nb/novel/core/crawl/CrawlParser.java index 32c9e13..03acfd8 100644 --- a/novel-crawl/src/main/java/com/java2nb/novel/core/crawl/CrawlParser.java +++ b/novel-crawl/src/main/java/com/java2nb/novel/core/crawl/CrawlParser.java @@ -94,6 +94,8 @@ public class CrawlParser { String desc = bookDetailHtml.substring(bookDetailHtml.indexOf(ruleBean.getDescStart()) + ruleBean.getDescStart().length()); desc = desc.substring(0, desc.indexOf(ruleBean.getDescEnd())); + //过滤掉简介中的a标签 + desc = desc.replaceAll("",""); //设置书籍简介 book.setBookDesc(desc); if (StringUtils.isNotBlank(ruleBean.getStatusPatten())) { @@ -173,6 +175,7 @@ public class CrawlParser { String lastIndexName = null; while (isFindIndex) { + BookIndex hasIndex = hasIndexs.get(indexNum); String indexName = indexNameMatch.group(1); diff --git a/novel-crawl/src/main/java/com/java2nb/novel/service/impl/CrawlServiceImpl.java b/novel-crawl/src/main/java/com/java2nb/novel/service/impl/CrawlServiceImpl.java index 36d90bc..dd2e54c 100644 --- a/novel-crawl/src/main/java/com/java2nb/novel/service/impl/CrawlServiceImpl.java +++ b/novel-crawl/src/main/java/com/java2nb/novel/service/impl/CrawlServiceImpl.java @@ -167,6 +167,11 @@ public class CrawlServiceImpl implements CrawlService { boolean isFindBookId = bookIdMatcher.find(); while (isFindBookId) { try { + if(Thread.currentThread().isInterrupted()){ + return; + } + + String bookId = bookIdMatcher.group(1); Book book = CrawlParser.parseBook(ruleBean, bookId); //这里只做新书入库,查询是否存在这本书 diff --git a/novel-front/src/main/resources/templates/mobile/book/book_ranking.html b/novel-front/src/main/resources/templates/mobile/book/book_ranking.html index 65e106b..354dcb4 100644 --- a/novel-front/src/main/resources/templates/mobile/book/book_ranking.html +++ b/novel-front/src/main/resources/templates/mobile/book/book_ranking.html @@ -179,9 +179,13 @@ for (var i = 0; i < bookList.length; i++) { var book = bookList[i]; - var end = book.bookDesc.indexOf("<"); + /*var end = book.bookDesc.indexOf("<"); if(end != -1) { book.bookDesc = book.bookDesc.substring(0,end); + }*/ + + if(book.bookDesc){ + book.bookDesc = book.bookDesc.replace(/<[^>]+>/g,"").replace(/\s+/g,""); } bookListHtml += ("
\n" + diff --git a/novel-front/src/main/resources/templates/mobile/index.html b/novel-front/src/main/resources/templates/mobile/index.html index 5275fea..3dd79d3 100644 --- a/novel-front/src/main/resources/templates/mobile/index.html +++ b/novel-front/src/main/resources/templates/mobile/index.html @@ -276,6 +276,10 @@ for (var i = 0; i < 6; i++) { var hotRecBook = hotRecBooks[i]; + if(hotRecBook.bookDesc){ + hotRecBook.bookDesc = hotRecBook.bookDesc.replace(/<[^>]+>/g,"").replace(/\s+/g,""); + } + hotRecBooksHtml += ("