diff --git a/src/ru/newbie/build.gradle b/src/ru/newbie/build.gradle index 4d47796ba..659d99b32 100644 --- a/src/ru/newbie/build.gradle +++ b/src/ru/newbie/build.gradle @@ -6,7 +6,7 @@ ext { extName = 'NewManga(Newbie)' pkgNameSuffix = 'ru.newbie' extClass = '.Newbie' - extVersionCode = 13 + extVersionCode = 14 } dependencies { diff --git a/src/ru/newbie/src/eu/kanade/tachiyomi/extension/ru/newbie/Newbie.kt b/src/ru/newbie/src/eu/kanade/tachiyomi/extension/ru/newbie/Newbie.kt index 929c34fb3..8a3129915 100644 --- a/src/ru/newbie/src/eu/kanade/tachiyomi/extension/ru/newbie/Newbie.kt +++ b/src/ru/newbie/src/eu/kanade/tachiyomi/extension/ru/newbie/Newbie.kt @@ -318,13 +318,15 @@ class Newbie : ConfigurableSource, HttpSource() { client.newCall(chapterListRequest(branchId)) .asObservableSuccess() .map { response -> - chapterListParse(response) + chapterListParse(response, manga, branchId) } } } } - override fun chapterListParse(response: Response): List { + override fun chapterListParse(response: Response) = throw UnsupportedOperationException("chapterListParse(response: Response, manga: SManga)") + + private fun chapterListParse(response: Response, manga: SManga, branch: Long): List { var chapters = json.decodeFromString>>(response.body!!.string()).items if (!preferences.getBoolean(PAID_PREF, false)) { chapters = chapters.filter { it.is_available } @@ -333,13 +335,13 @@ class Newbie : ConfigurableSource, HttpSource() { SChapter.create().apply { chapter_number = chapter.number name = chapterName(chapter) - url = "/chapters/${chapter.id}/pages" + url = "/p/${manga.url}/$branch/r/${chapter.id}" date_upload = parseDate(chapter.created_at) scanlator = chapter.translator } } } - override fun chapterListRequest(manga: SManga): Request = throw NotImplementedError("Unused") + override fun chapterListRequest(manga: SManga): Request = throw UnsupportedOperationException("chapterListRequest(branch: Long)") private fun chapterListRequest(branch: Long): Request { return GET( "$API_URL/branches/$branch/chapters?reverse=true&size=1000000", @@ -349,15 +351,15 @@ class Newbie : ConfigurableSource, HttpSource() { @TargetApi(Build.VERSION_CODES.N) override fun pageListRequest(chapter: SChapter): Request { - return GET(API_URL + chapter.url, headers) + return GET(API_URL + "/chapters/${chapter.url.substringAfterLast("/")}/pages", headers) } - private fun pageListParse(response: Response, chapter: SChapter): List { + private fun pageListParse(response: Response, urlRequest: String): List { val pages = json.decodeFromString>(response.body?.string()!!) val result = mutableListOf() pages.forEach { page -> (1..page.slices!!).map { i -> - result.add(Page(result.size, API_URL + chapter.url + "/${page.id}?slice=$i")) + result.add(Page(result.size, urlRequest + "/${page.id}?slice=$i")) } } return result @@ -368,7 +370,7 @@ class Newbie : ConfigurableSource, HttpSource() { return client.newCall(pageListRequest(chapter)) .asObservableSuccess() .map { response -> - pageListParse(response, chapter) + pageListParse(response, pageListRequest(chapter).url.toString()) } }