KomikStation: fix chapter page (#7520)
This commit is contained in:
parent
13ff9880f4
commit
1d3c14b75e
|
@ -1,9 +1,15 @@
|
|||
package eu.kanade.tachiyomi.extension.id.komikstation
|
||||
|
||||
import eu.kanade.tachiyomi.multisrc.wpmangastream.WPMangaStream
|
||||
import okhttp3.OkHttpClient
|
||||
import java.util.concurrent.TimeUnit
|
||||
import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor
|
||||
import eu.kanade.tachiyomi.multisrc.wpmangastream.WPMangaStream
|
||||
import eu.kanade.tachiyomi.source.model.Page
|
||||
import kotlinx.serialization.json.Json
|
||||
import kotlinx.serialization.json.jsonArray
|
||||
import kotlinx.serialization.json.jsonPrimitive
|
||||
import okhttp3.OkHttpClient
|
||||
import org.jsoup.nodes.Document
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
class KomikStation : WPMangaStream("Komik Station", "https://komikstation.com", "id") {
|
||||
// Formerly "Komik Station (WP Manga Stream)"
|
||||
|
@ -17,4 +23,27 @@ class KomikStation : WPMangaStream("Komik Station", "https://komikstation.com",
|
|||
.addNetworkInterceptor(rateLimitInterceptor)
|
||||
.build()
|
||||
|
||||
private val json: Json by injectLazy()
|
||||
|
||||
override fun pageListParse(document: Document): List<Page> {
|
||||
val pages = mutableListOf<Page>()
|
||||
document.select(pageSelector)
|
||||
.filterNot { it.attr("src").isNullOrEmpty() }
|
||||
.mapIndexed { i, img -> pages.add(Page(i, "", img.attr("abs:src"))) }
|
||||
|
||||
// Some sites like mangakita now load pages via javascript
|
||||
if (pages.isNotEmpty()) { return pages }
|
||||
|
||||
val docString = document.toString()
|
||||
val imageListRegex = Regex("\\\"images.*?:.*?(\\[.*?\\])")
|
||||
val imageListJson = imageListRegex.find(docString)!!.destructured.toList()[0]
|
||||
|
||||
val imageList = json.parseToJsonElement(imageListJson).jsonArray
|
||||
|
||||
pages += imageList.mapIndexed { i, jsonEl ->
|
||||
Page(i, "", jsonEl.jsonPrimitive.content)
|
||||
}
|
||||
|
||||
return pages
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ class WPMangaStreamGenerator : ThemeSourceGenerator {
|
|||
SingleLang("Boosei", "https://boosei.com", "id"),
|
||||
SingleLang("Mangakyo", "https://www.mangakyo.me", "id"),
|
||||
SingleLang("Sekte Komik", "https://sektekomik.com", "id", overrideVersionCode = 2),
|
||||
SingleLang("Komik Station", "https://komikstation.com", "id"),
|
||||
SingleLang("Komik Station", "https://komikstation.com", "id", overrideVersionCode = 1),
|
||||
SingleLang("Non-Stop Scans", "https://www.nonstopscans.com", "en", className = "NonStopScans"),
|
||||
SingleLang("KomikIndo.co", "https://komikindo.co", "id", className = "KomikindoCo"),
|
||||
SingleLang("Readkomik", "https://readkomik.com", "en", className = "ReadKomik"),
|
||||
|
|
Loading…
Reference in New Issue