From 7b342439185f108ed3b7756c40d1d5a39525c21d Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 1 Apr 2020 22:25:11 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/data/entities/RssSource.kt | 14 ++++++-------- app/src/main/java/io/legado/app/model/Debug.kt | 3 ++- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/io/legado/app/data/entities/RssSource.kt b/app/src/main/java/io/legado/app/data/entities/RssSource.kt index 4d72ced66..e9a58ee98 100644 --- a/app/src/main/java/io/legado/app/data/entities/RssSource.kt +++ b/app/src/main/java/io/legado/app/data/entities/RssSource.kt @@ -102,15 +102,13 @@ data class RssSource( fun sortUrls(): LinkedHashMap { val sortMap = linkedMapOf() - val sortUrl = sortUrl - if (sortUrl.isNullOrEmpty()) { + sortUrl?.split("(&&|\n)+".toRegex())?.forEach { c -> + val d = c.split("::") + if (d.size > 1) + sortMap[d[0]] = d[1] + } + if (sortMap.isEmpty()) { sortMap[""] = sourceUrl - } else { - sortUrl.split("(&&|\n)+".toRegex()).forEach { c -> - val d = c.split("::") - if (d.size > 1) - sortMap[d[0]] = d[1] - } } return sortMap } diff --git a/app/src/main/java/io/legado/app/model/Debug.kt b/app/src/main/java/io/legado/app/model/Debug.kt index 51ae12afd..58944e05b 100644 --- a/app/src/main/java/io/legado/app/model/Debug.kt +++ b/app/src/main/java/io/legado/app/model/Debug.kt @@ -54,7 +54,8 @@ object Debug { cancelDebug() debugSource = rssSource.sourceUrl log(debugSource, "︾开始解析") - Rss.getArticles(rssSource, null) + val sort = rssSource.sortUrls().entries.first() + Rss.getArticles(sort.key, sort.value, rssSource, null) .onSuccess { if (it.articles.isEmpty()) { log(debugSource, "⇒列表页解析成功,为空")