[Ru]MangaOnlineBiz. Fix page and cdn parsing (#10480)

This commit is contained in:
Pavka 2022-01-17 18:08:15 +03:00 committed by GitHub
parent ebef041ded
commit 41f95f6947
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'Mangaonlinebiz'
pkgNameSuffix = 'ru.mangaonlinebiz'
extClass = '.MangaOnlineBiz'
extVersionCode = 9
extVersionCode = 10
}
apply from: "$rootDir/common.gradle"

View File

@ -156,10 +156,13 @@ class MangaOnlineBiz : ParsedHttpSource() {
override fun pageListParse(response: Response): List<Page> {
val html = response.body!!.string()
val jsonData = html.split("new App.Router.Chapter(").last().split("});").first() + "}"
val jsonObj = json.decodeFromString<JsonObject>(jsonData)
val cdnUrl = jsonObj["srcBaseUrl"]!!.jsonPrimitive.content
val pages = jsonObj["pages"]!!.jsonObject
val rawPages = html.split("'pages': ").last().split(",\n").first()
val jsonPages = json.decodeFromString<JsonObject>(rawPages)
val pages = jsonPages.jsonObject
val rawCdnUrl = html.split("'srcBaseUrl': ").last().split(",\n").first()
val cdnUrl = rawCdnUrl.replace("'", "")
val resPages = mutableListOf<Page>()
pages.entries.forEach { (page, jsonElement) ->
resPages.add(Page(page.toInt(), imageUrl = "$cdnUrl/${jsonElement.jsonObject["src"]!!.jsonPrimitive.content}"))