|
|
@ -87,21 +87,27 @@ object BookContent { |
|
|
|
analyzeContent( |
|
|
|
analyzeContent( |
|
|
|
book, item.nextUrl, it, contentRule, bookChapter, bookSource, false |
|
|
|
book, item.nextUrl, it, contentRule, bookChapter, bookSource, false |
|
|
|
) |
|
|
|
) |
|
|
|
item.content = contentData.content |
|
|
|
item.content = contentData.content |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
for (item in contentDataList) { |
|
|
|
for (item in contentDataList) { |
|
|
|
content.append(item.content).append("\n") |
|
|
|
content.append(item.content).append("\n") |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
content.deleteCharAt(content.length - 1) |
|
|
|
content.deleteCharAt(content.length - 1) |
|
|
|
|
|
|
|
var contentStr = content.toString().htmlFormat() |
|
|
|
|
|
|
|
val replaceRegex = bookSource.ruleContent?.replaceRegex |
|
|
|
|
|
|
|
replaceRegex?.trim { it <= ' ' }?.split("##")?.let { |
|
|
|
|
|
|
|
if (it.size > 1) { |
|
|
|
|
|
|
|
contentStr = contentStr.replace(it[1].toRegex(), it.getOrNull(2) ?: "") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
Debug.log(bookSource.bookSourceUrl, "┌获取章节名称") |
|
|
|
Debug.log(bookSource.bookSourceUrl, "┌获取章节名称") |
|
|
|
Debug.log(bookSource.bookSourceUrl, "└${bookChapter.title}") |
|
|
|
Debug.log(bookSource.bookSourceUrl, "└${bookChapter.title}") |
|
|
|
Debug.log(bookSource.bookSourceUrl, "┌获取正文内容") |
|
|
|
Debug.log(bookSource.bookSourceUrl, "┌获取正文内容") |
|
|
|
Debug.log(bookSource.bookSourceUrl, "└\n$content") |
|
|
|
Debug.log(bookSource.bookSourceUrl, "└\n$contentStr") |
|
|
|
return content.toString() |
|
|
|
return contentStr |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Throws(Exception::class) |
|
|
|
@Throws(Exception::class) |
|
|
@ -126,7 +132,7 @@ object BookContent { |
|
|
|
} |
|
|
|
} |
|
|
|
Debug.log(bookSource.bookSourceUrl, "└" + nextUrlList.joinToString(","), printLog) |
|
|
|
Debug.log(bookSource.bookSourceUrl, "└" + nextUrlList.joinToString(","), printLog) |
|
|
|
} |
|
|
|
} |
|
|
|
val content = analyzeRule.getString(contentRule.content).htmlFormat() |
|
|
|
val content = analyzeRule.getString(contentRule.content) |
|
|
|
return ContentData(content, nextUrlList) |
|
|
|
return ContentData(content, nextUrlList) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |