Update url and Change theme for SinensisScan "pt-BR" (#2193)

* update url and change theme for SinensisScan "pt"

* Update SinensisScan.kt

* Update build.gradle

* remove  id

* peachscan

* Update build.gradle
This commit is contained in:
mohamedotaku 2024-03-31 07:13:58 +00:00 committed by Draff
parent 631272428e
commit 7217df6180
2 changed files with 8 additions and 52 deletions

View File

@ -1,9 +1,9 @@
ext {
extName = 'Sinensis Scan'
extClass = '.SinensisScan'
themePkg = 'madara'
baseUrl = 'https://sinensisscan.net'
overrideVersionCode = 6
themePkg = 'peachscan'
baseUrl = 'https://sinensistoon.com'
overrideVersionCode = 38
}
apply from: "$rootDir/common.gradle"

View File

@ -1,56 +1,12 @@
package eu.kanade.tachiyomi.extension.pt.sinensis
import eu.kanade.tachiyomi.multisrc.madara.Madara
import eu.kanade.tachiyomi.network.interceptor.rateLimit
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.OkHttpClient
import org.jsoup.nodes.Element
import eu.kanade.tachiyomi.multisrc.peachscan.PeachScan
import java.text.SimpleDateFormat
import java.util.Locale
import java.util.concurrent.TimeUnit
class SinensisScan : Madara(
class SinensisScan : PeachScan(
"Sinensis Scan",
"https://sinensisscan.net",
"https://sinensistoon.com",
"pt-BR",
SimpleDateFormat("dd/MM/yyyy", Locale("pt", "BR")),
) {
// Name changed from Sinensis to Sinensis Scan
override val id: Long = 3891513807564817914
override val client: OkHttpClient = super.client.newBuilder()
.rateLimit(1, 2, TimeUnit.SECONDS)
.build()
override fun popularMangaFromElement(element: Element): SManga {
return super.popularMangaFromElement(element).apply {
setUrlWithoutDomain(url.removeBadPath("manga"))
}
}
override fun searchMangaFromElement(element: Element): SManga {
return super.searchMangaFromElement(element).apply {
setUrlWithoutDomain(url.removeBadPath("manga"))
}
}
override fun chapterFromElement(element: Element): SChapter {
return super.chapterFromElement(element).apply {
setUrlWithoutDomain(url.removeBadPath("manga"))
}
}
private fun String.removeBadPath(expectedFirstPath: String): String {
val fullUrl = if (contains(baseUrl)) this else (baseUrl + this)
val url = fullUrl.toHttpUrl()
if (url.pathSegments.firstOrNull() != expectedFirstPath) {
return url.newBuilder().removePathSegment(0).toString()
}
return url.toString()
}
}
SimpleDateFormat("dd 'de' MMMM 'de' yyyy 'às' HH:mm", Locale("pt", "BR")),
)