pull/473/head
gedoor 4 years ago
parent 837ccfa9da
commit 55bd31d803
  1. 0
      app/src/main/assets/help/bookSource.md
  2. 0
      app/src/main/assets/help/rssSource.md
  3. 36
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt

@ -66,16 +66,13 @@ class AnalyzeRule(var book: BaseBook? = null) : JsExtensions {
private fun getAnalyzeByXPath(o: Any): AnalyzeByXPath { private fun getAnalyzeByXPath(o: Any): AnalyzeByXPath {
return if (o != content) { return if (o != content) {
AnalyzeByXPath().parse(o) AnalyzeByXPath().parse(o)
} else getAnalyzeByXPath() } else {
}
private fun getAnalyzeByXPath(): AnalyzeByXPath {
if (analyzeByXPath == null || objectChangedXP) { if (analyzeByXPath == null || objectChangedXP) {
analyzeByXPath = AnalyzeByXPath() analyzeByXPath = AnalyzeByXPath().parse(content!!)
analyzeByXPath?.parse(content!!)
objectChangedXP = false objectChangedXP = false
} }
return analyzeByXPath as AnalyzeByXPath analyzeByXPath!!
}
} }
/** /**
@ -84,16 +81,13 @@ class AnalyzeRule(var book: BaseBook? = null) : JsExtensions {
private fun getAnalyzeByJSoup(o: Any): AnalyzeByJSoup { private fun getAnalyzeByJSoup(o: Any): AnalyzeByJSoup {
return if (o != content) { return if (o != content) {
AnalyzeByJSoup().parse(o) AnalyzeByJSoup().parse(o)
} else getAnalyzeByJSoup() } else {
}
private fun getAnalyzeByJSoup(): AnalyzeByJSoup {
if (analyzeByJSoup == null || objectChangedJS) { if (analyzeByJSoup == null || objectChangedJS) {
analyzeByJSoup = AnalyzeByJSoup() analyzeByJSoup = AnalyzeByJSoup().parse(content!!)
analyzeByJSoup?.parse(content!!)
objectChangedJS = false objectChangedJS = false
} }
return analyzeByJSoup as AnalyzeByJSoup analyzeByJSoup!!
}
} }
/** /**
@ -102,16 +96,13 @@ class AnalyzeRule(var book: BaseBook? = null) : JsExtensions {
private fun getAnalyzeByJSonPath(o: Any): AnalyzeByJSonPath { private fun getAnalyzeByJSonPath(o: Any): AnalyzeByJSonPath {
return if (o != content) { return if (o != content) {
AnalyzeByJSonPath().parse(o) AnalyzeByJSonPath().parse(o)
} else getAnalyzeByJSonPath() } else {
}
private fun getAnalyzeByJSonPath(): AnalyzeByJSonPath {
if (analyzeByJSonPath == null || objectChangedJP) { if (analyzeByJSonPath == null || objectChangedJP) {
analyzeByJSonPath = AnalyzeByJSonPath() analyzeByJSonPath = AnalyzeByJSonPath().parse(content!!)
analyzeByJSonPath?.parse(content!!)
objectChangedJP = false objectChangedJP = false
} }
return analyzeByJSonPath as AnalyzeByJSonPath analyzeByJSonPath!!
}
} }
/** /**
@ -124,6 +115,7 @@ class AnalyzeRule(var book: BaseBook? = null) : JsExtensions {
return getStringList(ruleList, isUrl) return getStringList(ruleList, isUrl)
} }
@JvmOverloads
fun getStringList(ruleList: List<SourceRule>, isUrl: Boolean = false): List<String>? { fun getStringList(ruleList: List<SourceRule>, isUrl: Boolean = false): List<String>? {
var result: Any? = null var result: Any? = null
val content = this.content val content = this.content
@ -181,6 +173,7 @@ class AnalyzeRule(var book: BaseBook? = null) : JsExtensions {
/** /**
* 获取文本 * 获取文本
*/ */
@JvmOverloads
fun getString(ruleStr: String?, isUrl: Boolean = false): String { fun getString(ruleStr: String?, isUrl: Boolean = false): String {
if (TextUtils.isEmpty(ruleStr)) return "" if (TextUtils.isEmpty(ruleStr)) return ""
val ruleList = splitSourceRule(ruleStr) val ruleList = splitSourceRule(ruleStr)
@ -302,7 +295,6 @@ class AnalyzeRule(var book: BaseBook? = null) : JsExtensions {
return ArrayList() return ArrayList()
} }
/** /**
* 保存变量 * 保存变量
*/ */

Loading…
Cancel
Save