pull/32/head
kunfei 5 years ago
parent 96de4ff620
commit 31f22b5288
  1. 14
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSoup.kt

@ -204,10 +204,8 @@ class AnalyzeByJSoup {
} }
} else { } else {
val rulePcx = rule.splitNotBlank("!") val rulePcx = rule.splitNotBlank("!")
val rulePc = val rulePc = rulePcx[0].trim { it <= ' ' }.splitNotBlank(">")
rulePcx[0].trim { it <= ' ' }.splitNotBlank(">") val rules = rulePc[0].trim { it <= ' ' }.splitNotBlank(".")
val rules =
rulePc[0].trim { it <= ' ' }.splitNotBlank(".")
var filterRules: Array<String>? = null var filterRules: Array<String>? = null
var needFilterElements = rulePc.size > 1 && !isEmpty(rulePc[1].trim { it <= ' ' }) var needFilterElements = rulePc.size > 1 && !isEmpty(rulePc[1].trim { it <= ' ' })
if (needFilterElements) { if (needFilterElements) {
@ -219,6 +217,7 @@ class AnalyzeByJSoup {
} }
filterRules[1] = filterRules[1].trim { it <= ' ' } filterRules[1] = filterRules[1].trim { it <= ' ' }
} }
var isCss = false
when (rules[0]) { when (rules[0]) {
"children" -> { "children" -> {
var children = temp.children() var children = temp.children()
@ -277,9 +276,12 @@ class AnalyzeByJSoup {
elementsByText = filterElements(elementsByText, filterRules) elementsByText = filterElements(elementsByText, filterRules)
elements.addAll(elementsByText) elements.addAll(elementsByText)
} }
else -> elements.addAll(temp.select(rule)) else -> {
elements.addAll(temp.select(rule))
isCss = true
}
} }
if (rulePcx.size > 1) { if (!isCss && rulePcx.size > 1) {
val rulePcs = rulePcx[1].splitNotBlank(":") val rulePcs = rulePcx[1].splitNotBlank(":")
for (pc in rulePcs) { for (pc in rulePcs) {
val pcInt = Integer.parseInt(pc) val pcInt = Integer.parseInt(pc)

Loading…
Cancel
Save