[RU]Newbie fix duble request (empty branches) (#15581)

* [RU]Newbie fix duble request (empty branches)

* getChapterUrl
This commit is contained in:
Eshlender 2023-03-06 02:46:04 +05:00 committed by GitHub
parent c773268964
commit dfb1d76243
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'NewManga(Newbie)'
pkgNameSuffix = 'ru.newbie'
extClass = '.Newbie'
extVersionCode = 18
extVersionCode = 19
}
dependencies {

View File

@ -291,7 +291,7 @@ class Newbie : ConfigurableSource, HttpSource() {
override fun mangaDetailsParse(response: Response): SManga {
val series = json.decodeFromString<MangaDetDto>(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<BranchesDto> {
val response = client.newCall(titleDetailsRequest(manga)).execute()
val series = json.decodeFromString<MangaDetDto>(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<List<SChapter>> {
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<Page> {
val pages = json.decodeFromString<List<PageDto>>(response.body.string())
val result = mutableListOf<Page>()