Fix no pages found in RS and add rate limiting. (#11530)
This commit is contained in:
parent
566f6e082b
commit
64ed6a5349
|
@ -1,20 +1,51 @@
|
||||||
package eu.kanade.tachiyomi.extension.en.realmscans
|
package eu.kanade.tachiyomi.extension.en.realmscans
|
||||||
|
|
||||||
|
import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor
|
||||||
import eu.kanade.tachiyomi.multisrc.wpmangareader.WPMangaReader
|
import eu.kanade.tachiyomi.multisrc.wpmangareader.WPMangaReader
|
||||||
import eu.kanade.tachiyomi.source.model.Page
|
import eu.kanade.tachiyomi.source.model.Page
|
||||||
|
import kotlinx.serialization.json.jsonArray
|
||||||
|
import kotlinx.serialization.json.jsonPrimitive
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
|
class RealmScans : WPMangaReader(
|
||||||
|
"Realm Scans",
|
||||||
|
"https://realmscans.com",
|
||||||
|
"en",
|
||||||
|
"/series"
|
||||||
|
) {
|
||||||
|
|
||||||
|
override val client: OkHttpClient = super.client.newBuilder()
|
||||||
|
.addInterceptor(RateLimitInterceptor(1, 1, TimeUnit.SECONDS))
|
||||||
|
.build()
|
||||||
|
|
||||||
class RealmScans : WPMangaReader("Realm Scans", "https://realmscans.com", "en", "/series") {
|
|
||||||
override fun pageListParse(document: Document): List<Page> {
|
override fun pageListParse(document: Document): List<Page> {
|
||||||
|
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()
|
||||||
|
|
||||||
countViews(document)
|
countViews(document)
|
||||||
|
|
||||||
return document.select(pageSelector).mapIndexed { i, img ->
|
if (pages.isNotEmpty()) {
|
||||||
val url = if (img.attr("data-wpfc-original-src").isEmpty())
|
return pages
|
||||||
img.attr("abs:src")
|
|
||||||
else
|
|
||||||
img.attr("data-wpfc-original-src")
|
|
||||||
|
|
||||||
Page(i, "", url)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val docString = document.toString()
|
||||||
|
val imageListRegex = "\\\"images.*?:.*?(\\[.*?\\])".toRegex()
|
||||||
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ abstract class WPMangaReader(
|
||||||
|
|
||||||
override val client: OkHttpClient = network.cloudflareClient
|
override val client: OkHttpClient = network.cloudflareClient
|
||||||
|
|
||||||
private val json: Json by injectLazy()
|
protected val json: Json by injectLazy()
|
||||||
|
|
||||||
// popular
|
// popular
|
||||||
override fun popularMangaRequest(page: Int) = searchMangaRequest(page, "", FilterList(OrderByFilter(5)))
|
override fun popularMangaRequest(page: Int) = searchMangaRequest(page, "", FilterList(OrderByFilter(5)))
|
||||||
|
|
|
@ -35,7 +35,7 @@ class WPMangaReaderGenerator : ThemeSourceGenerator {
|
||||||
SingleLang("TurkToon", "https://turktoon.com", "tr"),
|
SingleLang("TurkToon", "https://turktoon.com", "tr"),
|
||||||
SingleLang("Gecenin Lordu", "https://geceninlordu.com", "tr", overrideVersionCode = 1),
|
SingleLang("Gecenin Lordu", "https://geceninlordu.com", "tr", overrideVersionCode = 1),
|
||||||
SingleLang("PMScans", "http://www.rackusreader.org", "en", overrideVersionCode = 2),
|
SingleLang("PMScans", "http://www.rackusreader.org", "en", overrideVersionCode = 2),
|
||||||
SingleLang("Realm Scans", "https://realmscans.com", "en", overrideVersionCode = 2),
|
SingleLang("Realm Scans", "https://realmscans.com", "en", overrideVersionCode = 3),
|
||||||
SingleLang("Skull Scans", "https://www.skullscans.com", "en", overrideVersionCode = 1),
|
SingleLang("Skull Scans", "https://www.skullscans.com", "en", overrideVersionCode = 1),
|
||||||
SingleLang("Shimada Scans", "https://shimadascans.com", "en"),
|
SingleLang("Shimada Scans", "https://shimadascans.com", "en"),
|
||||||
SingleLang("Shooting Star Scans", "https://shootingstarscans.com", "en", overrideVersionCode = 3),
|
SingleLang("Shooting Star Scans", "https://shootingstarscans.com", "en", overrideVersionCode = 3),
|
||||||
|
|
Loading…
Reference in New Issue