pull/48/head
kunfei 5 years ago
parent 65b2abe60d
commit 0b0c8a461d
  1. 20
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt

@ -190,16 +190,18 @@ class AnalyzeRule(var book: BaseBook? = null) {
putRule(sourceRule.putMap) putRule(sourceRule.putMap)
sourceRule.makeUpRule(result) sourceRule.makeUpRule(result)
result?.let { result?.let {
result = when (sourceRule.mode) { if (sourceRule.rule.isNotBlank() || sourceRule.replaceRegex.isEmpty()) {
Mode.Js -> evalJS(sourceRule.rule, it) result = when (sourceRule.mode) {
Mode.Json -> getAnalyzeByJSonPath(it).getString(sourceRule.rule) Mode.Js -> evalJS(sourceRule.rule, it)
Mode.XPath -> getAnalyzeByXPath(it).getString(sourceRule.rule) Mode.Json -> getAnalyzeByJSonPath(it).getString(sourceRule.rule)
Mode.Default -> if (isUrl) { Mode.XPath -> getAnalyzeByXPath(it).getString(sourceRule.rule)
getAnalyzeByJSoup(it).getString0(sourceRule.rule) Mode.Default -> if (isUrl) {
} else { getAnalyzeByJSoup(it).getString0(sourceRule.rule)
getAnalyzeByJSoup(it).getString(sourceRule.rule) } else {
getAnalyzeByJSoup(it).getString(sourceRule.rule)
}
else -> sourceRule.rule
} }
else -> sourceRule.rule
} }
if (sourceRule.replaceRegex.isNotEmpty()) { if (sourceRule.replaceRegex.isNotEmpty()) {
result = replaceRegex(result.toString(), sourceRule) result = replaceRegex(result.toString(), sourceRule)

Loading…
Cancel
Save