diff --git a/src/ru/mangapoisk/build.gradle b/src/ru/mangapoisk/build.gradle index b177e0e6d..35d1f3e1f 100644 --- a/src/ru/mangapoisk/build.gradle +++ b/src/ru/mangapoisk/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'MangaPoisk' pkgNameSuffix = 'ru.mangapoisk' extClass = '.MangaPoisk' - extVersionCode = 2 + extVersionCode = 3 libVersion = '1.2' } diff --git a/src/ru/mangapoisk/src/eu/kanade/tachiyomi/extension/ru/mangapoisk/MangaPoisk.kt b/src/ru/mangapoisk/src/eu/kanade/tachiyomi/extension/ru/mangapoisk/MangaPoisk.kt index 2b9a4009e..3263794b5 100644 --- a/src/ru/mangapoisk/src/eu/kanade/tachiyomi/extension/ru/mangapoisk/MangaPoisk.kt +++ b/src/ru/mangapoisk/src/eu/kanade/tachiyomi/extension/ru/mangapoisk/MangaPoisk.kt @@ -129,11 +129,20 @@ class MangaPoisk : ParsedHttpSource() { else -> SManga.UNKNOWN } override fun fetchChapterList(manga: SManga): Observable> { - return client.newCall(chapterListRequest(manga)) - .asObservableSuccess() - .map { response -> - chapterListParse(response, manga) + val pageItems = client.newCall(chapterListRequest(manga)).execute().asJsoup().select("li.page-item") + val pages = mutableListOf(1) + if (pageItems.lastIndex > 1) { + val lastPage = pageItems[pageItems.lastIndex - 1].text().toInt() + for (i in 2.rangeTo(lastPage)) { + pages.add(i) } + } + + return Observable.just( + pages.flatMap { page -> + chapterListParse(client.newCall(chapterPageListRequest(manga, page)).execute(), manga) + } + ) } private fun chapterListParse(response: Response, manga: SManga): List { val document = response.asJsoup() @@ -142,6 +151,11 @@ class MangaPoisk : ParsedHttpSource() { override fun chapterListRequest(manga: SManga): Request { return GET("$baseUrl${manga.url}/chaptersList", headers) } + + private fun chapterPageListRequest(manga: SManga, page: Int): Request { + return GET("$baseUrl${manga.url}/chaptersList?page=$page", headers) + } + override fun chapterListSelector() = ".chapter-item" private fun chapterFromElement(element: Element, manga: SManga): SChapter {