From dfb1d76243ebcfffb068f443c005895550817dfd Mon Sep 17 00:00:00 2001 From: Eshlender <35057681+e-shl@users.noreply.github.com> Date: Mon, 6 Mar 2023 02:46:04 +0500 Subject: [PATCH] [RU]Newbie fix duble request (empty branches) (#15581) * [RU]Newbie fix duble request (empty branches) * getChapterUrl --- src/ru/newbie/build.gradle | 2 +- .../eu/kanade/tachiyomi/extension/ru/newbie/Newbie.kt | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/ru/newbie/build.gradle b/src/ru/newbie/build.gradle index 56169a623..ed68b183f 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 = 18 + extVersionCode = 19 } 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 2d1750847..230912061 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 @@ -291,7 +291,7 @@ class Newbie : ConfigurableSource, HttpSource() { override fun mangaDetailsParse(response: Response): SManga { val series = json.decodeFromString(response.body.string()) - branches[series.title.en] = series.branches + branches[series.id.toString()] = series.branches return series.toSManga() } @@ -310,13 +310,13 @@ class Newbie : ConfigurableSource, HttpSource() { private fun mangaBranches(manga: SManga): List { val response = client.newCall(titleDetailsRequest(manga)).execute() val series = json.decodeFromString(response.body.string()) - branches[series.title.en] = series.branches + branches[series.id.toString()] = series.branches return series.branches } private fun selector(b: BranchesDto): Boolean = b.is_default override fun fetchChapterList(manga: SManga): Observable> { - val branch = branches.getOrElse(manga.title) { mangaBranches(manga) } + val branch = branches.getOrElse(manga.url) { mangaBranches(manga) } return when { branch.isEmpty() -> { return Observable.just(listOf()) @@ -365,6 +365,10 @@ class Newbie : ConfigurableSource, HttpSource() { return GET(API_URL + "/chapters/${chapter.url.substringAfterLast("/")}/pages", headers) } + override fun getChapterUrl(chapter: SChapter): String { + return baseUrl + chapter.url + } + private fun pageListParse(response: Response, urlRequest: String): List { val pages = json.decodeFromString>(response.body.string()) val result = mutableListOf()