|
|
@ -40,7 +40,7 @@ class AnalyzeUrl( |
|
|
|
headerMapF: Map<String, String>? = null, |
|
|
|
headerMapF: Map<String, String>? = null, |
|
|
|
baseUrl: String? = null, |
|
|
|
baseUrl: String? = null, |
|
|
|
book: BaseBook? = null, |
|
|
|
book: BaseBook? = null, |
|
|
|
var useWebView: Boolean = false |
|
|
|
var useWebView: Boolean = false, |
|
|
|
) : JsExtensions { |
|
|
|
) : JsExtensions { |
|
|
|
companion object { |
|
|
|
companion object { |
|
|
|
private val pagePattern = Pattern.compile("<(.*?)>") |
|
|
|
private val pagePattern = Pattern.compile("<(.*?)>") |
|
|
@ -68,7 +68,7 @@ class AnalyzeUrl( |
|
|
|
headerMapF?.let { |
|
|
|
headerMapF?.let { |
|
|
|
headerMap.putAll(it) |
|
|
|
headerMap.putAll(it) |
|
|
|
if (it.containsKey("proxy")) { |
|
|
|
if (it.containsKey("proxy")) { |
|
|
|
proxy = it["proxy"]; |
|
|
|
proxy = it["proxy"] |
|
|
|
headerMap.remove("proxy") |
|
|
|
headerMap.remove("proxy") |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -84,7 +84,7 @@ class AnalyzeUrl( |
|
|
|
page: Int?, |
|
|
|
page: Int?, |
|
|
|
speakText: String?, |
|
|
|
speakText: String?, |
|
|
|
speakSpeed: Int?, |
|
|
|
speakSpeed: Int?, |
|
|
|
book: BaseBook? |
|
|
|
book: BaseBook?, |
|
|
|
) { |
|
|
|
) { |
|
|
|
val ruleList = arrayListOf<String>() |
|
|
|
val ruleList = arrayListOf<String>() |
|
|
|
var start = 0 |
|
|
|
var start = 0 |
|
|
@ -133,7 +133,7 @@ class AnalyzeUrl( |
|
|
|
page: Int?, |
|
|
|
page: Int?, |
|
|
|
speakText: String?, |
|
|
|
speakText: String?, |
|
|
|
speakSpeed: Int?, |
|
|
|
speakSpeed: Int?, |
|
|
|
book: BaseBook? |
|
|
|
book: BaseBook?, |
|
|
|
) { |
|
|
|
) { |
|
|
|
//page |
|
|
|
//page |
|
|
|
page?.let { |
|
|
|
page?.let { |
|
|
@ -161,7 +161,9 @@ class AnalyzeUrl( |
|
|
|
simpleBindings["book"] = book |
|
|
|
simpleBindings["book"] = book |
|
|
|
val expMatcher = EXP_PATTERN.matcher(ruleUrl) |
|
|
|
val expMatcher = EXP_PATTERN.matcher(ruleUrl) |
|
|
|
while (expMatcher.find()) { |
|
|
|
while (expMatcher.find()) { |
|
|
|
jsEval = SCRIPT_ENGINE.eval(expMatcher.group(1), simpleBindings) |
|
|
|
jsEval = expMatcher.group(1)?.let { |
|
|
|
|
|
|
|
SCRIPT_ENGINE.eval(it, simpleBindings) |
|
|
|
|
|
|
|
} ?: "" |
|
|
|
if (jsEval is String) { |
|
|
|
if (jsEval is String) { |
|
|
|
expMatcher.appendReplacement(sb, jsEval) |
|
|
|
expMatcher.appendReplacement(sb, jsEval) |
|
|
|
} else if (jsEval is Double && jsEval % 1.0 == 0.0) { |
|
|
|
} else if (jsEval is Double && jsEval % 1.0 == 0.0) { |
|
|
@ -272,7 +274,7 @@ class AnalyzeUrl( |
|
|
|
key: String?, |
|
|
|
key: String?, |
|
|
|
speakText: String?, |
|
|
|
speakText: String?, |
|
|
|
speakSpeed: Int?, |
|
|
|
speakSpeed: Int?, |
|
|
|
book: BaseBook? |
|
|
|
book: BaseBook?, |
|
|
|
): Any { |
|
|
|
): Any { |
|
|
|
val bindings = SimpleBindings() |
|
|
|
val bindings = SimpleBindings() |
|
|
|
bindings["java"] = this |
|
|
|
bindings["java"] = this |
|
|
@ -317,7 +319,7 @@ class AnalyzeUrl( |
|
|
|
suspend fun getResponseAwait( |
|
|
|
suspend fun getResponseAwait( |
|
|
|
tag: String, |
|
|
|
tag: String, |
|
|
|
jsStr: String? = null, |
|
|
|
jsStr: String? = null, |
|
|
|
sourceRegex: String? = null |
|
|
|
sourceRegex: String? = null, |
|
|
|
): Res { |
|
|
|
): Res { |
|
|
|
if (useWebView) { |
|
|
|
if (useWebView) { |
|
|
|
val params = AjaxWebView.AjaxParams(url) |
|
|
|
val params = AjaxWebView.AjaxParams(url) |
|
|
@ -447,7 +449,7 @@ class AnalyzeUrl( |
|
|
|
val charset: String?, |
|
|
|
val charset: String?, |
|
|
|
val webView: Any?, |
|
|
|
val webView: Any?, |
|
|
|
val headers: Any?, |
|
|
|
val headers: Any?, |
|
|
|
val body: Any? |
|
|
|
val body: Any?, |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|