pull/873/head
gedoor 4 years ago
parent 6fd6657c15
commit 8823a8a7af
  1. 5
      app/src/main/java/io/legado/app/model/webBook/BookInfo.kt
  2. 16
      app/src/main/java/io/legado/app/model/webBook/BookList.kt

@ -32,12 +32,13 @@ object BookInfo {
val analyzeRule = AnalyzeRule(book)
analyzeRule.setContent(body).setBaseUrl(baseUrl)
analyzeRule.setRedirectUrl(redirectUrl)
analyzeBookInfo(scope, book, analyzeRule, bookSource, baseUrl, redirectUrl, canReName)
analyzeBookInfo(scope, book, body, analyzeRule, bookSource, baseUrl, redirectUrl, canReName)
}
fun analyzeBookInfo(
scope: CoroutineScope,
book: Book,
body: String,
analyzeRule: AnalyzeRule,
bookSource: BookSource,
baseUrl: String,
@ -106,7 +107,7 @@ object BookInfo {
book.tocUrl = analyzeRule.getString(infoRule.tocUrl, true)
if (book.tocUrl.isEmpty()) book.tocUrl = baseUrl
if (book.tocUrl == baseUrl) {
book.tocHtml = analyzeRule.content.toString()
book.tocHtml = body
}
Debug.log(bookSource.bookSourceUrl, "${book.tocUrl}")
}

@ -43,7 +43,7 @@ object BookList {
scope.ensureActive()
if (baseUrl.matches(it.toRegex())) {
Debug.log(bookSource.bookSourceUrl, "≡链接为详情页")
getInfoItem(scope, analyzeRule, bookSource, baseUrl, variableBook.variable)
getInfoItem(scope, body, analyzeRule, bookSource, baseUrl, variableBook.variable)
?.let { searchBook ->
searchBook.infoHtml = body
bookList.add(searchBook)
@ -71,7 +71,7 @@ object BookList {
scope.ensureActive()
if (collections.isEmpty() && bookSource.bookUrlPattern.isNullOrEmpty()) {
Debug.log(bookSource.bookSourceUrl, "└列表为空,按详情页解析")
getInfoItem(scope, analyzeRule, bookSource, baseUrl, variableBook.variable)
getInfoItem(scope, body, analyzeRule, bookSource, baseUrl, variableBook.variable)
?.let { searchBook ->
searchBook.infoHtml = body
bookList.add(searchBook)
@ -120,6 +120,7 @@ object BookList {
@Throws(Exception::class)
private fun getInfoItem(
scope: CoroutineScope,
body: String,
analyzeRule: AnalyzeRule,
bookSource: BookSource,
baseUrl: String,
@ -132,7 +133,16 @@ object BookList {
book.originOrder = bookSource.customOrder
book.type = bookSource.bookSourceType
analyzeRule.book = book
BookInfo.analyzeBookInfo(scope, book, analyzeRule, bookSource, baseUrl, baseUrl, false)
BookInfo.analyzeBookInfo(
scope,
book,
body,
analyzeRule,
bookSource,
baseUrl,
baseUrl,
false
)
if (book.name.isNotBlank()) {
return book.toSearchBook()
}

Loading…
Cancel
Save