Rip MangaKisa (#4142)
This commit is contained in:
parent
00d983c839
commit
0fbdfa6a14
|
@ -1,12 +0,0 @@
|
||||||
apply plugin: 'com.android.application'
|
|
||||||
apply plugin: 'kotlin-android'
|
|
||||||
|
|
||||||
ext {
|
|
||||||
extName = 'MangaKisa'
|
|
||||||
pkgNameSuffix = 'en.mangakisa'
|
|
||||||
extClass = '.MangaKisa'
|
|
||||||
extVersionCode = 3
|
|
||||||
libVersion = '1.2'
|
|
||||||
}
|
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
|
Binary file not shown.
Before Width: | Height: | Size: 3.7 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.0 KiB |
Binary file not shown.
Before Width: | Height: | Size: 4.7 KiB |
Binary file not shown.
Before Width: | Height: | Size: 9.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 12 KiB |
Binary file not shown.
Before Width: | Height: | Size: 51 KiB |
|
@ -1,265 +0,0 @@
|
||||||
package eu.kanade.tachiyomi.extension.en.mangakisa
|
|
||||||
|
|
||||||
import android.app.Application
|
|
||||||
import android.content.SharedPreferences
|
|
||||||
import android.net.Uri
|
|
||||||
import android.support.v7.preference.ListPreference
|
|
||||||
import android.support.v7.preference.PreferenceScreen
|
|
||||||
import eu.kanade.tachiyomi.network.GET
|
|
||||||
import eu.kanade.tachiyomi.source.ConfigurableSource
|
|
||||||
import eu.kanade.tachiyomi.source.model.Filter
|
|
||||||
import eu.kanade.tachiyomi.source.model.FilterList
|
|
||||||
import eu.kanade.tachiyomi.source.model.Page
|
|
||||||
import eu.kanade.tachiyomi.source.model.SChapter
|
|
||||||
import eu.kanade.tachiyomi.source.model.SManga
|
|
||||||
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
|
||||||
import java.util.concurrent.TimeUnit
|
|
||||||
import okhttp3.OkHttpClient
|
|
||||||
import okhttp3.Request
|
|
||||||
import org.jsoup.nodes.Document
|
|
||||||
import org.jsoup.nodes.Element
|
|
||||||
import uy.kohesive.injekt.Injekt
|
|
||||||
import uy.kohesive.injekt.api.get
|
|
||||||
|
|
||||||
class MangaKisa : ConfigurableSource, ParsedHttpSource() {
|
|
||||||
|
|
||||||
override val name = "MangaKisa"
|
|
||||||
override val baseUrl = "https://mangakisa.com"
|
|
||||||
override val lang = "en"
|
|
||||||
override val supportsLatest = true
|
|
||||||
override val client: OkHttpClient = network.cloudflareClient.newBuilder()
|
|
||||||
.connectTimeout(1, TimeUnit.MINUTES)
|
|
||||||
.readTimeout(1, TimeUnit.MINUTES)
|
|
||||||
.retryOnConnectionFailure(true)
|
|
||||||
.followRedirects(true)
|
|
||||||
.build()!!
|
|
||||||
|
|
||||||
private val preferences: SharedPreferences by lazy {
|
|
||||||
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun popularMangaSelector() = "div.listanimes a.an"
|
|
||||||
override fun latestUpdatesSelector() = ".episode-box-2"
|
|
||||||
override fun searchMangaSelector() = "div.iepbox a.an"
|
|
||||||
override fun chapterListSelector() = ".infoepbox > a"
|
|
||||||
|
|
||||||
override fun popularMangaNextPageSelector() = "div:containsOwn(Next Page >)"
|
|
||||||
override fun latestUpdatesNextPageSelector() = popularMangaNextPageSelector()
|
|
||||||
override fun searchMangaNextPageSelector() = popularMangaNextPageSelector()
|
|
||||||
|
|
||||||
override fun popularMangaRequest(page: Int): Request {
|
|
||||||
val page0 = page - 1
|
|
||||||
val popselect = getpoppref()
|
|
||||||
return GET("$baseUrl/$popselect/$page0", headers)
|
|
||||||
}
|
|
||||||
override fun latestUpdatesRequest(page: Int): Request {
|
|
||||||
val page0 = page - 1
|
|
||||||
val latestselect = getlastestpref()
|
|
||||||
return GET("$baseUrl/$latestselect/$page0", headers)
|
|
||||||
}
|
|
||||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
|
||||||
val page0 = page - 1
|
|
||||||
val uri = if (query.isNotBlank()) {
|
|
||||||
Uri.parse("$baseUrl/search?q=$query").buildUpon()
|
|
||||||
} else {
|
|
||||||
val uri = Uri.parse("$baseUrl/").buildUpon()
|
|
||||||
// Append uri filters
|
|
||||||
filters.forEach {
|
|
||||||
if (it is UriFilter)
|
|
||||||
it.addToUri(uri)
|
|
||||||
}
|
|
||||||
uri.appendPath("$page0")
|
|
||||||
}
|
|
||||||
return GET(uri.toString(), headers)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun popularMangaFromElement(element: Element) = mangaFromElement(element)
|
|
||||||
override fun latestUpdatesFromElement(element: Element) = mangaFromElement(element)
|
|
||||||
override fun searchMangaFromElement(element: Element) = mangaFromElement(element)
|
|
||||||
private fun mangaFromElement(element: Element): SManga {
|
|
||||||
val manga = SManga.create()
|
|
||||||
manga.setUrlWithoutDomain(element.select(".an").first().attr("href"))
|
|
||||||
manga.title = element.select("img").attr("alt").trim()
|
|
||||||
manga.thumbnail_url = baseUrl + element.select("img").attr("src")
|
|
||||||
return manga
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun chapterFromElement(element: Element): SChapter {
|
|
||||||
return SChapter.create().apply {
|
|
||||||
setUrlWithoutDomain(element.attr("abs:href"))
|
|
||||||
name = element.text()
|
|
||||||
date_upload = "${element.select("time").attr("time")}000".toLongOrNull() ?: 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun mangaDetailsParse(document: Document): SManga {
|
|
||||||
val manga = SManga.create()
|
|
||||||
manga.title = document.select(".infopicbox > img").attr("alt").trim()
|
|
||||||
manga.artist = document.select(".textc > a[href*=authors]").text().trim()
|
|
||||||
manga.author = document.select(".textc > a[href*=authors]").text().trim()
|
|
||||||
manga.description = document.select(".infodes2").first().text()
|
|
||||||
manga.genre = document.select("a.infoan[href*=genres]").joinToString(", ") { it.text() }
|
|
||||||
manga.status = when (document.select(".textc:contains(Ongoing), .textc:contains(Completed)")?.first()?.text()) {
|
|
||||||
"Ongoing" -> SManga.ONGOING
|
|
||||||
"Completed" -> SManga.COMPLETED
|
|
||||||
else -> SManga.UNKNOWN
|
|
||||||
}
|
|
||||||
manga.thumbnail_url = document.select(".infopicbox > img").attr("abs:src")
|
|
||||||
return manga
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun pageListParse(document: Document): List<Page> {
|
|
||||||
return document.select("div.vertical_div > div img").mapIndexed { i, img ->
|
|
||||||
Page(i, "", img.attr("abs:src"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun imageUrlParse(document: Document) = throw Exception("Not used")
|
|
||||||
|
|
||||||
// Filter List Code
|
|
||||||
override fun getFilterList() = FilterList(
|
|
||||||
Filter.Header("NOTE: Ignored if using text search!"),
|
|
||||||
Filter.Separator(),
|
|
||||||
GenreFilter()
|
|
||||||
)
|
|
||||||
|
|
||||||
private open class UriSelectFilter(
|
|
||||||
displayName: String,
|
|
||||||
val uriParam: String,
|
|
||||||
val vals: Array<Pair<String, String>>,
|
|
||||||
val firstIsUnspecified: Boolean = true,
|
|
||||||
defaultValue: Int = 0
|
|
||||||
) :
|
|
||||||
Filter.Select<String>(displayName, vals.map { it.second }.toTypedArray(), defaultValue), UriFilter {
|
|
||||||
override fun addToUri(uri: Uri.Builder) {
|
|
||||||
if (state != 0 || !firstIsUnspecified)
|
|
||||||
uri.appendPath(uriParam)
|
|
||||||
.appendPath(vals[state].first)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private interface UriFilter {
|
|
||||||
fun addToUri(uri: Uri.Builder)
|
|
||||||
}
|
|
||||||
|
|
||||||
private class GenreFilter : UriSelectFilter("Genre", "genres", arrayOf(
|
|
||||||
Pair("all", "ALL"),
|
|
||||||
Pair("action", "Action "),
|
|
||||||
Pair("adult", "Adult "),
|
|
||||||
Pair("adventure", "Adventure "),
|
|
||||||
Pair("comedy", "Comedy "),
|
|
||||||
Pair("cooking", "Cooking "),
|
|
||||||
Pair("doujinshi", "Doujinshi "),
|
|
||||||
Pair("drama", "Drama "),
|
|
||||||
Pair("ecchi", "Ecchi "),
|
|
||||||
Pair("fantasy", "Fantasy "),
|
|
||||||
Pair("gender-bender", "Gender Bender "),
|
|
||||||
Pair("harem", "Harem "),
|
|
||||||
Pair("historical", "Historical "),
|
|
||||||
Pair("horror", "Horror "),
|
|
||||||
Pair("isekai", "Isekai "),
|
|
||||||
Pair("josei", "Josei "),
|
|
||||||
Pair("manhua", "Manhua "),
|
|
||||||
Pair("manhwa", "Manhwa "),
|
|
||||||
Pair("martial-arts", "Martial Arts "),
|
|
||||||
Pair("mature", "Mature "),
|
|
||||||
Pair("mecha", "Mecha "),
|
|
||||||
Pair("medical", "Medical "),
|
|
||||||
Pair("mystery", "Mystery "),
|
|
||||||
Pair("one-shot", "One Shot "),
|
|
||||||
Pair("psychological", "Psychological "),
|
|
||||||
Pair("romance", "Romance "),
|
|
||||||
Pair("school-life", "School Life "),
|
|
||||||
Pair("sci-fi", "Sci Fi "),
|
|
||||||
Pair("seinen", "Seinen "),
|
|
||||||
Pair("shoujo", "Shoujo "),
|
|
||||||
Pair("shoujo-ai", "Shoujo Ai "),
|
|
||||||
Pair("shounen", "Shounen "),
|
|
||||||
Pair("shounen-ai", "Shounen Ai "),
|
|
||||||
Pair("slice-of-life", "Slice Of Life "),
|
|
||||||
Pair("smut", "Smut "),
|
|
||||||
Pair("sports", "Sports "),
|
|
||||||
Pair("supernatural", "Supernatural "),
|
|
||||||
Pair("tragedy", "Tragedy "),
|
|
||||||
Pair("webtoons", "Webtoons "),
|
|
||||||
Pair("yaoi", "Yaoi "),
|
|
||||||
Pair("yuri", "Yuri ")
|
|
||||||
))
|
|
||||||
|
|
||||||
// Preferences Code
|
|
||||||
override fun setupPreferenceScreen(screen: androidx.preference.PreferenceScreen) {
|
|
||||||
val popularmangapref = androidx.preference.ListPreference(screen.context).apply {
|
|
||||||
key = BROWSE_PREF_Title
|
|
||||||
title = BROWSE_PREF_Title
|
|
||||||
entries = arrayOf("Weekly", "All Time")
|
|
||||||
entryValues = arrayOf("popular", "popular-alltime")
|
|
||||||
summary = "%s"
|
|
||||||
|
|
||||||
setOnPreferenceChangeListener { _, newValue ->
|
|
||||||
val selected = newValue as String
|
|
||||||
val index = this.findIndexOfValue(selected)
|
|
||||||
val entry = entryValues[index] as String
|
|
||||||
preferences.edit().putString(BROWSE_PREF, entry).commit()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val latestmangapref = androidx.preference.ListPreference(screen.context).apply {
|
|
||||||
key = LATEST_PREF_Title
|
|
||||||
title = LATEST_PREF_Title
|
|
||||||
entries = arrayOf("Popular Updates", "All Updates")
|
|
||||||
entryValues = arrayOf("latest", "all-updates/latest")
|
|
||||||
summary = "%s"
|
|
||||||
|
|
||||||
setOnPreferenceChangeListener { _, newValue ->
|
|
||||||
val selected = newValue as String
|
|
||||||
val index = this.findIndexOfValue(selected)
|
|
||||||
val entry = entryValues[index] as String
|
|
||||||
preferences.edit().putString(LATEST_PREF, entry).commit()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
screen.addPreference(popularmangapref)
|
|
||||||
screen.addPreference(latestmangapref)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
|
||||||
val popularmangapref = ListPreference(screen.context).apply {
|
|
||||||
key = BROWSE_PREF_Title
|
|
||||||
title = BROWSE_PREF_Title
|
|
||||||
entries = arrayOf("Weekly", "All Time")
|
|
||||||
entryValues = arrayOf("popular", "popular-alltime")
|
|
||||||
summary = "%s"
|
|
||||||
|
|
||||||
setOnPreferenceChangeListener { _, newValue ->
|
|
||||||
val selected = newValue as String
|
|
||||||
val index = this.findIndexOfValue(selected)
|
|
||||||
val entry = entryValues[index] as String
|
|
||||||
preferences.edit().putString(BROWSE_PREF, entry).commit()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val latestmangapref = ListPreference(screen.context).apply {
|
|
||||||
key = LATEST_PREF_Title
|
|
||||||
title = LATEST_PREF_Title
|
|
||||||
entries = arrayOf("Popular Updates", "All Updates")
|
|
||||||
entryValues = arrayOf("latest", "all-updates/latest")
|
|
||||||
summary = "%s"
|
|
||||||
|
|
||||||
setOnPreferenceChangeListener { _, newValue ->
|
|
||||||
val selected = newValue as String
|
|
||||||
val index = this.findIndexOfValue(selected)
|
|
||||||
val entry = entryValues[index] as String
|
|
||||||
preferences.edit().putString(LATEST_PREF, entry).commit()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
screen.addPreference(popularmangapref)
|
|
||||||
screen.addPreference(latestmangapref)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getpoppref() = preferences.getString(BROWSE_PREF, "popular")
|
|
||||||
private fun getlastestpref() = preferences.getString(LATEST_PREF, "latest")
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private const val LATEST_PREF_Title = "Latest Manga Selector"
|
|
||||||
private const val LATEST_PREF = "latestmangaurl"
|
|
||||||
private const val BROWSE_PREF_Title = "Popular Manga Selector"
|
|
||||||
private const val BROWSE_PREF = "popularmangaurl"
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue