update AnalyzeRule.kt

pull/540/head
gedoor 4 years ago
parent 2d941d25b9
commit 2e2919cee7
  1. 8
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt

@ -163,7 +163,7 @@ class AnalyzeRule(var book: BaseBook? = null) : JsExtensions {
if (result is List<*>) { if (result is List<*>) {
for (url in result as List<*>) { for (url in result as List<*>) {
val absoluteURL = NetworkUtils.getAbsoluteURL(baseURL, url.toString()) val absoluteURL = NetworkUtils.getAbsoluteURL(baseURL, url.toString())
if (!absoluteURL.isNullOrEmpty() && !urlList.contains(absoluteURL)) { if (absoluteURL.isNotEmpty() && !urlList.contains(absoluteURL)) {
urlList.add(absoluteURL) urlList.add(absoluteURL)
} }
} }
@ -231,7 +231,7 @@ class AnalyzeRule(var book: BaseBook? = null) : JsExtensions {
return if (str.isBlank()) { return if (str.isBlank()) {
baseUrl ?: "" baseUrl ?: ""
} else { } else {
NetworkUtils.getAbsoluteURL(baseURL, str) ?: "" NetworkUtils.getAbsoluteURL(baseURL, str)
} }
} }
return str return str
@ -573,8 +573,8 @@ class AnalyzeRule(var book: BaseBook? = null) : JsExtensions {
rule = infoVal.toString() rule = infoVal.toString()
} }
//分离正则表达式 //分离正则表达式
val ruleStrS = rule.trim { it <= ' ' }.split("##") val ruleStrS = rule.split("##")
rule = ruleStrS[0] rule = ruleStrS[0].trim()
if (ruleStrS.size > 1) { if (ruleStrS.size > 1) {
replaceRegex = ruleStrS[1] replaceRegex = ruleStrS[1]
} }

Loading…
Cancel
Save