Add KappaBeast (#4666)
* Add KappaBeast * Fix Typo * Add 'open' to parseGenre and filter properties * Fix build
This commit is contained in:
parent
f8de9ce1ea
commit
b0b1e0d5cd
|
@ -490,8 +490,8 @@ abstract class MangaThemesia(
|
||||||
Pair(intl["order_by_filter_popular"], "popular"),
|
Pair(intl["order_by_filter_popular"], "popular"),
|
||||||
)
|
)
|
||||||
|
|
||||||
protected val popularFilter by lazy { FilterList(OrderByFilter("", orderByFilterOptions, "popular")) }
|
protected open val popularFilter by lazy { FilterList(OrderByFilter("", orderByFilterOptions, "popular")) }
|
||||||
protected val latestFilter by lazy { FilterList(OrderByFilter("", orderByFilterOptions, "update")) }
|
protected open val latestFilter by lazy { FilterList(OrderByFilter("", orderByFilterOptions, "update")) }
|
||||||
|
|
||||||
protected class ProjectFilter(
|
protected class ProjectFilter(
|
||||||
name: String,
|
name: String,
|
||||||
|
@ -603,7 +603,7 @@ abstract class MangaThemesia(
|
||||||
(!strict && url.pathSegments.size == n + 1 && url.pathSegments[n].isEmpty())
|
(!strict && url.pathSegments.size == n + 1 && url.pathSegments[n].isEmpty())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun parseGenres(document: Document): List<GenreData>? {
|
protected open fun parseGenres(document: Document): List<GenreData>? {
|
||||||
return document.selectFirst("ul.genrez")?.select("li")?.map { li ->
|
return document.selectFirst("ul.genrez")?.select("li")?.map { li ->
|
||||||
GenreData(
|
GenreData(
|
||||||
li.selectFirst("label")!!.text(),
|
li.selectFirst("label")!!.text(),
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
ext {
|
||||||
|
extName = 'Kappa Beast'
|
||||||
|
extClass = '.KappaBeast'
|
||||||
|
themePkg = 'mangathemesia'
|
||||||
|
baseUrl = 'https://kappabeast.com'
|
||||||
|
overrideVersionCode = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
apply from: "$rootDir/common.gradle"
|
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.8 KiB |
Binary file not shown.
After Width: | Height: | Size: 6.8 KiB |
|
@ -0,0 +1,46 @@
|
||||||
|
package eu.kanade.tachiyomi.extension.en.kappabeast
|
||||||
|
|
||||||
|
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia
|
||||||
|
import eu.kanade.tachiyomi.network.interceptor.rateLimit
|
||||||
|
import eu.kanade.tachiyomi.source.model.FilterList
|
||||||
|
import org.jsoup.nodes.Document
|
||||||
|
|
||||||
|
class KappaBeast : MangaThemesia(
|
||||||
|
"Kappa Beast",
|
||||||
|
"https://kappabeast.com",
|
||||||
|
"en",
|
||||||
|
mangaUrlDirectory = "/series",
|
||||||
|
) {
|
||||||
|
override val client = super.client.newBuilder()
|
||||||
|
.rateLimit(3)
|
||||||
|
.build()
|
||||||
|
|
||||||
|
override val typeFilterOptions = arrayOf(
|
||||||
|
Pair(intl["type_filter_option_manga"], "manga"),
|
||||||
|
)
|
||||||
|
|
||||||
|
override val popularFilter = FilterList(
|
||||||
|
OrderByFilter("", orderByFilterOptions, "popular"),
|
||||||
|
TypeFilter("", typeFilterOptions),
|
||||||
|
)
|
||||||
|
|
||||||
|
override val latestFilter = FilterList(
|
||||||
|
OrderByFilter("", orderByFilterOptions, "update"),
|
||||||
|
TypeFilter("", typeFilterOptions),
|
||||||
|
)
|
||||||
|
|
||||||
|
override fun searchMangaSelector() = ".listupd .maindet"
|
||||||
|
|
||||||
|
override val seriesThumbnailSelector = ".sertothumb .ts-post-image"
|
||||||
|
|
||||||
|
override val pageSelector = ".epcontent.entry-content img"
|
||||||
|
|
||||||
|
override fun parseGenres(document: Document): List<GenreData> {
|
||||||
|
return document.select("li:has(input[id*='genre'])").map { li ->
|
||||||
|
GenreData(
|
||||||
|
li.selectFirst("label")!!.text(),
|
||||||
|
li.selectFirst("input[type=checkbox]")!!.attr("value"),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,10 +8,8 @@ import eu.kanade.tachiyomi.source.model.FilterList
|
||||||
import eu.kanade.tachiyomi.source.model.MangasPage
|
import eu.kanade.tachiyomi.source.model.MangasPage
|
||||||
import eu.kanade.tachiyomi.source.model.Page
|
import eu.kanade.tachiyomi.source.model.Page
|
||||||
import eu.kanade.tachiyomi.source.model.SManga
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
import eu.kanade.tachiyomi.util.asJsoup
|
|
||||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Response
|
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
|
|
||||||
|
@ -31,8 +29,6 @@ class MangaCan : MangaThemesia(
|
||||||
|
|
||||||
override val pageSelector = "div.images img"
|
override val pageSelector = "div.images img"
|
||||||
|
|
||||||
private var genreList: Array<Pair<String, String>> = emptyArray()
|
|
||||||
|
|
||||||
override fun imageRequest(page: Page): Request {
|
override fun imageRequest(page: Page): Request {
|
||||||
return super.imageRequest(page).newBuilder()
|
return super.imageRequest(page).newBuilder()
|
||||||
.removeHeader("Referer")
|
.removeHeader("Referer")
|
||||||
|
@ -40,15 +36,6 @@ class MangaCan : MangaThemesia(
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun searchMangaParse(response: Response): MangasPage {
|
|
||||||
if (genreList.isEmpty()) {
|
|
||||||
genreList += "All" to ""
|
|
||||||
genreList += parseGenres(response.asJsoup(response.peekBody(Long.MAX_VALUE).string()))
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.searchMangaParse(response)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
|
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
|
||||||
if (query.startsWith(URL_SEARCH_PREFIX).not()) return super.fetchSearchManga(page, query, filters)
|
if (query.startsWith(URL_SEARCH_PREFIX).not()) return super.fetchSearchManga(page, query, filters)
|
||||||
val url = query.substringAfter(URL_SEARCH_PREFIX)
|
val url = query.substringAfter(URL_SEARCH_PREFIX)
|
||||||
|
@ -87,11 +74,11 @@ class MangaCan : MangaThemesia(
|
||||||
|
|
||||||
override fun getFilterList(): FilterList {
|
override fun getFilterList(): FilterList {
|
||||||
val filters = mutableListOf<Filter<*>>()
|
val filters = mutableListOf<Filter<*>>()
|
||||||
if (genreList.isNotEmpty()) {
|
if (!genrelist.isNullOrEmpty()) {
|
||||||
filters.addAll(
|
filters.addAll(
|
||||||
listOf(
|
listOf(
|
||||||
Filter.Header(intl["genre_exclusion_warning"]),
|
Filter.Header(intl["genre_exclusion_warning"]),
|
||||||
GenreFilter(intl["genre_filter_title"], genreList),
|
GenreFilter(intl["genre_filter_title"], genrelist?.map { it.name to it.value }!!.toTypedArray()),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
@ -102,10 +89,12 @@ class MangaCan : MangaThemesia(
|
||||||
return FilterList(filters)
|
return FilterList(filters)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun parseGenres(document: Document): Array<Pair<String, String>> {
|
override fun parseGenres(document: Document): List<GenreData> {
|
||||||
return document.select(".textwidget.custom-html-widget a").map { element ->
|
return mutableListOf(GenreData("All", "")).apply {
|
||||||
element.text() to element.attr("href")
|
this += document.select(".textwidget.custom-html-widget a").map { element ->
|
||||||
}.toTypedArray()
|
GenreData(element.text(), element.attr("href"))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class GenreFilter(
|
private class GenreFilter(
|
||||||
|
|
Loading…
Reference in New Issue