LikeManga: Fix "Image couldn't be loaded" (#19046)

Get imgCdn url from document
This commit is contained in:
bapeey 2023-11-20 12:51:06 -05:00 committed by GitHub
parent 874cbe5dce
commit 626fbd0534
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'LikeManga'
pkgNameSuffix = 'en.likemanga'
extClass = '.LikeManga'
extVersionCode = 2
extVersionCode = 3
}
apply from: "$rootDir/common.gradle"

View File

@ -33,8 +33,6 @@ class LikeManga : ParsedHttpSource() {
override val baseUrl = "https://likemanga.io"
private val imgCdnUrl = "https://like1.likemanga.io"
override val supportsLatest = true
override val client = network.cloudflareClient.newBuilder()
@ -258,6 +256,9 @@ class LikeManga : ParsedHttpSource() {
val element = document.selectFirst("div.reading input#next_img_token")
if (element != null) {
val imgCdnUrl = document.selectFirst("div.reading #currentlink")?.attr("value")
?: throw Exception("Could not find image CDN URL")
val token = element.attr("value").split(".")[1]
val jsonData = json.parseToJsonElement(String(Base64.decode(token, Base64.DEFAULT))).jsonObject
val encodedImgArray = jsonData["data"]!!.jsonPrimitive.content