This commit is contained in:
kunfei
2023-06-11 19:08:14 +08:00
parent 81ff174758
commit 4ffe73786d
@@ -92,7 +92,8 @@ object BookContent {
res.body?.let { nextBody -> res.body?.let { nextBody ->
contentData = analyzeContent( contentData = analyzeContent(
book, nextUrl, res.url, nextBody, contentRule, book, nextUrl, res.url, nextBody, contentRule,
bookChapter, bookSource, mNextChapterUrl, false bookChapter, bookSource, mNextChapterUrl,
printLog = false
) )
nextUrl = nextUrl =
if (contentData.second.isNotEmpty()) contentData.second[0] else "" if (contentData.second.isNotEmpty()) contentData.second[0] else ""
@@ -118,7 +119,9 @@ object BookContent {
).getStrResponseAwait() //控制并发访问 ).getStrResponseAwait() //控制并发访问
analyzeContent( analyzeContent(
book, urlStr, res.url, res.body!!, contentRule, book, urlStr, res.url, res.body!!, contentRule,
bookChapter, bookSource, mNextChapterUrl, false bookChapter, bookSource, mNextChapterUrl,
getNextChapterUrl = false,
printLog = false
).first ).first
} }
} }
@@ -157,6 +160,7 @@ object BookContent {
chapter: BookChapter, chapter: BookChapter,
bookSource: BookSource, bookSource: BookSource,
nextChapterUrl: String?, nextChapterUrl: String?,
getNextChapterUrl: Boolean = true,
printLog: Boolean = true printLog: Boolean = true
): Pair<String, List<String>> { ): Pair<String, List<String>> {
val analyzeRule = AnalyzeRule(book, bookSource) val analyzeRule = AnalyzeRule(book, bookSource)
@@ -170,7 +174,7 @@ object BookContent {
content = HtmlFormatter.formatKeepImg(content, rUrl) content = HtmlFormatter.formatKeepImg(content, rUrl)
//获取下一页链接 //获取下一页链接
val nextUrlRule = contentRule.nextContentUrl val nextUrlRule = contentRule.nextContentUrl
if (!nextUrlRule.isNullOrEmpty()) { if (getNextChapterUrl && !nextUrlRule.isNullOrEmpty()) {
Debug.log(bookSource.bookSourceUrl, "┌获取正文下一页链接", printLog) Debug.log(bookSource.bookSourceUrl, "┌获取正文下一页链接", printLog)
analyzeRule.getStringList(nextUrlRule, isUrl = true)?.let { analyzeRule.getStringList(nextUrlRule, isUrl = true)?.let {
nextUrlList.addAll(it) nextUrlList.addAll(it)