[Ru]MangaOnlineBiz. Fix page and cdn parsing (#10480)
This commit is contained in:
parent
ebef041ded
commit
41f95f6947
|
@ -6,7 +6,7 @@ ext {
|
||||||
extName = 'Mangaonlinebiz'
|
extName = 'Mangaonlinebiz'
|
||||||
pkgNameSuffix = 'ru.mangaonlinebiz'
|
pkgNameSuffix = 'ru.mangaonlinebiz'
|
||||||
extClass = '.MangaOnlineBiz'
|
extClass = '.MangaOnlineBiz'
|
||||||
extVersionCode = 9
|
extVersionCode = 10
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
|
|
@ -156,10 +156,13 @@ class MangaOnlineBiz : ParsedHttpSource() {
|
||||||
|
|
||||||
override fun pageListParse(response: Response): List<Page> {
|
override fun pageListParse(response: Response): List<Page> {
|
||||||
val html = response.body!!.string()
|
val html = response.body!!.string()
|
||||||
val jsonData = html.split("new App.Router.Chapter(").last().split("});").first() + "}"
|
val rawPages = html.split("'pages': ").last().split(",\n").first()
|
||||||
val jsonObj = json.decodeFromString<JsonObject>(jsonData)
|
val jsonPages = json.decodeFromString<JsonObject>(rawPages)
|
||||||
val cdnUrl = jsonObj["srcBaseUrl"]!!.jsonPrimitive.content
|
val pages = jsonPages.jsonObject
|
||||||
val pages = jsonObj["pages"]!!.jsonObject
|
|
||||||
|
val rawCdnUrl = html.split("'srcBaseUrl': ").last().split(",\n").first()
|
||||||
|
val cdnUrl = rawCdnUrl.replace("'", "")
|
||||||
|
|
||||||
val resPages = mutableListOf<Page>()
|
val resPages = mutableListOf<Page>()
|
||||||
pages.entries.forEach { (page, jsonElement) ->
|
pages.entries.forEach { (page, jsonElement) ->
|
||||||
resPages.add(Page(page.toInt(), imageUrl = "$cdnUrl/${jsonElement.jsonObject["src"]!!.jsonPrimitive.content}"))
|
resPages.add(Page(page.toInt(), imageUrl = "$cdnUrl/${jsonElement.jsonObject["src"]!!.jsonPrimitive.content}"))
|
||||||
|
|
Loading…
Reference in New Issue