diff --git a/app/src/main/java/io/legado/app/model/webbook/BookChapterList.kt b/app/src/main/java/io/legado/app/model/webbook/BookChapterList.kt index 9f093df7a..6719aff4c 100644 --- a/app/src/main/java/io/legado/app/model/webbook/BookChapterList.kt +++ b/app/src/main/java/io/legado/app/model/webbook/BookChapterList.kt @@ -23,7 +23,7 @@ object BookChapterList { bookSource: BookSource, analyzeUrl: AnalyzeUrl ): List { - val chapterList = arrayListOf() + var chapterList = arrayListOf() val baseUrl: String = NetworkUtils.getUrl(response) val body: String? = response.body() body ?: throw Exception( @@ -58,7 +58,6 @@ object BookChapterList { } } } - if (reverse) chapterList.reverse() } else if (chapterData.nextUrl.size > 1) { val chapterDataList = arrayListOf>() for (item in chapterData.nextUrl) { @@ -85,8 +84,14 @@ object BookChapterList { chapterList.addAll(it) } } - if (reverse) chapterList.reverse() } + //去重 + if (!reverse) { + chapterList.reverse() + } + val lh = LinkedHashSet(chapterList) + chapterList = ArrayList(lh) + chapterList.reverse() return chapterList }