mirror of
https://github.com/keiyoushi/extensions-source.git
synced 2024-11-22 02:12:42 +01:00
Add KappaBeast (#4666)
* Add KappaBeast * Fix Typo * Add 'open' to parseGenre and filter properties * Fix build
This commit is contained in:
parent
330508eaf5
commit
44cd304e66
@ -490,8 +490,8 @@ abstract class MangaThemesia(
|
||||
Pair(intl["order_by_filter_popular"], "popular"),
|
||||
)
|
||||
|
||||
protected val popularFilter by lazy { FilterList(OrderByFilter("", orderByFilterOptions, "popular")) }
|
||||
protected val latestFilter by lazy { FilterList(OrderByFilter("", orderByFilterOptions, "update")) }
|
||||
protected open val popularFilter by lazy { FilterList(OrderByFilter("", orderByFilterOptions, "popular")) }
|
||||
protected open val latestFilter by lazy { FilterList(OrderByFilter("", orderByFilterOptions, "update")) }
|
||||
|
||||
protected class ProjectFilter(
|
||||
name: String,
|
||||
@ -603,7 +603,7 @@ abstract class MangaThemesia(
|
||||
(!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 ->
|
||||
GenreData(
|
||||
li.selectFirst("label")!!.text(),
|
||||
|
9
src/en/kappabeast/build.gradle
Normal file
9
src/en/kappabeast/build.gradle
Normal file
@ -0,0 +1,9 @@
|
||||
ext {
|
||||
extName = 'Kappa Beast'
|
||||
extClass = '.KappaBeast'
|
||||
themePkg = 'mangathemesia'
|
||||
baseUrl = 'https://kappabeast.com'
|
||||
overrideVersionCode = 0
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
BIN
src/en/kappabeast/res/mipmap-hdpi/ic_launcher.png
Normal file
BIN
src/en/kappabeast/res/mipmap-hdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
BIN
src/en/kappabeast/res/mipmap-mdpi/ic_launcher.png
Normal file
BIN
src/en/kappabeast/res/mipmap-mdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
src/en/kappabeast/res/mipmap-xhdpi/ic_launcher.png
Normal file
BIN
src/en/kappabeast/res/mipmap-xhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
BIN
src/en/kappabeast/res/mipmap-xxhdpi/ic_launcher.png
Normal file
BIN
src/en/kappabeast/res/mipmap-xxhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.8 KiB |
BIN
src/en/kappabeast/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
BIN
src/en/kappabeast/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
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.Page
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.util.asJsoup
|
||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||
import okhttp3.Request
|
||||
import okhttp3.Response
|
||||
import org.jsoup.nodes.Document
|
||||
import rx.Observable
|
||||
|
||||
@ -31,8 +29,6 @@ class MangaCan : MangaThemesia(
|
||||
|
||||
override val pageSelector = "div.images img"
|
||||
|
||||
private var genreList: Array<Pair<String, String>> = emptyArray()
|
||||
|
||||
override fun imageRequest(page: Page): Request {
|
||||
return super.imageRequest(page).newBuilder()
|
||||
.removeHeader("Referer")
|
||||
@ -40,15 +36,6 @@ class MangaCan : MangaThemesia(
|
||||
.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> {
|
||||
if (query.startsWith(URL_SEARCH_PREFIX).not()) return super.fetchSearchManga(page, query, filters)
|
||||
val url = query.substringAfter(URL_SEARCH_PREFIX)
|
||||
@ -87,11 +74,11 @@ class MangaCan : MangaThemesia(
|
||||
|
||||
override fun getFilterList(): FilterList {
|
||||
val filters = mutableListOf<Filter<*>>()
|
||||
if (genreList.isNotEmpty()) {
|
||||
if (!genrelist.isNullOrEmpty()) {
|
||||
filters.addAll(
|
||||
listOf(
|
||||
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 {
|
||||
@ -102,10 +89,12 @@ class MangaCan : MangaThemesia(
|
||||
return FilterList(filters)
|
||||
}
|
||||
|
||||
private fun parseGenres(document: Document): Array<Pair<String, String>> {
|
||||
return document.select(".textwidget.custom-html-widget a").map { element ->
|
||||
element.text() to element.attr("href")
|
||||
}.toTypedArray()
|
||||
override fun parseGenres(document: Document): List<GenreData> {
|
||||
return mutableListOf(GenreData("All", "")).apply {
|
||||
this += document.select(".textwidget.custom-html-widget a").map { element ->
|
||||
GenreData(element.text(), element.attr("href"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class GenreFilter(
|
||||
|
Loading…
Reference in New Issue
Block a user