Shinigami (id): fix blocked by cloudflare/bad browser (#18635)
- add some rate limit - add random value header Closes #18435 Closes #18506
This commit is contained in:
parent
1180e8349d
commit
f392a3eb16
|
@ -1,15 +1,38 @@
|
|||
package eu.kanade.tachiyomi.extension.id.shinigami
|
||||
|
||||
import eu.kanade.tachiyomi.multisrc.madara.Madara
|
||||
import eu.kanade.tachiyomi.network.interceptor.rateLimit
|
||||
import eu.kanade.tachiyomi.source.model.SChapter
|
||||
import okhttp3.Headers
|
||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||
import okhttp3.OkHttpClient
|
||||
import org.jsoup.nodes.Element
|
||||
import java.util.concurrent.TimeUnit
|
||||
import kotlin.random.Random
|
||||
|
||||
class Shinigami : Madara("Shinigami", "https://shinigami.sh", "id") {
|
||||
// moved from Reaper Scans (id) to Shinigami (id)
|
||||
override val id = 3411809758861089969
|
||||
|
||||
override val mangaSubString = "series"
|
||||
override val client: OkHttpClient = super.client.newBuilder()
|
||||
.rateLimit(5, 1, TimeUnit.SECONDS)
|
||||
.build()
|
||||
|
||||
override fun headersBuilder(): Headers.Builder = super.headersBuilder()
|
||||
.add("X-Requested-With", randomString)
|
||||
|
||||
private fun generateRandomString(length: Int): String {
|
||||
val charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZ.abcdefghijklmnopqrstuvwxyz.0123456789"
|
||||
return (1..length)
|
||||
.map { charset.random() }
|
||||
.joinToString("")
|
||||
}
|
||||
|
||||
private val randomLength = Random.Default.nextInt(13, 21)
|
||||
|
||||
private val randomString = generateRandomString(randomLength)
|
||||
|
||||
override val mangaSubString = "semua-series"
|
||||
|
||||
// Tags are useless as they are just SEO keywords.
|
||||
override val mangaDetailsSelectorTag = ""
|
||||
|
|
|
@ -442,7 +442,7 @@ class MadaraGenerator : ThemeSourceGenerator {
|
|||
SingleLang("Shiba Manga", "https://shibamanga.com", "en"),
|
||||
SingleLang("Shield Manga", "https://shieldmanga.io", "en", overrideVersionCode = 3),
|
||||
SingleLang("Shimada Scans", "https://shimadascans.com", "en"),
|
||||
SingleLang("Shinigami", "https://shinigami.sh", "id", overrideVersionCode = 3),
|
||||
SingleLang("Shinigami", "https://shinigami.sh", "id", overrideVersionCode = 4),
|
||||
SingleLang("Shooting Star Scans", "https://shootingstarscans.com", "en"),
|
||||
SingleLang("ShoujoHearts", "https://shoujohearts.com", "en", overrideVersionCode = 2),
|
||||
SingleLang("Sinensis Scan", "https://sinensisscan.net", "pt-BR", pkgName = "sinensis", overrideVersionCode = 6),
|
||||
|
|
Loading…
Reference in New Issue