优化
This commit is contained in:
@@ -226,11 +226,15 @@ interface JsExtensions : JsEncodeUtils {
|
||||
/**
|
||||
* 使用内置浏览器打开链接,并等待网页结果
|
||||
*/
|
||||
fun startBrowserAwait(url: String, title: String, refetchAfterSuccess: Boolean = true): StrResponse {
|
||||
return StrResponse(
|
||||
url,
|
||||
SourceVerificationHelp.getVerificationResult(getSource(), url, title, true, refetchAfterSuccess)
|
||||
fun startBrowserAwait(url: String, title: String, refetchAfterSuccess: Boolean): StrResponse {
|
||||
val body = SourceVerificationHelp.getVerificationResult(
|
||||
getSource(), url, title, true, refetchAfterSuccess
|
||||
)
|
||||
return StrResponse(url, body)
|
||||
}
|
||||
|
||||
fun startBrowserAwait(url: String, title: String): StrResponse {
|
||||
return startBrowserAwait(url, title, true)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -54,8 +54,6 @@ class AnalyzeRule(
|
||||
private set
|
||||
var baseUrl: String? = null
|
||||
private set
|
||||
var optionStr: String = "{}"
|
||||
private set
|
||||
var redirectUrl: URL? = null
|
||||
private set
|
||||
private var isJSON: Boolean = false
|
||||
@@ -96,11 +94,6 @@ class AnalyzeRule(
|
||||
return this
|
||||
}
|
||||
|
||||
fun setOption(option: String): AnalyzeRule {
|
||||
optionStr = option
|
||||
return this
|
||||
}
|
||||
|
||||
fun setRedirectUrl(url: String): URL? {
|
||||
try {
|
||||
redirectUrl = URL(url)
|
||||
@@ -754,7 +747,6 @@ class AnalyzeRule(
|
||||
bindings["book"] = book
|
||||
bindings["result"] = result
|
||||
bindings["baseUrl"] = baseUrl
|
||||
bindings["baseUrlWithOptions"] = "$baseUrl,$optionStr"
|
||||
bindings["chapter"] = chapter
|
||||
bindings["title"] = chapter?.title
|
||||
bindings["src"] = content
|
||||
|
||||
@@ -76,7 +76,6 @@ class AnalyzeUrl(
|
||||
var type: String? = null
|
||||
private set
|
||||
val headerMap = HashMap<String, String>()
|
||||
var optionStr: String = ""
|
||||
private var urlNoQuery: String = ""
|
||||
private var queryStr: String? = null
|
||||
private val fieldMap = LinkedHashMap<String, String>()
|
||||
@@ -194,10 +193,8 @@ class AnalyzeUrl(
|
||||
baseUrl = it
|
||||
}
|
||||
if (urlNoOption.length != ruleUrl.length) {
|
||||
val optionStr = ruleUrl.substring(urlMatcher.end())
|
||||
GSON.fromJsonObject<UrlOption>(optionStr).getOrNull()
|
||||
GSON.fromJsonObject<UrlOption>(ruleUrl.substring(urlMatcher.end())).getOrNull()
|
||||
?.let { option ->
|
||||
this.optionStr = optionStr
|
||||
option.getMethod()?.let {
|
||||
if (it.equals("POST", true)) method = RequestMethod.POST
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ object BookList {
|
||||
Debug.log(bookSource.bookSourceUrl, "≡获取成功:${analyzeUrl.ruleUrl}")
|
||||
Debug.log(bookSource.bookSourceUrl, body, state = 10)
|
||||
val analyzeRule = AnalyzeRule(ruleData, bookSource)
|
||||
analyzeRule.setContent(body).setBaseUrl(baseUrl).setOption(analyzeUrl.optionStr)
|
||||
analyzeRule.setContent(body).setBaseUrl(baseUrl)
|
||||
analyzeRule.setRedirectUrl(baseUrl)
|
||||
analyzeRule.setCoroutineContext(coroutineContext)
|
||||
if (isSearch) bookSource.bookUrlPattern?.let {
|
||||
|
||||
Reference in New Issue
Block a user