优化
Some checks are pending
Test Build / prepare (push) Waiting to run
Test Build / build (app, release) (push) Blocked by required conditions
Test Build / build (app, releaseA) (push) Blocked by required conditions
Test Build / prerelease (push) Blocked by required conditions
Test Build / lanzou (push) Blocked by required conditions
Test Build / test_Branch (push) Blocked by required conditions
Test Build / telegram (push) Blocked by required conditions

This commit is contained in:
Horis
2025-02-01 14:49:59 +08:00
parent 899f910797
commit cce7b9ee0a
2 changed files with 16 additions and 5 deletions

View File

@@ -32,6 +32,7 @@ object BookList {
baseUrl: String,
body: String?,
isSearch: Boolean = true,
isRedirect: Boolean = false
): ArrayList<SearchBook> {
body ?: throw NoStackTraceException(
appCtx.getString(
@@ -53,9 +54,11 @@ object BookList {
getInfoItem(
bookSource,
analyzeRule,
analyzeUrl,
body,
baseUrl,
ruleData.getVariable()
ruleData.getVariable(),
isRedirect
)?.let { searchBook ->
searchBook.infoHtml = body
bookList.add(searchBook)
@@ -84,7 +87,8 @@ object BookList {
if (collections.isEmpty() && bookSource.bookUrlPattern.isNullOrEmpty()) {
Debug.log(bookSource.bookSourceUrl, "└列表为空,按详情页解析")
getInfoItem(
bookSource, analyzeRule, body, baseUrl, ruleData.getVariable()
bookSource, analyzeRule, analyzeUrl, body, baseUrl, ruleData.getVariable(),
isRedirect
)?.let { searchBook ->
searchBook.infoHtml = body
bookList.add(searchBook)
@@ -133,12 +137,18 @@ object BookList {
private suspend fun getInfoItem(
bookSource: BookSource,
analyzeRule: AnalyzeRule,
analyzeUrl: AnalyzeUrl,
body: String,
baseUrl: String,
variable: String?
variable: String?,
isRedirect: Boolean
): SearchBook? {
val book = Book(variable = variable)
book.bookUrl = baseUrl
book.bookUrl = if (isRedirect) {
baseUrl
} else {
NetworkUtils.getAbsoluteURL(analyzeUrl.url, analyzeUrl.ruleUrl)
}
book.origin = bookSource.bookSourceUrl
book.originName = bookSource.bookSourceName
book.originOrder = bookSource.customOrder

View File

@@ -79,7 +79,8 @@ object WebBook {
analyzeUrl = analyzeUrl,
baseUrl = res.url,
body = res.body,
isSearch = true
isSearch = true,
isRedirect = res.raw.priorResponse?.isRedirect == true
)
}