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,17 +194,14 @@ 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>() MangaPage(
.filterNot(::containsAdsUrl) id = generateUid(it),
.map { url = it,
MangaPage( source = source,
id = generateUid(it), preview = null,
url = it, )
source = source, }
preview = null,
)
}
} }
private suspend fun getTags(): Map<String, MangaTag> { private suspend fun getTags(): Map<String, MangaTag> {
@ -223,19 +220,9 @@ internal class CMangaParser(context: MangaLoaderContext) :
return tags return tags
} }
private fun JSONObject.isLocked() = opt("lock") != null
private fun JSONObject.parseJson(key: String): JSONObject { private fun JSONObject.parseJson(key: String): JSONObject {
return JSONObject(getString(key)) return JSONObject(getString(key))
} }
private fun JSONObject.isLocked() = opt("lock") != null
private fun containsAdsUrl(url: String): Boolean {
val adsUrl = "https://img.cmangapi.com/data-image/index.php"
val cleanUrl = url.replace("\\", "")
return when {
cleanUrl.startsWith(adsUrl) -> true
cleanUrl.contains("?v=12&data=") -> true
else -> false
}
}
} }

Loading…
Cancel
Save