parent
ba7836b0a1
commit
e2d97e0860
|
@ -3,7 +3,7 @@ ext {
|
|||
extClass = '.Hentairead'
|
||||
themePkg = 'madara'
|
||||
baseUrl = 'https://hentairead.com'
|
||||
overrideVersionCode = 5
|
||||
overrideVersionCode = 6
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import kotlinx.serialization.decodeFromString
|
|||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||
import okhttp3.Request
|
||||
import org.jsoup.nodes.Document
|
||||
import org.jsoup.nodes.Element
|
||||
import rx.Observable
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Locale
|
||||
|
@ -20,6 +21,21 @@ class Hentairead : Madara("HentaiRead", "https://hentairead.com", "en", dateForm
|
|||
|
||||
override val versionId: Int = 2
|
||||
|
||||
private val cdnHeaders = super.headersBuilder()
|
||||
.add("Accept", "image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8")
|
||||
.build()
|
||||
|
||||
override val client = super.client.newBuilder()
|
||||
.addInterceptor { chain ->
|
||||
val request = chain.request()
|
||||
val url = request.url.toString()
|
||||
if (url.contains("/wp-content/uploads/")) {
|
||||
return@addInterceptor chain.proceed(request.newBuilder().headers(cdnHeaders).build())
|
||||
}
|
||||
chain.proceed(request)
|
||||
}
|
||||
.build()
|
||||
|
||||
override val mangaSubString = "hentai"
|
||||
override val fetchGenres = false
|
||||
|
||||
|
@ -86,6 +102,16 @@ class Hentairead : Madara("HentaiRead", "https://hentairead.com", "en", dateForm
|
|||
}
|
||||
return GET(baseUrl + url, headers)
|
||||
}
|
||||
|
||||
override fun imageFromElement(element: Element): String? {
|
||||
return when {
|
||||
element.hasAttr("data-src") -> element.attr("abs:data-src")
|
||||
element.hasAttr("data-lazy-src") -> element.attr("abs:data-lazy-src")
|
||||
element.hasAttr("srcset") -> element.attr("abs:srcset").substringBefore(" ").removeSuffix(",")
|
||||
element.hasAttr("data-cfsrc") -> element.attr("abs:data-cfsrc")
|
||||
else -> element.attr("abs:src")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Serializable
|
||||
|
|
Loading…
Reference in New Issue