diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSonPath.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSonPath.kt index 84b5045e7..e7360da7e 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSonPath.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSonPath.kt @@ -72,7 +72,7 @@ class AnalyzeByJSonPath { } } } - return TextUtils.join(",", textList) + return textList.joinToString("\n") } } diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSoup.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSoup.kt index 63c5eb27a..cf11dbb72 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSoup.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSoup.kt @@ -51,7 +51,10 @@ class AnalyzeByJSoup { val textS = getStringList(ruleStr) return if (textS.isEmpty()) { null - } else join("\n", textS).trim { it <= ' ' } + } else { + textS.joinToString("\n") + } + } /** diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByXPath.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByXPath.kt index f2745ee69..707ab9a22 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByXPath.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByXPath.kt @@ -181,7 +181,7 @@ class AnalyzeByXPath { } } } - return TextUtils.join(",", textList) + return textList.joinToString("\n") } } } diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt index 3aa920237..e168cb241 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt @@ -108,8 +108,8 @@ class AnalyzeRule(var book: BaseBook? = null) : JsExtensions { */ @Throws(Exception::class) @JvmOverloads - fun getStringList(rule: String, isUrl: Boolean = false): List? { - if (TextUtils.isEmpty(rule)) return null + fun getStringList(rule: String?, isUrl: Boolean = false): List? { + if (rule.isNullOrEmpty()) return null val ruleList = splitSourceRule(rule) return getStringList(ruleList, isUrl) } diff --git a/app/src/main/java/io/legado/app/model/webBook/BookList.kt b/app/src/main/java/io/legado/app/model/webBook/BookList.kt index 56f511815..ffb338655 100644 --- a/app/src/main/java/io/legado/app/model/webBook/BookList.kt +++ b/app/src/main/java/io/legado/app/model/webBook/BookList.kt @@ -120,7 +120,7 @@ object BookList { searchBook.author = BookHelp.formatAuthor(analyzeRule.getString(author)) Debug.log(bookSource.bookSourceUrl, "└${searchBook.author}") 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.wordCount = analyzeRule.getString(wordCount)