Add creepyscans (#19417)

This commit is contained in:
Secozzi 2023-12-24 23:46:23 +00:00 committed by GitHub
parent 95a548eb68
commit 3feb098f69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 137 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -0,0 +1,136 @@
package eu.kanade.tachiyomi.extension.en.creepyscans
import eu.kanade.tachiyomi.multisrc.madara.Madara
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 eu.kanade.tachiyomi.source.model.SChapter
import okhttp3.CacheControl
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.OkHttpClient
import okhttp3.Request
import org.jsoup.nodes.Document
import java.util.concurrent.TimeUnit
class CreepyScans : Madara(
"CreepyScans",
"https://creepyscans.com",
"en",
) {
override val client: OkHttpClient = super.client.newBuilder()
.rateLimit(1, 3, TimeUnit.SECONDS)
.build()
override val useNewChapterEndpoint = true
// Popular
override fun popularMangaRequest(page: Int): Request {
return GET(
url = "$baseUrl/$mangaSubString/?m_orderby=views",
headers = headers,
cache = CacheControl.FORCE_NETWORK,
)
}
// Latest
override fun latestUpdatesRequest(page: Int): Request {
return GET(
url = "$baseUrl/$mangaSubString/?m_orderby=latest",
headers = headers,
cache = CacheControl.FORCE_NETWORK,
)
}
// Search
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
if (query.isNotBlank()) throw Exception("Search not available")
val url = "$baseUrl/$mangaSubString/".toHttpUrl().newBuilder()
filters.forEach { filter ->
when (filter) {
is OrderByFilter -> {
if (filter.state != 0) {
url.addQueryParameter("m_orderby", filter.toUriPart())
}
}
is GenreFilter -> {
val selected = filter.vals[filter.state].second
if (selected.isNotBlank()) {
url.removePathSegment(0)
url.addPathSegment("manga-genre")
url.addPathSegment(filter.vals[filter.state].second)
}
}
else -> {}
}
}
return GET(url.build(), headers)
}
override fun searchMangaSelector(): String =
super.searchMangaSelector() + ",div.page-content-listing div.page-item-detail"
override fun searchMangaNextPageSelector(): String? = null
// Filter
override fun genresRequest(): Request {
return GET("$baseUrl/$mangaSubString/?genres=", headers)
}
override fun parseGenres(document: Document): List<Genre> {
genresList = document.select(".list-unstyled li").mapNotNull { genre ->
genre.selectFirst("a[href]")?.let {
val slug = it.attr("href")
.split("/")
.last(String::isNotEmpty)
Pair(it.ownText().trim(), slug)
}
}
return emptyList()
}
// From manga18fx
private var genresList: List<Pair<String, String>> = emptyList()
class GenreFilter(val vals: List<Pair<String, String>>) :
Filter.Select<String>("Genre", vals.map { it.first }.toTypedArray())
override fun getFilterList(): FilterList {
val filters = buildList(4) {
add(
OrderByFilter(
title = orderByFilterTitle,
options = orderByFilterOptions.zip(orderByFilterOptionsValues),
state = 0,
),
)
add(Filter.Separator())
add(Filter.Header("Filters are ignored for text search!"))
if (genresList.isNotEmpty()) {
add(GenreFilter(listOf(Pair("<select>", "")) + genresList))
} else {
add(Filter.Header("Wait for mangas to load then tap Reset"))
}
}
return FilterList(filters)
}
// Page list
override fun pageListRequest(chapter: SChapter): Request {
if (chapter.url.startsWith("http")) {
return GET(chapter.url.substringBefore("?style=list"), headers)
}
return super.pageListRequest(chapter)
}
}

View File

@ -81,6 +81,7 @@ class MadaraGenerator : ThemeSourceGenerator {
SingleLang("Comicz.net v2", "https://v2.comiz.net", "all", isNsfw = true, className = "ComiczNetV2"),
SingleLang("Cookie Kiara", "https://18.kiara.cool", "en", isNsfw = true),
SingleLang("CopyPasteScan", "https://copypastescan.xyz", "es", overrideVersionCode = 1),
SingleLang("CreepyScans", "https://creepyscans.com", "en"),
SingleLang("DapRob", "https://daprob.com", "es"),
SingleLang("Dark Scans", "https://darkscans.com", "en", overrideVersionCode = 1),
SingleLang("Decadence Scans", "https://reader.decadencescans.com", "en", isNsfw = true, overrideVersionCode = 2),