Skip to content

Commit

Permalink
先改回来
Browse files Browse the repository at this point in the history
现在这样的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
  • Loading branch information
gedoor committed Mar 15, 2023
1 parent e8db1cb commit 93de115
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -113,27 +113,29 @@ class AnalyzeUrl(
*/
private fun analyzeJs() {
var start = 0
var tmp: String
val jsMatcher = JS_PATTERN.matcher(ruleUrl)
var result = ruleUrl
var hasRule = true
while (jsMatcher.find()) {
if (jsMatcher.start() > start && start > 0) {
ruleUrl.substring(start, jsMatcher.start()).trim().let {
if (it.isNotEmpty()) {
result = it.replace("@result", result)
}
if (jsMatcher.start() > start) {
tmp =
ruleUrl.substring(start, jsMatcher.start()).trim { it <= ' ' }
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()
if (jsMatcher.group(0)!!.startsWith("@js:", true)) {
hasRule = false
}
}
if (ruleUrl.length > start) {
ruleUrl.substring(start).trim().let {
if (it.isNotEmpty()) {
result = it.replace("@result", result)
}
if (ruleUrl.length > start && hasRule) {
tmp = ruleUrl.substring(start).trim { it <= ' ' }
if (tmp.isNotEmpty()) {
ruleUrl = tmp.replace("@result", ruleUrl)
}
}
ruleUrl = result
}

/**
Expand Down

0 comments on commit 93de115

Please sign in to comment.