[RU]Newbie fix duble request (empty branches) (#15581)
* [RU]Newbie fix duble request (empty branches) * getChapterUrl
This commit is contained in:
parent
c773268964
commit
dfb1d76243
|
@ -6,7 +6,7 @@ ext {
|
||||||
extName = 'NewManga(Newbie)'
|
extName = 'NewManga(Newbie)'
|
||||||
pkgNameSuffix = 'ru.newbie'
|
pkgNameSuffix = 'ru.newbie'
|
||||||
extClass = '.Newbie'
|
extClass = '.Newbie'
|
||||||
extVersionCode = 18
|
extVersionCode = 19
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
|
@ -291,7 +291,7 @@ class Newbie : ConfigurableSource, HttpSource() {
|
||||||
|
|
||||||
override fun mangaDetailsParse(response: Response): SManga {
|
override fun mangaDetailsParse(response: Response): SManga {
|
||||||
val series = json.decodeFromString<MangaDetDto>(response.body.string())
|
val series = json.decodeFromString<MangaDetDto>(response.body.string())
|
||||||
branches[series.title.en] = series.branches
|
branches[series.id.toString()] = series.branches
|
||||||
return series.toSManga()
|
return series.toSManga()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,13 +310,13 @@ class Newbie : ConfigurableSource, HttpSource() {
|
||||||
private fun mangaBranches(manga: SManga): List<BranchesDto> {
|
private fun mangaBranches(manga: SManga): List<BranchesDto> {
|
||||||
val response = client.newCall(titleDetailsRequest(manga)).execute()
|
val response = client.newCall(titleDetailsRequest(manga)).execute()
|
||||||
val series = json.decodeFromString<MangaDetDto>(response.body.string())
|
val series = json.decodeFromString<MangaDetDto>(response.body.string())
|
||||||
branches[series.title.en] = series.branches
|
branches[series.id.toString()] = series.branches
|
||||||
return series.branches
|
return series.branches
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun selector(b: BranchesDto): Boolean = b.is_default
|
private fun selector(b: BranchesDto): Boolean = b.is_default
|
||||||
override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> {
|
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 {
|
return when {
|
||||||
branch.isEmpty() -> {
|
branch.isEmpty() -> {
|
||||||
return Observable.just(listOf())
|
return Observable.just(listOf())
|
||||||
|
@ -365,6 +365,10 @@ class Newbie : ConfigurableSource, HttpSource() {
|
||||||
return GET(API_URL + "/chapters/${chapter.url.substringAfterLast("/")}/pages", headers)
|
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> {
|
private fun pageListParse(response: Response, urlRequest: String): List<Page> {
|
||||||
val pages = json.decodeFromString<List<PageDto>>(response.body.string())
|
val pages = json.decodeFromString<List<PageDto>>(response.body.string())
|
||||||
val result = mutableListOf<Page>()
|
val result = mutableListOf<Page>()
|
||||||
|
|
Loading…
Reference in New Issue