Update AnalyzeByJSoup.kt

进一步简化 AnalyzeByJSoup 中的 ElementsSingle,尽量以共享代替传递
pull/1108/head
bushixuanqi 3 years ago committed by GitHub
parent d5aba03fcf
commit 408fb77019
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 22
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSoup.kt

@ -42,8 +42,8 @@ class AnalyzeByJSoup(doc: Any) {
* 合并内容列表,得到内容
*/
internal fun getString(ruleStr: String) =
if(ruleStr.isEmpty()) null
else getStringList(ruleStr).takeIf { it.isNotEmpty() }?.joinToString("\n")
if(ruleStr.isEmpty()) null
else getStringList(ruleStr).takeIf { it.isNotEmpty() }?.joinToString("\n")
/**
* 获取一个字符串
@ -75,15 +75,15 @@ class AnalyzeByJSoup(doc: Any) {
for (ruleStrX in ruleStrS) {
val temp: List<String>? =
if (sourceRule.isCss) {
val lastIndex = ruleStrX.lastIndexOf('@')
getResultLast(
element.select(ruleStrX.substring(0, lastIndex)),
ruleStrX.substring(lastIndex + 1)
)
} else {
getResultList(ruleStrX)
}
if (sourceRule.isCss) {
val lastIndex = ruleStrX.lastIndexOf('@')
getResultLast(
element.select(ruleStrX.substring(0, lastIndex)),
ruleStrX.substring(lastIndex + 1)
)
} else {
getResultList(ruleStrX)
}
if (!temp.isNullOrEmpty()) {

Loading…
Cancel
Save