DemonSect: Migrate theme (#4352)

* Migrate theme

* Use fetchChapterList
This commit is contained in:
Chopper 2024-08-01 05:04:21 -03:00 committed by Draff
parent 869afb9534
commit e8d27b655e
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
2 changed files with 19 additions and 49 deletions

View File

@ -1,9 +1,9 @@
ext { ext {
extName = 'Demon Sect' extName = 'Demon Sect'
extClass = '.DemonSect' extClass = '.DemonSect'
themePkg = 'madara' themePkg = 'mangathemesia'
baseUrl = 'https://dsectcomics.org' baseUrl = 'https://dsectcomics.org'
overrideVersionCode = 8 overrideVersionCode = 15
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -1,71 +1,41 @@
package eu.kanade.tachiyomi.extension.pt.prismascans package eu.kanade.tachiyomi.extension.pt.prismascans
import eu.kanade.tachiyomi.multisrc.madara.Madara import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia
import eu.kanade.tachiyomi.network.asObservable import eu.kanade.tachiyomi.network.asObservable
import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.network.interceptor.rateLimit
import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.SChapter
import okhttp3.MediaType.Companion.toMediaType import eu.kanade.tachiyomi.source.model.SManga
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.ResponseBody.Companion.toResponseBody
import okio.IOException
import rx.Observable import rx.Observable
import java.text.SimpleDateFormat
import java.util.Locale
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
class DemonSect : Madara( class DemonSect : MangaThemesia(
"Demon Sect", "Demon Sect",
"https://dsectcomics.org", "https://dsectcomics.org",
"pt-BR", "pt-BR",
SimpleDateFormat("MMMMM dd, yyyy", Locale("pt", "BR")), "/comics",
) { ) {
// Changed their name from Prisma Scans to Demon Sect. // Changed their name from Prisma Scans to Demon Sect.
override val id: Long = 8168108118738519332 override val id: Long = 8168108118738519332
override val client: OkHttpClient = super.client.newBuilder() override val client: OkHttpClient = super.client.newBuilder()
.addInterceptor { chain ->
val response = chain.proceed(chain.request())
val pathSegments = response.request.url.pathSegments
if (pathSegments.contains("login")) {
throw IOException("Faça o login na WebView para acessar o contéudo")
}
response
}
.addInterceptor { chain ->
val response = chain.proceed(chain.request())
val mime = response.headers["Content-Type"]
if (response.isSuccessful) {
if (mime == "application/octet-stream" || mime == null) {
// Fix image content type
val type = "image/jpeg".toMediaType()
val body = response.body.bytes().toResponseBody(type)
return@addInterceptor response.newBuilder().body(body)
.header("Content-Type", "image/jpeg").build()
}
}
response
}
.rateLimit(1, 2, TimeUnit.SECONDS) .rateLimit(1, 2, TimeUnit.SECONDS)
.build() .build()
override val useLoadMoreRequest = LoadMoreStrategy.Never override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> {
return client.newCall(chapterListRequest(manga))
override val useNewChapterEndpoint = true .asObservable()
override fun fetchPopularManga(page: Int): Observable<MangasPage> {
return client.newCall(popularMangaRequest(page))
.asObservable() // Site returns http 404 even if the result is successful
.map { response -> .map { response ->
popularMangaParse(response) if (!response.isSuccessful) {
} throw Exception(
} """
Obra não encontrada.
override fun fetchLatestUpdates(page: Int): Observable<MangasPage> { Realize a migração do título para atualizar.
return client.newCall(latestUpdatesRequest(page)) """.trimIndent(),
.asObservable() // Site returns http 404 even if the result is successful )
.map { response -> }
latestUpdatesParse(response) chapterListParse(response)
} }
} }
} }