LikeManga: Fix only showing 11 pages (#19018)

* Fix

* Unused !!
This commit is contained in:
bapeey 2023-11-20 11:40:18 -05:00 committed by GitHub
parent 84e785f2d3
commit 5176d3bdab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 3 deletions

View File

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

View File

@ -1,5 +1,6 @@
package eu.kanade.tachiyomi.extension.en.likemanga package eu.kanade.tachiyomi.extension.en.likemanga
import android.util.Base64
import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.network.interceptor.rateLimit
import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.Filter
@ -11,6 +12,7 @@ import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.online.ParsedHttpSource import eu.kanade.tachiyomi.source.online.ParsedHttpSource
import eu.kanade.tachiyomi.util.asJsoup import eu.kanade.tachiyomi.util.asJsoup
import kotlinx.serialization.json.Json import kotlinx.serialization.json.Json
import kotlinx.serialization.json.jsonArray
import kotlinx.serialization.json.jsonObject import kotlinx.serialization.json.jsonObject
import kotlinx.serialization.json.jsonPrimitive import kotlinx.serialization.json.jsonPrimitive
import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.HttpUrl.Companion.toHttpUrl
@ -31,6 +33,8 @@ class LikeManga : ParsedHttpSource() {
override val baseUrl = "https://likemanga.io" override val baseUrl = "https://likemanga.io"
private val imgCdnUrl = "https://like1.likemanga.io"
override val supportsLatest = true override val supportsLatest = true
override val client = network.cloudflareClient.newBuilder() override val client = network.cloudflareClient.newBuilder()
@ -251,9 +255,21 @@ class LikeManga : ParsedHttpSource() {
} }
override fun pageListParse(document: Document): List<Page> { override fun pageListParse(document: Document): List<Page> {
return document.select(".reading-detail img:not(noscript img)").mapIndexed { i, img -> val element = document.selectFirst("div.reading input#next_img_token")
Page(i, "", img.imgAttr())
if (element != null) {
val token = element.attr("value").split(".")[1]
val jsonData = json.parseToJsonElement(String(Base64.decode(token, Base64.DEFAULT))).jsonObject
val encodedImgArray = jsonData["data"]!!.jsonPrimitive.content
val imgArray = String(Base64.decode(encodedImgArray, Base64.DEFAULT))
return json.parseToJsonElement(imgArray).jsonArray.mapIndexed { i, img ->
Page(i, "", "$imgCdnUrl/${img.jsonPrimitive.content}")
}
} }
return document.select("div.reading-detail.box_doc img:not(noscript img)")
.mapIndexed { i, img -> Page(i, "", img.imgAttr()) }
} }
private fun Element.imgAttr(): String? { private fun Element.imgAttr(): String? {