fix: 换源数据

pull/95/head
kunfei 5 years ago
parent 453264cd05
commit 9485d06bc5
  1. 2
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSonPath.kt
  2. 5
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSoup.kt
  3. 2
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByXPath.kt
  4. 4
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt
  5. 2
      app/src/main/java/io/legado/app/model/webBook/BookList.kt

@ -72,7 +72,7 @@ class AnalyzeByJSonPath {
} }
} }
} }
return TextUtils.join(",", textList) return textList.joinToString("\n")
} }
} }

@ -51,7 +51,10 @@ class AnalyzeByJSoup {
val textS = getStringList(ruleStr) val textS = getStringList(ruleStr)
return if (textS.isEmpty()) { return if (textS.isEmpty()) {
null null
} else join("\n", textS).trim { it <= ' ' } } else {
textS.joinToString("\n")
}
} }
/** /**

@ -181,7 +181,7 @@ class AnalyzeByXPath {
} }
} }
} }
return TextUtils.join(",", textList) return textList.joinToString("\n")
} }
} }
} }

@ -108,8 +108,8 @@ class AnalyzeRule(var book: BaseBook? = null) : JsExtensions {
*/ */
@Throws(Exception::class) @Throws(Exception::class)
@JvmOverloads @JvmOverloads
fun getStringList(rule: String, isUrl: Boolean = false): List<String>? { fun getStringList(rule: String?, isUrl: Boolean = false): List<String>? {
if (TextUtils.isEmpty(rule)) return null if (rule.isNullOrEmpty()) return null
val ruleList = splitSourceRule(rule) val ruleList = splitSourceRule(rule)
return getStringList(ruleList, isUrl) return getStringList(ruleList, isUrl)
} }

@ -120,7 +120,7 @@ object BookList {
searchBook.author = BookHelp.formatAuthor(analyzeRule.getString(author)) searchBook.author = BookHelp.formatAuthor(analyzeRule.getString(author))
Debug.log(bookSource.bookSourceUrl, "${searchBook.author}") Debug.log(bookSource.bookSourceUrl, "${searchBook.author}")
Debug.log(bookSource.bookSourceUrl, "┌获取分类") Debug.log(bookSource.bookSourceUrl, "┌获取分类")
searchBook.kind = analyzeRule.getString(kind) searchBook.kind = analyzeRule.getStringList(kind)?.joinToString(",")
Debug.log(bookSource.bookSourceUrl, "${searchBook.kind}") Debug.log(bookSource.bookSourceUrl, "${searchBook.kind}")
Debug.log(bookSource.bookSourceUrl, "┌获取字数") Debug.log(bookSource.bookSourceUrl, "┌获取字数")
searchBook.wordCount = analyzeRule.getString(wordCount) searchBook.wordCount = analyzeRule.getString(wordCount)

Loading…
Cancel
Save