MangaTale: Fix pages not found in downloads (#3148)

* Fix

* review
This commit is contained in:
bapeey 2024-05-22 00:26:57 -05:00 committed by GitHub
parent 2730cea160
commit a174505f18
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 1 deletions

View File

@ -3,7 +3,7 @@ ext {
extClass = '.MangaTale'
themePkg = 'mangathemesia'
baseUrl = 'https://mangatale.co'
overrideVersionCode = 2
overrideVersionCode = 3
}
apply from: "$rootDir/common.gradle"

View File

@ -2,13 +2,30 @@ package eu.kanade.tachiyomi.extension.id.mangatale
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia
import eu.kanade.tachiyomi.network.interceptor.rateLimit
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.OkHttpClient
import okhttp3.ResponseBody.Companion.toResponseBody
import org.jsoup.nodes.Document
class MangaTale : MangaThemesia("MangaTale", "https://mangatale.co", "id") {
override val client: OkHttpClient = super.client.newBuilder()
.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()
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 {
thumbnail_url = document.selectFirst(seriesThumbnailSelector)?.imgAttr()
}
companion object {
private const val IMG_CONTENT_TYPE = "image/jpeg"
}
}