diff --git a/app/src/main/java/io/legado/app/model/Rss.kt b/app/src/main/java/io/legado/app/model/Rss.kt index 8b29913d9..26cf159b8 100644 --- a/app/src/main/java/io/legado/app/model/Rss.kt +++ b/app/src/main/java/io/legado/app/model/Rss.kt @@ -19,12 +19,14 @@ object Rss { sortUrl: String, rssSource: RssSource, pageUrl: String? = null, + page: Int, scope: CoroutineScope = Coroutine.DEFAULT, context: CoroutineContext = Dispatchers.IO ): Coroutine { return Coroutine.async(scope, context) { val analyzeUrl = AnalyzeUrl( pageUrl ?: sortUrl, + page = page, headerMapF = rssSource.getHeaderMap() ) val body = analyzeUrl.getResponseAwait(rssSource.sourceUrl).body diff --git a/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesViewModel.kt b/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesViewModel.kt index 8d2d06df8..b2020aea9 100644 --- a/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesViewModel.kt @@ -18,6 +18,7 @@ class RssArticlesViewModel(application: Application) : BaseViewModel(application private var nextPageUrl: String? = null var sortName: String = "" var sortUrl: String = "" + var page = 1 fun init(bundle: Bundle?) { bundle?.let { @@ -29,7 +30,7 @@ class RssArticlesViewModel(application: Application) : BaseViewModel(application fun loadContent(rssSource: RssSource) { isLoading = true - Rss.getArticles(sortName, sortUrl, rssSource, null) + Rss.getArticles(sortName, sortUrl, rssSource, null, 1) .onSuccess(Dispatchers.IO) { nextPageUrl = it.nextPageUrl it.articles.let { list -> @@ -54,9 +55,10 @@ class RssArticlesViewModel(application: Application) : BaseViewModel(application fun loadMore(rssSource: RssSource) { isLoading = true + page++ val pageUrl = nextPageUrl if (!pageUrl.isNullOrEmpty()) { - Rss.getArticles(sortName, pageUrl, rssSource, pageUrl) + Rss.getArticles(sortName, pageUrl, rssSource, pageUrl, page) .onSuccess(Dispatchers.IO) { nextPageUrl = it.nextPageUrl loadMoreSuccess(it.articles)