先改回来
现在这样的url无法正确识别了 http://android.jjwxc.net/androidapi/search?keyword={{key}}&type=1&page={{page}}&searchType=7&sortMode=DESC @js:java.put('key',key);java.put('page',page);result
This commit is contained in:
@@ -113,27 +113,29 @@ class AnalyzeUrl(
|
|||||||
*/
|
*/
|
||||||
private fun analyzeJs() {
|
private fun analyzeJs() {
|
||||||
var start = 0
|
var start = 0
|
||||||
|
var tmp: String
|
||||||
val jsMatcher = JS_PATTERN.matcher(ruleUrl)
|
val jsMatcher = JS_PATTERN.matcher(ruleUrl)
|
||||||
var result = ruleUrl
|
var hasRule = true
|
||||||
while (jsMatcher.find()) {
|
while (jsMatcher.find()) {
|
||||||
if (jsMatcher.start() > start && start > 0) {
|
if (jsMatcher.start() > start) {
|
||||||
ruleUrl.substring(start, jsMatcher.start()).trim().let {
|
tmp =
|
||||||
if (it.isNotEmpty()) {
|
ruleUrl.substring(start, jsMatcher.start()).trim { it <= ' ' }
|
||||||
result = it.replace("@result", result)
|
if (tmp.isNotEmpty()) {
|
||||||
}
|
ruleUrl = tmp.replace("@result", ruleUrl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = evalJS(jsMatcher.group(2) ?: jsMatcher.group(1), result) as String
|
ruleUrl = evalJS(jsMatcher.group(2) ?: jsMatcher.group(1), ruleUrl) as String
|
||||||
start = jsMatcher.end()
|
start = jsMatcher.end()
|
||||||
|
if (jsMatcher.group(0)!!.startsWith("@js:", true)) {
|
||||||
|
hasRule = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (ruleUrl.length > start) {
|
if (ruleUrl.length > start && hasRule) {
|
||||||
ruleUrl.substring(start).trim().let {
|
tmp = ruleUrl.substring(start).trim { it <= ' ' }
|
||||||
if (it.isNotEmpty()) {
|
if (tmp.isNotEmpty()) {
|
||||||
result = it.replace("@result", result)
|
ruleUrl = tmp.replace("@result", ruleUrl)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ruleUrl = result
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user