2021-11-14 09:42:17 +00:00
|
|
|
package eu.kanade.tachiyomi.extension.en.realmscans
|
|
|
|
|
|
|
|
import eu.kanade.tachiyomi.multisrc.wpmangareader.WPMangaReader
|
2022-06-05 21:51:18 +00:00
|
|
|
import eu.kanade.tachiyomi.network.interceptor.rateLimit
|
2022-01-09 16:26:45 +00:00
|
|
|
import eu.kanade.tachiyomi.source.model.Page
|
2022-04-19 21:55:44 +00:00
|
|
|
import kotlinx.serialization.json.jsonArray
|
|
|
|
import kotlinx.serialization.json.jsonPrimitive
|
|
|
|
import okhttp3.OkHttpClient
|
2022-01-09 16:26:45 +00:00
|
|
|
import org.jsoup.nodes.Document
|
2022-04-19 21:55:44 +00:00
|
|
|
import java.util.concurrent.TimeUnit
|
|
|
|
|
|
|
|
class RealmScans : WPMangaReader(
|
|
|
|
"Realm Scans",
|
|
|
|
"https://realmscans.com",
|
|
|
|
"en",
|
|
|
|
"/series"
|
|
|
|
) {
|
|
|
|
|
|
|
|
override val client: OkHttpClient = super.client.newBuilder()
|
2022-06-05 21:51:18 +00:00
|
|
|
.rateLimit(1, 1, TimeUnit.SECONDS)
|
2022-04-19 21:55:44 +00:00
|
|
|
.build()
|
2021-11-14 09:42:17 +00:00
|
|
|
|
2022-01-09 16:26:45 +00:00
|
|
|
override fun pageListParse(document: Document): List<Page> {
|
2022-04-19 21:55:44 +00:00
|
|
|
val pages = document.select(pageSelector)
|
|
|
|
.mapIndexed { i, img ->
|
|
|
|
val url = img.attr("data-wpfc-original-src")
|
|
|
|
.ifEmpty { img.attr("abs:src") }
|
|
|
|
|
|
|
|
Page(i, "", url)
|
|
|
|
}
|
|
|
|
.toMutableList()
|
|
|
|
|
2022-01-09 16:26:45 +00:00
|
|
|
countViews(document)
|
|
|
|
|
2022-04-19 21:55:44 +00:00
|
|
|
if (pages.isNotEmpty()) {
|
|
|
|
return pages
|
|
|
|
}
|
|
|
|
|
|
|
|
val docString = document.toString()
|
|
|
|
val imageListRegex = "\\\"images.*?:.*?(\\[.*?\\])".toRegex()
|
|
|
|
val imageListJson = imageListRegex.find(docString)!!.destructured.toList()[0]
|
2022-01-09 16:26:45 +00:00
|
|
|
|
2022-04-19 21:55:44 +00:00
|
|
|
val imageList = json.parseToJsonElement(imageListJson).jsonArray
|
|
|
|
|
|
|
|
pages += imageList.mapIndexed { i, jsonEl ->
|
|
|
|
Page(i, "", jsonEl.jsonPrimitive.content)
|
2022-01-09 16:26:45 +00:00
|
|
|
}
|
2022-04-19 21:55:44 +00:00
|
|
|
|
|
|
|
return pages
|
2022-01-09 16:26:45 +00:00
|
|
|
}
|
|
|
|
}
|