[RU]Desu open chapter no API (#13906)

* [RU]Desu open chapter no API

* fix

* [RU]Remanga open chapter no API
This commit is contained in:
Eshlender 2022-10-19 19:10:31 +05:00 committed by GitHub
parent 0a5202d84a
commit 5a07f6910e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'Desu' extName = 'Desu'
pkgNameSuffix = 'ru.desu' pkgNameSuffix = 'ru.desu'
extClass = '.Desu' extClass = '.Desu'
extVersionCode = 18 extVersionCode = 19
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -24,7 +24,6 @@ import okhttp3.Request
import okhttp3.Response import okhttp3.Response
import rx.Observable import rx.Observable
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
import java.text.DecimalFormat
class Desu : HttpSource() { class Desu : HttpSource() {
override val name = "Desu" override val name = "Desu"
@ -206,14 +205,16 @@ class Desu : HttpSource() {
val objChapter = obj["chapters"]!! val objChapter = obj["chapters"]!!
return objChapter.jsonObject["list"]!!.jsonArray.map { return objChapter.jsonObject["list"]!!.jsonArray.map {
val chapterObj = it.jsonObject val chapterObj = it.jsonObject
val ch = chapterObj["ch"]!!.jsonPrimitive.float val ch = chapterObj["ch"]!!.jsonPrimitive.content
val fullNumStr = "${chapterObj["vol"]!!.jsonPrimitive.int}. Глава " + DecimalFormat("#,###.##").format(ch).replace(",", ".") val vol = chapterObj["vol"]!!.jsonPrimitive.content
val fullNumStr = "$vol. Глава $ch"
val title = chapterObj["title"]!!.jsonPrimitive.contentOrNull ?: "" val title = chapterObj["title"]!!.jsonPrimitive.contentOrNull ?: ""
SChapter.create().apply { SChapter.create().apply {
name = "$fullNumStr $title" name = "$fullNumStr $title"
url = "/$cid/chapter/${chapterObj["id"]!!.jsonPrimitive.int}" // #apiChapter - JSON API url to automatically delete when chapter is opened in browser
chapter_number = ch url = "/manga/$cid/vol$vol/ch$ch/rus" + "#apiChapter/$cid/chapter/${chapterObj["id"]!!.jsonPrimitive.int}"
chapter_number = ch.toFloatOrNull() ?: -1f
date_upload = chapterObj["date"]!!.jsonPrimitive.long * 1000L date_upload = chapterObj["date"]!!.jsonPrimitive.long * 1000L
} }
}.filter { it.chapter_number <= objChapter.jsonObject["last"]!!.jsonObject["ch"]!!.jsonPrimitive.float } }.filter { it.chapter_number <= objChapter.jsonObject["last"]!!.jsonObject["ch"]!!.jsonPrimitive.float }
@ -222,7 +223,7 @@ class Desu : HttpSource() {
override fun chapterListRequest(manga: SManga): Request = titleDetailsRequest(manga) override fun chapterListRequest(manga: SManga): Request = titleDetailsRequest(manga)
override fun pageListRequest(chapter: SChapter): Request { override fun pageListRequest(chapter: SChapter): Request {
return GET(baseUrl + API_URL + chapter.url, headers) return GET(baseUrl + API_URL + chapter.url.substringAfterLast("#apiChapter"), headers)
} }
override fun pageListParse(response: Response): List<Page> { override fun pageListParse(response: Response): List<Page> {