CosmicScans.id: fix browse, description, duplicate pages (#18105)

* CosmicScans.id: fix browse, description, duplicate pages

-add rate limit
-remove project page

Closes #16091
Closes #16107
Closes #16473

* fix search, project page
This commit is contained in:
Luqman 2023-09-24 05:56:13 +07:00 committed by GitHub
parent d6a4ff94c6
commit 3786c9ca6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 51 additions and 2 deletions

View File

@ -1,8 +1,57 @@
package eu.kanade.tachiyomi.extension.id.cosmicscansid
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.interceptor.rateLimit
import eu.kanade.tachiyomi.source.model.Filter
import eu.kanade.tachiyomi.source.model.FilterList
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.OkHttpClient
import okhttp3.Request
import java.util.concurrent.TimeUnit
class CosmicScansID : MangaThemesia("CosmicScans.id", "https://cosmicscans.id", "id") {
class CosmicScansID : MangaThemesia("CosmicScans.id", "https://cosmicscans.id", "id", "/semua-komik") {
override val client: OkHttpClient = super.client.newBuilder()
.rateLimit(20, 4, TimeUnit.SECONDS)
.build()
override val hasProjectPage = true
override val projectPageString = "/semua-komik"
// search
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
val url = baseUrl.toHttpUrl().newBuilder()
.addPathSegments("page/$page/")
.addQueryParameter("s", query)
filters.forEach { filter ->
when (filter) {
// if site has project page, default value "hasProjectPage" = false
is ProjectFilter -> {
if (filter.selectedValue() == "project-filter-on") {
url.setPathSegment(0, projectPageString.substring(1))
}
}
else -> { /* Do Nothing */ }
}
}
return GET(url.toString())
}
override fun getFilterList(): FilterList {
val filters = mutableListOf<Filter<*>>(
Filter.Separator(),
Filter.Header("$name Project List page"),
ProjectFilter(),
OrderByFilter(),
)
return FilterList(filters)
}
// manga details
override val seriesDescriptionSelector = ".entry-content[itemprop=description] :not(a,p:has(a))"
// pages
override val pageSelector = "div#readerarea img:not(noscript img)"
}

View File

@ -27,7 +27,7 @@ class MangaThemesiaGenerator : ThemeSourceGenerator {
SingleLang("Boosei", "https://boosei.net", "id", overrideVersionCode = 2),
SingleLang("Cartel de Manhwas", "https://carteldemanhwas.com", "es", overrideVersionCode = 5),
SingleLang("Cosmic Scans", "https://cosmicscans.com", "en", overrideVersionCode = 1),
SingleLang("CosmicScans.id", "https://cosmicscans.id", "id", overrideVersionCode = 1, className = "CosmicScansID"),
SingleLang("CosmicScans.id", "https://cosmicscans.id", "id", overrideVersionCode = 2, className = "CosmicScansID"),
SingleLang("Diskus Scan", "https://diskusscan.com", "pt-BR", overrideVersionCode = 7),
SingleLang("Dojing.net", "https://dojing.net", "id", isNsfw = true, className = "DojingNet"),
SingleLang("DuniaKomik.id", "https://duniakomik.org", "id", className = "DuniaKomikId", overrideVersionCode = 2),