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