diff --git a/lib-multisrc/mangathemesia/src/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesia.kt b/lib-multisrc/mangathemesia/src/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesia.kt index f30575bf4..7a7962d52 100644 --- a/lib-multisrc/mangathemesia/src/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesia.kt +++ b/lib-multisrc/mangathemesia/src/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesia.kt @@ -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? { + protected open fun parseGenres(document: Document): List? { return document.selectFirst("ul.genrez")?.select("li")?.map { li -> GenreData( li.selectFirst("label")!!.text(), diff --git a/src/en/kappabeast/build.gradle b/src/en/kappabeast/build.gradle new file mode 100644 index 000000000..d82622386 --- /dev/null +++ b/src/en/kappabeast/build.gradle @@ -0,0 +1,9 @@ +ext { + extName = 'Kappa Beast' + extClass = '.KappaBeast' + themePkg = 'mangathemesia' + baseUrl = 'https://kappabeast.com' + overrideVersionCode = 0 +} + +apply from: "$rootDir/common.gradle" diff --git a/src/en/kappabeast/res/mipmap-hdpi/ic_launcher.png b/src/en/kappabeast/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 000000000..5ae9ff19c Binary files /dev/null and b/src/en/kappabeast/res/mipmap-hdpi/ic_launcher.png differ diff --git a/src/en/kappabeast/res/mipmap-mdpi/ic_launcher.png b/src/en/kappabeast/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 000000000..7d5cb6236 Binary files /dev/null and b/src/en/kappabeast/res/mipmap-mdpi/ic_launcher.png differ diff --git a/src/en/kappabeast/res/mipmap-xhdpi/ic_launcher.png b/src/en/kappabeast/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 000000000..c0217e06c Binary files /dev/null and b/src/en/kappabeast/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/src/en/kappabeast/res/mipmap-xxhdpi/ic_launcher.png b/src/en/kappabeast/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..f1ad24177 Binary files /dev/null and b/src/en/kappabeast/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/src/en/kappabeast/res/mipmap-xxxhdpi/ic_launcher.png b/src/en/kappabeast/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 000000000..054d38bf3 Binary files /dev/null and b/src/en/kappabeast/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/src/en/kappabeast/src/eu/kanade/tachiyomi/extension/en/kappabeast/KappaBeast.kt b/src/en/kappabeast/src/eu/kanade/tachiyomi/extension/en/kappabeast/KappaBeast.kt new file mode 100644 index 000000000..8aec1e03d --- /dev/null +++ b/src/en/kappabeast/src/eu/kanade/tachiyomi/extension/en/kappabeast/KappaBeast.kt @@ -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 { + return document.select("li:has(input[id*='genre'])").map { li -> + GenreData( + li.selectFirst("label")!!.text(), + li.selectFirst("input[type=checkbox]")!!.attr("value"), + ) + } + } +} diff --git a/src/id/mangacan/src/eu/kanade/tachiyomi/extension/id/mangacan/MangaCan.kt b/src/id/mangacan/src/eu/kanade/tachiyomi/extension/id/mangacan/MangaCan.kt index 03aece8a2..81148a5b9 100644 --- a/src/id/mangacan/src/eu/kanade/tachiyomi/extension/id/mangacan/MangaCan.kt +++ b/src/id/mangacan/src/eu/kanade/tachiyomi/extension/id/mangacan/MangaCan.kt @@ -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> = 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 { 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>() - 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> { - return document.select(".textwidget.custom-html-widget a").map { element -> - element.text() to element.attr("href") - }.toTypedArray() + override fun parseGenres(document: Document): List { + return mutableListOf(GenreData("All", "")).apply { + this += document.select(".textwidget.custom-html-widget a").map { element -> + GenreData(element.text(), element.attr("href")) + } + } } private class GenreFilter(