parent
cf75a1f995
commit
850c5dce7e
@ -3,7 +3,7 @@ ext {
|
|||||||
extClass = '.MangaTale'
|
extClass = '.MangaTale'
|
||||||
themePkg = 'mangathemesia'
|
themePkg = 'mangathemesia'
|
||||||
baseUrl = 'https://mangatale.co'
|
baseUrl = 'https://mangatale.co'
|
||||||
overrideVersionCode = 2
|
overrideVersionCode = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
@ -2,13 +2,30 @@ package eu.kanade.tachiyomi.extension.id.mangatale
|
|||||||
|
|
||||||
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.MediaType.Companion.toMediaType
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
|
import okhttp3.ResponseBody.Companion.toResponseBody
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
|
|
||||||
class MangaTale : MangaThemesia("MangaTale", "https://mangatale.co", "id") {
|
class MangaTale : MangaThemesia("MangaTale", "https://mangatale.co", "id") {
|
||||||
|
|
||||||
override val client: OkHttpClient = super.client.newBuilder()
|
override val client: OkHttpClient = super.client.newBuilder()
|
||||||
.rateLimit(20, 5)
|
.rateLimit(20, 5)
|
||||||
|
.addInterceptor { chain ->
|
||||||
|
val response = chain.proceed(chain.request())
|
||||||
|
val mime = response.headers["Content-Type"]
|
||||||
|
if (response.isSuccessful) {
|
||||||
|
if (mime != "application/octet-stream") {
|
||||||
|
return@addInterceptor response
|
||||||
|
}
|
||||||
|
// Fix image content type
|
||||||
|
val type = IMG_CONTENT_TYPE.toMediaType()
|
||||||
|
val body = response.body.bytes().toResponseBody(type)
|
||||||
|
return@addInterceptor response.newBuilder().body(body)
|
||||||
|
.header("Content-Type", IMG_CONTENT_TYPE).build()
|
||||||
|
}
|
||||||
|
response
|
||||||
|
}
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
override val seriesTitleSelector = ".ts-breadcrumb li:last-child span"
|
override val seriesTitleSelector = ".ts-breadcrumb li:last-child span"
|
||||||
@ -16,4 +33,8 @@ class MangaTale : MangaThemesia("MangaTale", "https://mangatale.co", "id") {
|
|||||||
override fun mangaDetailsParse(document: Document) = super.mangaDetailsParse(document).apply {
|
override fun mangaDetailsParse(document: Document) = super.mangaDetailsParse(document).apply {
|
||||||
thumbnail_url = document.selectFirst(seriesThumbnailSelector)?.imgAttr()
|
thumbnail_url = document.selectFirst(seriesThumbnailSelector)?.imgAttr()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val IMG_CONTENT_TYPE = "image/jpeg"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user