|
|
@ -57,8 +57,8 @@ class AnalyzeUrl( |
|
|
|
private var bodyTxt: String? = null |
|
|
|
private var bodyTxt: String? = null |
|
|
|
private var body: RequestBody? = null |
|
|
|
private var body: RequestBody? = null |
|
|
|
private var method = RequestMethod.GET |
|
|
|
private var method = RequestMethod.GET |
|
|
|
private var webViewJs: String? = null |
|
|
|
var useWebView: Boolean = false |
|
|
|
private var sourceRegex: String? = null |
|
|
|
private set |
|
|
|
|
|
|
|
|
|
|
|
init { |
|
|
|
init { |
|
|
|
baseUrl?.let { |
|
|
|
baseUrl?.let { |
|
|
@ -170,8 +170,7 @@ class AnalyzeUrl( |
|
|
|
} |
|
|
|
} |
|
|
|
options["body"]?.let { bodyTxt = it } |
|
|
|
options["body"]?.let { bodyTxt = it } |
|
|
|
options["charset"]?.let { charset = it } |
|
|
|
options["charset"]?.let { charset = it } |
|
|
|
options["js"]?.let { webViewJs = it } |
|
|
|
options["webView"]?.let { if (it.isNotEmpty()) useWebView = true } |
|
|
|
options["sourceRegex"]?.let { sourceRegex = it } |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
when (method) { |
|
|
|
when (method) { |
|
|
@ -292,16 +291,16 @@ class AnalyzeUrl( |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun useWebView(): Boolean { |
|
|
|
suspend fun getResultByWebView( |
|
|
|
return webViewJs != null || sourceRegex != null |
|
|
|
tag: String, |
|
|
|
} |
|
|
|
jsStr: String? = null, |
|
|
|
|
|
|
|
sourceRegex: String? = null |
|
|
|
suspend fun getResultByWebView(tag: String): String { |
|
|
|
): String { |
|
|
|
val params = AjaxWebView.AjaxParams(tag) |
|
|
|
val params = AjaxWebView.AjaxParams(tag) |
|
|
|
params.url = url |
|
|
|
params.url = url |
|
|
|
params.headerMap = headerMap |
|
|
|
params.headerMap = headerMap |
|
|
|
params.requestMethod = method |
|
|
|
params.requestMethod = method |
|
|
|
params.javaScript = webViewJs |
|
|
|
params.javaScript = jsStr |
|
|
|
params.sourceRegex = sourceRegex |
|
|
|
params.sourceRegex = sourceRegex |
|
|
|
params.postData = bodyTxt?.toByteArray() |
|
|
|
params.postData = bodyTxt?.toByteArray() |
|
|
|
return HttpHelper.ajax(params) |
|
|
|
return HttpHelper.ajax(params) |
|
|
|