Magus Manga: Update domain & icons (#3491)
* MagusManga: Update domain * MagusManga: Update icons * MagusManga: Swap to `MangaThemesiaALt` * MagusManga: Use LS `wafffCookieInterceptor` code for chapter page loading issue
@ -2,8 +2,8 @@ ext {
|
||||
extName = 'Magus Manga'
|
||||
extClass = '.MagusManga'
|
||||
themePkg = 'mangathemesia'
|
||||
baseUrl = 'https://neroscans.com'
|
||||
overrideVersionCode = 4
|
||||
baseUrl = 'https://dmvdepot.com'
|
||||
overrideVersionCode = 5
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
||||
|
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 8.5 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 22 KiB |
@ -1,21 +1,57 @@
|
||||
package eu.kanade.tachiyomi.extension.en.magusmanga
|
||||
|
||||
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia
|
||||
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesiaAlt
|
||||
import eu.kanade.tachiyomi.network.interceptor.rateLimit
|
||||
import okhttp3.Cookie
|
||||
import okhttp3.Interceptor
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Response
|
||||
import org.jsoup.Jsoup
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Locale
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
class MagusManga : MangaThemesia(
|
||||
class MagusManga : MangaThemesiaAlt(
|
||||
"Magus Manga",
|
||||
"https://neroscans.com",
|
||||
"https://dmvdepot.com",
|
||||
"en",
|
||||
mangaUrlDirectory = "/series",
|
||||
dateFormat = SimpleDateFormat("MMMMM dd, yyyy", Locale("en")),
|
||||
) {
|
||||
override val id = 7792477462646075400
|
||||
|
||||
override val client = super.client.newBuilder()
|
||||
override val client: OkHttpClient = super.client.newBuilder()
|
||||
.addInterceptor(::wafffCookieInterceptor)
|
||||
.rateLimit(1, 1, TimeUnit.SECONDS)
|
||||
.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 = waffRegex.find(script)?.groups?.get("waff")?.value
|
||||
?.let { Cookie.parse(request.url, it) }
|
||||
|
||||
client.cookieJar.saveFromResponse(
|
||||
request.url,
|
||||
listOfNotNull(cookie),
|
||||
)
|
||||
|
||||
response.close()
|
||||
|
||||
chain.proceed(request)
|
||||
} else {
|
||||
response
|
||||
}
|
||||
}
|
||||
|
||||
private val waffRegex = Regex("""document\.cookie\s*=\s*['"](?<waff>.*)['"]""")
|
||||
}
|
||||
|