Fix MangaPlus chapters for MangaDex

This commit is contained in:
Jobobby04 2021-01-21 14:47:03 -05:00
parent a17c4c151f
commit 34f8407983
2 changed files with 3 additions and 6 deletions

View File

@ -151,8 +151,8 @@ class MangaDex(delegate: HttpSource, val context: Context) :
}
private fun mangaPlusPageListRequest(chapter: SChapter): Request {
val chpUrl = chapter.url.substringBefore(MdUtil.apiChapterSuffix)
return GET(MdUtil.baseUrl + chpUrl + MdUtil.apiChapterSuffix, headers, CacheControl.FORCE_NETWORK)
val urlChapterId = MdUtil.getChapterId(chapter.url)
return GET(MdUtil.apiUrl + MdUtil.newApiChapter + urlChapterId + MdUtil.apiChapterSuffix, headers, CacheControl.FORCE_NETWORK)
}
override fun fetchImage(page: Page): Observable<Response> {

View File

@ -4,8 +4,6 @@ import eu.kanade.tachiyomi.network.parseAs
import eu.kanade.tachiyomi.source.model.Page
import exh.md.handlers.serializers.ApiChapterSerializer
import exh.md.utils.MdUtil
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.jsonObject
import kotlinx.serialization.json.jsonPrimitive
@ -27,8 +25,7 @@ class ApiChapterParser {
}
fun externalParse(response: Response): String {
val jsonData = response.body!!.string()
val json = Json.decodeFromString<JsonObject>(jsonData)
val json = response.parseAs<JsonObject>()
val external = json["data"]!!.jsonObject["pages"]!!.jsonPrimitive.content
return external.substringAfterLast("/")
}