|
|
@ -46,8 +46,9 @@ object BookList { |
|
|
|
scope.ensureActive() |
|
|
|
scope.ensureActive() |
|
|
|
if (baseUrl.matches(it.toRegex())) { |
|
|
|
if (baseUrl.matches(it.toRegex())) { |
|
|
|
Debug.log(bookSource.bookSourceUrl, "≡链接为详情页") |
|
|
|
Debug.log(bookSource.bookSourceUrl, "≡链接为详情页") |
|
|
|
getInfoItem(scope, body, analyzeRule, bookSource, baseUrl, variableBook.variable) |
|
|
|
getInfoItem( |
|
|
|
?.let { searchBook -> |
|
|
|
scope, bookSource, analyzeRule, analyzeUrl, body, baseUrl, variableBook.variable |
|
|
|
|
|
|
|
)?.let { searchBook -> |
|
|
|
searchBook.infoHtml = body |
|
|
|
searchBook.infoHtml = body |
|
|
|
bookList.add(searchBook) |
|
|
|
bookList.add(searchBook) |
|
|
|
} |
|
|
|
} |
|
|
@ -74,8 +75,9 @@ object BookList { |
|
|
|
scope.ensureActive() |
|
|
|
scope.ensureActive() |
|
|
|
if (collections.isEmpty() && bookSource.bookUrlPattern.isNullOrEmpty()) { |
|
|
|
if (collections.isEmpty() && bookSource.bookUrlPattern.isNullOrEmpty()) { |
|
|
|
Debug.log(bookSource.bookSourceUrl, "└列表为空,按详情页解析") |
|
|
|
Debug.log(bookSource.bookSourceUrl, "└列表为空,按详情页解析") |
|
|
|
getInfoItem(scope, body, analyzeRule, bookSource, baseUrl, variableBook.variable) |
|
|
|
getInfoItem( |
|
|
|
?.let { searchBook -> |
|
|
|
scope, bookSource, analyzeRule, analyzeUrl, body, baseUrl, variableBook.variable |
|
|
|
|
|
|
|
)?.let { searchBook -> |
|
|
|
searchBook.infoHtml = body |
|
|
|
searchBook.infoHtml = body |
|
|
|
bookList.add(searchBook) |
|
|
|
bookList.add(searchBook) |
|
|
|
} |
|
|
|
} |
|
|
@ -91,12 +93,7 @@ object BookList { |
|
|
|
Debug.log(bookSource.bookSourceUrl, "└列表大小:${collections.size}") |
|
|
|
Debug.log(bookSource.bookSourceUrl, "└列表大小:${collections.size}") |
|
|
|
for ((index, item) in collections.withIndex()) { |
|
|
|
for ((index, item) in collections.withIndex()) { |
|
|
|
getSearchItem( |
|
|
|
getSearchItem( |
|
|
|
scope, |
|
|
|
scope, bookSource, analyzeRule, item, baseUrl, variableBook.variable, |
|
|
|
item, |
|
|
|
|
|
|
|
analyzeRule, |
|
|
|
|
|
|
|
bookSource, |
|
|
|
|
|
|
|
baseUrl, |
|
|
|
|
|
|
|
variableBook.variable, |
|
|
|
|
|
|
|
index == 0, |
|
|
|
index == 0, |
|
|
|
ruleName = ruleName, |
|
|
|
ruleName = ruleName, |
|
|
|
ruleBookUrl = ruleBookUrl, |
|
|
|
ruleBookUrl = ruleBookUrl, |
|
|
@ -123,14 +120,15 @@ object BookList { |
|
|
|
@Throws(Exception::class) |
|
|
|
@Throws(Exception::class) |
|
|
|
private fun getInfoItem( |
|
|
|
private fun getInfoItem( |
|
|
|
scope: CoroutineScope, |
|
|
|
scope: CoroutineScope, |
|
|
|
body: String, |
|
|
|
|
|
|
|
analyzeRule: AnalyzeRule, |
|
|
|
|
|
|
|
bookSource: BookSource, |
|
|
|
bookSource: BookSource, |
|
|
|
|
|
|
|
analyzeRule: AnalyzeRule, |
|
|
|
|
|
|
|
analyzeUrl: AnalyzeUrl, |
|
|
|
|
|
|
|
body: String, |
|
|
|
baseUrl: String, |
|
|
|
baseUrl: String, |
|
|
|
variable: String? |
|
|
|
variable: String? |
|
|
|
): SearchBook? { |
|
|
|
): SearchBook? { |
|
|
|
val book = Book(variable = variable) |
|
|
|
val book = Book(variable = variable) |
|
|
|
book.bookUrl = baseUrl |
|
|
|
book.bookUrl = analyzeUrl.ruleUrl |
|
|
|
book.origin = bookSource.bookSourceUrl |
|
|
|
book.origin = bookSource.bookSourceUrl |
|
|
|
book.originName = bookSource.bookSourceName |
|
|
|
book.originName = bookSource.bookSourceName |
|
|
|
book.originOrder = bookSource.customOrder |
|
|
|
book.originOrder = bookSource.customOrder |
|
|
@ -155,9 +153,9 @@ object BookList { |
|
|
|
@Throws(Exception::class) |
|
|
|
@Throws(Exception::class) |
|
|
|
private fun getSearchItem( |
|
|
|
private fun getSearchItem( |
|
|
|
scope: CoroutineScope, |
|
|
|
scope: CoroutineScope, |
|
|
|
item: Any, |
|
|
|
|
|
|
|
analyzeRule: AnalyzeRule, |
|
|
|
|
|
|
|
bookSource: BookSource, |
|
|
|
bookSource: BookSource, |
|
|
|
|
|
|
|
analyzeRule: AnalyzeRule, |
|
|
|
|
|
|
|
item: Any, |
|
|
|
baseUrl: String, |
|
|
|
baseUrl: String, |
|
|
|
variable: String?, |
|
|
|
variable: String?, |
|
|
|
log: Boolean, |
|
|
|
log: Boolean, |
|
|
|