From 41f95f69472defc16ae960d67ab50592af0c5c61 Mon Sep 17 00:00:00 2001 From: Pavka Date: Mon, 17 Jan 2022 18:08:15 +0300 Subject: [PATCH] [Ru]MangaOnlineBiz. Fix page and cdn parsing (#10480) --- src/ru/mangaonlinebiz/build.gradle | 2 +- .../extension/ru/mangaonlinebiz/MangaOnlineBiz.kt | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/ru/mangaonlinebiz/build.gradle b/src/ru/mangaonlinebiz/build.gradle index c8d5682e0..99ae573e0 100644 --- a/src/ru/mangaonlinebiz/build.gradle +++ b/src/ru/mangaonlinebiz/build.gradle @@ -6,7 +6,7 @@ ext { extName = 'Mangaonlinebiz' pkgNameSuffix = 'ru.mangaonlinebiz' extClass = '.MangaOnlineBiz' - extVersionCode = 9 + extVersionCode = 10 } apply from: "$rootDir/common.gradle" diff --git a/src/ru/mangaonlinebiz/src/eu/kanade/tachiyomi/extension/ru/mangaonlinebiz/MangaOnlineBiz.kt b/src/ru/mangaonlinebiz/src/eu/kanade/tachiyomi/extension/ru/mangaonlinebiz/MangaOnlineBiz.kt index ad3983747..63928c401 100644 --- a/src/ru/mangaonlinebiz/src/eu/kanade/tachiyomi/extension/ru/mangaonlinebiz/MangaOnlineBiz.kt +++ b/src/ru/mangaonlinebiz/src/eu/kanade/tachiyomi/extension/ru/mangaonlinebiz/MangaOnlineBiz.kt @@ -156,10 +156,13 @@ class MangaOnlineBiz : ParsedHttpSource() { override fun pageListParse(response: Response): List { val html = response.body!!.string() - val jsonData = html.split("new App.Router.Chapter(").last().split("});").first() + "}" - val jsonObj = json.decodeFromString(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(rawPages) + val pages = jsonPages.jsonObject + + val rawCdnUrl = html.split("'srcBaseUrl': ").last().split(",\n").first() + val cdnUrl = rawCdnUrl.replace("'", "") + val resPages = mutableListOf() pages.entries.forEach { (page, jsonElement) -> resPages.add(Page(page.toInt(), imageUrl = "$cdnUrl/${jsonElement.jsonObject["src"]!!.jsonPrimitive.content}"))