[Ru]MangaOnlineBiz. Fix page and cdn parsing (#10480)
This commit is contained in:
parent
ebef041ded
commit
41f95f6947
|
@ -6,7 +6,7 @@ ext {
|
|||
extName = 'Mangaonlinebiz'
|
||||
pkgNameSuffix = 'ru.mangaonlinebiz'
|
||||
extClass = '.MangaOnlineBiz'
|
||||
extVersionCode = 9
|
||||
extVersionCode = 10
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
||||
|
|
|
@ -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}"))
|
||||
|
|
Loading…
Reference in New Issue