CManga: Fix missing content in getPages

master
Draken 7 months ago committed by GitHub
parent d4e1acd515
commit 560cf63a5e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -194,10 +194,7 @@ internal class CMangaParser(context: MangaLoaderContext) :
throw IllegalStateException("This chapter is locked, you would need to buy it from website") throw IllegalStateException("This chapter is locked, you would need to buy it from website")
} }
return pageResponse.getJSONArray("image") return pageResponse.getJSONArray("image").asTypedList<String>().map {
.asTypedList<String>()
.filterNot(::containsAdsUrl)
.map {
MangaPage( MangaPage(
id = generateUid(it), id = generateUid(it),
url = it, url = it,
@ -223,19 +220,9 @@ internal class CMangaParser(context: MangaLoaderContext) :
return tags return tags
} }
private fun JSONObject.parseJson(key: String): JSONObject {
return JSONObject(getString(key))
}
private fun JSONObject.isLocked() = opt("lock") != null private fun JSONObject.isLocked() = opt("lock") != null
private fun containsAdsUrl(url: String): Boolean { private fun JSONObject.parseJson(key: String): JSONObject {
val adsUrl = "https://img.cmangapi.com/data-image/index.php" return JSONObject(getString(key))
val cleanUrl = url.replace("\\", "")
return when {
cleanUrl.startsWith(adsUrl) -> true
cleanUrl.contains("?v=12&data=") -> true
else -> false
}
} }
} }

Loading…
Cancel
Save