mirror of
https://github.com/recloudstream/cloudstream-extensions-multilingual.git
synced 2024-08-15 03:15:14 +00:00
Add anime providers
This commit is contained in:
parent
b74b8614db
commit
b3f33b368a
139 changed files with 9873 additions and 9 deletions
22
KuramanimeProvider/build.gradle.kts
Normal file
22
KuramanimeProvider/build.gradle.kts
Normal file
|
@ -0,0 +1,22 @@
|
|||
// use an integer for version numbers
|
||||
version = 1
|
||||
|
||||
|
||||
cloudstream {
|
||||
// All of these properties are optional, you can safely remove them
|
||||
|
||||
// description = "Lorem Ipsum"
|
||||
// authors = listOf("Cloudburst")
|
||||
|
||||
/**
|
||||
* Status int as the following:
|
||||
* 0: Down
|
||||
* 1: Ok
|
||||
* 2: Slow
|
||||
* 3: Beta only
|
||||
* */
|
||||
status = 1 // will be 3 if unspecified
|
||||
|
||||
// Set to true to get an 18+ symbol next to the plugin
|
||||
adult = false // will be false if unspecified
|
||||
}
|
2
KuramanimeProvider/src/main/AndroidManifest.xml
Normal file
2
KuramanimeProvider/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="com.lagradost"/>
|
|
@ -0,0 +1,176 @@
|
|||
package com.lagradost
|
||||
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.mvvm.suspendSafeApiCall
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import org.jsoup.Jsoup
|
||||
import org.jsoup.nodes.Element
|
||||
|
||||
class KuramanimeProvider : MainAPI() {
|
||||
override var mainUrl = "https://kuramanime.com"
|
||||
override var name = "Kuramanime"
|
||||
override val hasQuickSearch = false
|
||||
override val hasMainPage = true
|
||||
override var lang = "id"
|
||||
override val hasDownloadSupport = true
|
||||
|
||||
override val supportedTypes = setOf(
|
||||
TvType.Anime,
|
||||
TvType.AnimeMovie,
|
||||
TvType.OVA
|
||||
)
|
||||
|
||||
companion object {
|
||||
fun getType(t: String): TvType {
|
||||
return if (t.contains("OVA") || t.contains("Special")) TvType.OVA
|
||||
else if (t.contains("Movie")) TvType.AnimeMovie
|
||||
else TvType.Anime
|
||||
}
|
||||
|
||||
fun getStatus(t: String): ShowStatus {
|
||||
return when (t) {
|
||||
"Selesai Tayang" -> ShowStatus.Completed
|
||||
"Sedang Tayang" -> ShowStatus.Ongoing
|
||||
else -> ShowStatus.Completed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override val mainPage = mainPageOf(
|
||||
"$mainUrl/anime/ongoing?order_by=updated&page=" to "Sedang Tayang",
|
||||
"$mainUrl/anime/finished?order_by=updated&page=" to "Selesai Tayang",
|
||||
"$mainUrl/properties/season/summer-2022?order_by=most_viewed&page=" to "Dilihat Terbanyak Musim Ini",
|
||||
"$mainUrl/anime/movie?order_by=updated&page=" to "Film Layar Lebar",
|
||||
)
|
||||
|
||||
override suspend fun getMainPage(
|
||||
page: Int,
|
||||
request: MainPageRequest
|
||||
): HomePageResponse {
|
||||
val document = app.get(request.data + page).document
|
||||
|
||||
val home = document.select("div.col-lg-4.col-md-6.col-sm-6").mapNotNull {
|
||||
it.toSearchResult()
|
||||
}
|
||||
|
||||
return newHomePageResponse(request.name, home)
|
||||
}
|
||||
|
||||
private fun getProperAnimeLink(uri: String): String {
|
||||
return if (uri.contains("/episode")) {
|
||||
Regex("(.*)/episode/.+").find(uri)?.groupValues?.get(1).toString() + "/"
|
||||
} else {
|
||||
uri
|
||||
}
|
||||
}
|
||||
|
||||
private fun Element.toSearchResult(): AnimeSearchResponse? {
|
||||
val href = getProperAnimeLink(fixUrl(this.selectFirst("a")!!.attr("href")))
|
||||
val title = this.selectFirst("h5 a")?.text() ?: return null
|
||||
val posterUrl = fixUrl(this.select("div.product__item__pic.set-bg").attr("data-setbg"))
|
||||
val episode = Regex("([0-9*])\\s?/").find(
|
||||
this.select("div.ep span").text()
|
||||
)?.groupValues?.getOrNull(1)?.toIntOrNull()
|
||||
|
||||
return newAnimeSearchResponse(title, href, TvType.Anime) {
|
||||
this.posterUrl = posterUrl
|
||||
addSub(episode)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override suspend fun search(query: String): List<SearchResponse> {
|
||||
val link = "$mainUrl/anime?search=$query&order_by=oldest"
|
||||
val document = app.get(link).document
|
||||
|
||||
return document.select(".product__item").mapNotNull {
|
||||
val title = it.selectFirst("div.product__item__text > h5")!!.text().trim()
|
||||
val poster = it.selectFirst("a > div")!!.attr("data-setbg")
|
||||
val tvType =
|
||||
getType(it.selectFirst(".product__item__text > ul > li")!!.text().toString())
|
||||
val href = fixUrl(it.selectFirst("a")!!.attr("href"))
|
||||
|
||||
newAnimeSearchResponse(title, href, tvType) {
|
||||
this.posterUrl = poster
|
||||
addDubStatus(dubExist = false, subExist = true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun load(url: String): LoadResponse {
|
||||
val document = app.get(url).document
|
||||
|
||||
val title = document.selectFirst(".anime__details__title > h3")!!.text().trim()
|
||||
val poster = document.selectFirst(".anime__details__pic")?.attr("data-setbg")
|
||||
val tags =
|
||||
document.select("div.anime__details__widget > div > div:nth-child(2) > ul > li:nth-child(1)")
|
||||
.text().trim().replace("Genre: ", "").split(", ")
|
||||
|
||||
val year = Regex("[^0-9]").replace(
|
||||
document.select("div.anime__details__widget > div > div:nth-child(1) > ul > li:nth-child(5)")
|
||||
.text().trim().replace("Musim: ", ""), ""
|
||||
).toIntOrNull()
|
||||
val status = getStatus(
|
||||
document.select("div.anime__details__widget > div > div:nth-child(1) > ul > li:nth-child(3)")
|
||||
.text().trim().replace("Status: ", "")
|
||||
)
|
||||
val description = document.select(".anime__details__text > p").text().trim()
|
||||
|
||||
val episodes =
|
||||
Jsoup.parse(document.select("#episodeLists").attr("data-content")).select("a").map {
|
||||
val name = it.text().trim()
|
||||
val link = it.attr("href")
|
||||
Episode(link, name)
|
||||
}
|
||||
|
||||
val recommendations = document.select("div#randomList > a").mapNotNull {
|
||||
val epHref = it.attr("href")
|
||||
val epTitle = it.select("h5.sidebar-title-h5.px-2.py-2").text()
|
||||
val epPoster = it.select(".product__sidebar__view__item.set-bg").attr("data-setbg")
|
||||
|
||||
newAnimeSearchResponse(epTitle, epHref, TvType.Anime) {
|
||||
this.posterUrl = epPoster
|
||||
addDubStatus(dubExist = false, subExist = true)
|
||||
}
|
||||
}
|
||||
|
||||
return newAnimeLoadResponse(title, url, TvType.Anime) {
|
||||
engName = title
|
||||
posterUrl = poster
|
||||
this.year = year
|
||||
addEpisodes(DubStatus.Subbed, episodes)
|
||||
showStatus = status
|
||||
plot = description
|
||||
this.tags = tags
|
||||
this.recommendations = recommendations
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override suspend fun loadLinks(
|
||||
data: String,
|
||||
isCasting: Boolean,
|
||||
subtitleCallback: (SubtitleFile) -> Unit,
|
||||
callback: (ExtractorLink) -> Unit
|
||||
): Boolean {
|
||||
val servers = app.get(data).document
|
||||
servers.select("video#player > source").map {
|
||||
suspendSafeApiCall {
|
||||
val url = it.attr("src")
|
||||
val quality = it.attr("size").toInt()
|
||||
callback.invoke(
|
||||
ExtractorLink(
|
||||
name,
|
||||
name,
|
||||
url,
|
||||
referer = "$mainUrl/",
|
||||
quality = quality
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
package com.lagradost
|
||||
|
||||
import com.lagradost.cloudstream3.plugins.CloudstreamPlugin
|
||||
import com.lagradost.cloudstream3.plugins.Plugin
|
||||
import android.content.Context
|
||||
|
||||
@CloudstreamPlugin
|
||||
class KuramanimeProviderPlugin: Plugin() {
|
||||
override fun load(context: Context) {
|
||||
// All providers should be added in this manner. Please don't edit the providers list directly.
|
||||
registerMainAPI(KuramanimeProvider())
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue