parent
66edae8b60
commit
8e28453769
|
@ -3,7 +3,7 @@ ext {
|
||||||
extClass = '.LuaScans'
|
extClass = '.LuaScans'
|
||||||
themePkg = 'mangathemesia'
|
themePkg = 'mangathemesia'
|
||||||
baseUrl = 'https://luascans.com'
|
baseUrl = 'https://luascans.com'
|
||||||
overrideVersionCode = 1
|
overrideVersionCode = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
|
|
@ -2,7 +2,11 @@ package eu.kanade.tachiyomi.extension.en.luascans
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia
|
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia
|
||||||
import eu.kanade.tachiyomi.network.interceptor.rateLimit
|
import eu.kanade.tachiyomi.network.interceptor.rateLimit
|
||||||
|
import okhttp3.Cookie
|
||||||
|
import okhttp3.Interceptor
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
|
import okhttp3.Response
|
||||||
|
import org.jsoup.Jsoup
|
||||||
|
|
||||||
class LuaScans : MangaThemesia(
|
class LuaScans : MangaThemesia(
|
||||||
"Lua Scans",
|
"Lua Scans",
|
||||||
|
@ -10,6 +14,35 @@ class LuaScans : MangaThemesia(
|
||||||
"en",
|
"en",
|
||||||
) {
|
) {
|
||||||
override val client: OkHttpClient = super.client.newBuilder()
|
override val client: OkHttpClient = super.client.newBuilder()
|
||||||
.rateLimit(4)
|
.addInterceptor(::wafffCookieInterceptor)
|
||||||
|
.rateLimit(2)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
|
private fun wafffCookieInterceptor(chain: Interceptor.Chain): Response {
|
||||||
|
val request = chain.request()
|
||||||
|
val response = chain.proceed(request)
|
||||||
|
|
||||||
|
val document = Jsoup.parse(
|
||||||
|
response.peekBody(Long.MAX_VALUE).string(),
|
||||||
|
response.request.url.toString(),
|
||||||
|
)
|
||||||
|
|
||||||
|
return if (document.selectFirst("script:containsData(wafff)") != null) {
|
||||||
|
val script = document.selectFirst("script:containsData(wafff)")!!.data()
|
||||||
|
|
||||||
|
val cookie = script.substringAfter("document.cookie=\"")
|
||||||
|
.substringBefore("\"")
|
||||||
|
|
||||||
|
client.cookieJar.saveFromResponse(
|
||||||
|
request.url,
|
||||||
|
listOfNotNull(Cookie.parse(request.url, cookie)),
|
||||||
|
)
|
||||||
|
|
||||||
|
response.close()
|
||||||
|
|
||||||
|
chain.proceed(request)
|
||||||
|
} else {
|
||||||
|
response
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue