diff --git a/AnimeIndoProvider/build.gradle.kts b/AnimeIndoProvider/build.gradle.kts new file mode 100644 index 00000000..22c29da9 --- /dev/null +++ b/AnimeIndoProvider/build.gradle.kts @@ -0,0 +1,27 @@ +// use an integer for version numbers +version = 1 + + +cloudstream { + language = "id" + // All of these properties are optional, you can safely remove them + + // description = "Lorem Ipsum" + authors = listOf("Hexated") + + /** + * Status int as the following: + * 0: Down + * 1: Ok + * 2: Slow + * 3: Beta only + * */ + status = 1 // will be 3 if unspecified + tvTypes = listOf( + "AnimeMovie", + "OVA", + "Anime", + ) + + iconUrl = "https://www.google.com/s2/favicons?domain=animeindo.sbs&sz=%size%" +} \ No newline at end of file diff --git a/AnimeIndoProvider/src/main/AndroidManifest.xml b/AnimeIndoProvider/src/main/AndroidManifest.xml new file mode 100644 index 00000000..874740e3 --- /dev/null +++ b/AnimeIndoProvider/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/AnimeIndoProvider/src/main/kotlin/com/hexated/AnimeIndoProvider.kt b/AnimeIndoProvider/src/main/kotlin/com/hexated/AnimeIndoProvider.kt new file mode 100644 index 00000000..6957da14 --- /dev/null +++ b/AnimeIndoProvider/src/main/kotlin/com/hexated/AnimeIndoProvider.kt @@ -0,0 +1,192 @@ +package com.hexated + +import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.APIHolder.getCaptchaToken +import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.loadExtractor +import com.lagradost.nicehttp.NiceResponse +import org.jsoup.Jsoup +import org.jsoup.nodes.Element + +class AnimeIndoProvider : MainAPI() { + override var mainUrl = "https://animeindo.sbs" + override var name = "AnimeIndo" + 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) { + "Finished Airing" -> ShowStatus.Completed + "Currently Airing" -> ShowStatus.Ongoing + else -> ShowStatus.Completed + } + } + + private suspend fun request(url: String): NiceResponse { + val req = app.get( + url, + cookies = mapOf("recaptcha_cookie" to "#Asia/Jakarta#-420#win32#Windows#0,false,false#Google Inc. (Intel)~ANGLE (Intel, Intel(R) HD Graphics 400 Direct3D11 vs_5_0 ps_5_0)") + ) + if (req.isSuccessful) { + return req + } else { + val document = app.get(url).document + val captchaKey = + document.select("script[src*=https://www.google.com/recaptcha/api.js?render=]") + .attr("src").substringAfter("render=").substringBefore("&") + val token = getCaptchaToken(url, captchaKey) + return app.post( + url, + data = mapOf( + "action" to "recaptcha_for_all", + "token" to "$token", + "sitekey" to captchaKey + ) + ) + } + } + } + + override val mainPage = mainPageOf( + "$mainUrl/anime-terbaru/page/" to "Anime Terbaru", + "$mainUrl/donghua-terbaru/page/" to "Donghua Terbaru" + ) + + override suspend fun getMainPage( + page: Int, + request: MainPageRequest + ): HomePageResponse { + val document = request(request.data + page).document + val home = document.select("div.post-show > article").mapNotNull { + it.toSearchResult() + } + return newHomePageResponse(request.name, home) + } + + private fun getProperAnimeLink(uri: String): String { + return if (uri.contains("/anime/")) { + uri + } else { + var title = uri.substringAfter("$mainUrl/") + title = when { + (title.contains("-episode")) && !(title.contains("-movie")) -> Regex("(.+)-episode").find( + title + )?.groupValues?.get(1).toString() + (title.contains("-movie")) -> Regex("(.+)-movie").find(title)?.groupValues?.get( + 1 + ).toString() + else -> title + } + "$mainUrl/anime/$title" + } + } + + private fun Element.toSearchResult(): AnimeSearchResponse? { + val title = this.selectFirst("div.title")?.text()?.trim() ?: return null + val href = getProperAnimeLink(this.selectFirst("a")!!.attr("href")) + val posterUrl = this.select("img[itemprop=image]").attr("src").toString() + val type = getType(this.select("div.type").text().trim()) + val epNum = + this.selectFirst("span.episode")?.ownText()?.replace(Regex("[^0-9]"), "")?.trim() + ?.toIntOrNull() + return newAnimeSearchResponse(title, href, type) { + this.posterUrl = posterUrl + addSub(epNum) + } + + } + + override suspend fun search(query: String): List { + val link = "$mainUrl/?s=$query" + val document = request(link).document + + return document.select(".site-main.relat > article").map { + val title = it.selectFirst("div.title > h2")!!.ownText().trim() + val href = it.selectFirst("a")!!.attr("href") + val posterUrl = it.selectFirst("img")!!.attr("src").toString() + val type = getType(it.select("div.type").text().trim()) + newAnimeSearchResponse(title, href, type) { + this.posterUrl = posterUrl + } + } + } + + override suspend fun load(url: String): LoadResponse { + val document = request(url).document + + val title = document.selectFirst("h1.entry-title")?.text().toString().trim() + val poster = document.selectFirst("div.thumb > img[itemprop=image]")?.attr("src") + val tags = document.select("div.genxed > a").map { it.text() } + val type = getType( + document.selectFirst("div.info-content > div.spe > span:nth-child(6)")?.ownText() + .toString() + ) + val year = Regex("\\d, ([0-9]*)").find( + document.select("div.info-content > div.spe > span:nth-child(9) > time").text() + )?.groupValues?.get(1)?.toIntOrNull() + val status = getStatus( + document.selectFirst("div.info-content > div.spe > span:nth-child(1)")!!.ownText() + .trim() + ) + val description = document.select("div[itemprop=description] > p").text() + val trailer = document.selectFirst("div.player-embed iframe")?.attr("src") + val episodes = document.select("div.lstepsiode.listeps ul li").mapNotNull { + val header = it.selectFirst("span.lchx > a") ?: return@mapNotNull null + val name = header.text().trim() + val episode = header.text().trim().replace("Episode", "").trim().toIntOrNull() + val link = fixUrl(header.attr("href")) + Episode(link, name = name, episode = episode) + }.reversed() + + return newAnimeLoadResponse(title, url, type) { + engName = title + posterUrl = poster + this.year = year + addEpisodes(DubStatus.Subbed, episodes) + showStatus = status + plot = description + this.tags = tags + addTrailer(trailer) + } + } + + override suspend fun loadLinks( + data: String, + isCasting: Boolean, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ): Boolean { + + val document = request(data).document + document.select("div.itemleft > .mirror > option").mapNotNull { + fixUrl(Jsoup.parse(base64Decode(it.attr("value"))).select("iframe").attr("src")) + }.apmap { + if (it.startsWith("https://uservideo.xyz")) { + app.get(it, referer = "$mainUrl/").document.select("iframe").attr("src") + } else { + it + } + }.apmap { + loadExtractor(it, data, subtitleCallback, callback) + } + + return true + } + + +} \ No newline at end of file diff --git a/AnimeIndoProvider/src/main/kotlin/com/hexated/AnimeIndoProviderPlugin.kt b/AnimeIndoProvider/src/main/kotlin/com/hexated/AnimeIndoProviderPlugin.kt new file mode 100644 index 00000000..7f4d0a0d --- /dev/null +++ b/AnimeIndoProvider/src/main/kotlin/com/hexated/AnimeIndoProviderPlugin.kt @@ -0,0 +1,14 @@ + +package com.hexated + +import com.lagradost.cloudstream3.plugins.CloudstreamPlugin +import com.lagradost.cloudstream3.plugins.Plugin +import android.content.Context + +@CloudstreamPlugin +class AnimeIndoProviderPlugin: Plugin() { + override fun load(context: Context) { + // All providers should be added in this manner. Please don't edit the providers list directly. + registerMainAPI(AnimeIndoProvider()) + } +} \ No newline at end of file diff --git a/AnimeSailProvider/build.gradle.kts b/AnimeSailProvider/build.gradle.kts new file mode 100644 index 00000000..7fcac9c3 --- /dev/null +++ b/AnimeSailProvider/build.gradle.kts @@ -0,0 +1,27 @@ +// use an integer for version numbers +version = 2 + + +cloudstream { + language = "id" + // All of these properties are optional, you can safely remove them + + // description = "Lorem Ipsum" + authors = listOf("Hexated") + + /** + * Status int as the following: + * 0: Down + * 1: Ok + * 2: Slow + * 3: Beta only + * */ + status = 1 // will be 3 if unspecified + tvTypes = listOf( + "AnimeMovie", + "Anime", + "OVA", + ) + + iconUrl = "https://www.google.com/s2/favicons?domain=111.90.143.42&sz=%size%" +} \ No newline at end of file diff --git a/AnimeSailProvider/src/main/AndroidManifest.xml b/AnimeSailProvider/src/main/AndroidManifest.xml new file mode 100644 index 00000000..874740e3 --- /dev/null +++ b/AnimeSailProvider/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/AnimeSailProvider/src/main/kotlin/com/hexated/AnimeSailProvider.kt b/AnimeSailProvider/src/main/kotlin/com/hexated/AnimeSailProvider.kt new file mode 100644 index 00000000..fc0e11ca --- /dev/null +++ b/AnimeSailProvider/src/main/kotlin/com/hexated/AnimeSailProvider.kt @@ -0,0 +1,195 @@ +package com.hexated + +import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.mvvm.safeApiCall +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.Qualities +import com.lagradost.cloudstream3.utils.loadExtractor +import com.lagradost.nicehttp.NiceResponse +import org.jsoup.Jsoup +import org.jsoup.nodes.Element + +class AnimeSailProvider : MainAPI() { + override var mainUrl = "https://111.90.143.42" + override var name = "AnimeSail" + 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) { + "Completed" -> ShowStatus.Completed + "Ongoing" -> ShowStatus.Ongoing + else -> ShowStatus.Completed + } + } + } + + private suspend fun request(url: String, ref: String? = null): NiceResponse { + return app.get( + url, + headers = mapOf("Accept" to "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"), + cookies = mapOf("_as_ipin_ct" to "ID"), + referer = ref + ) + } + + override val mainPage = mainPageOf( + "$mainUrl/page/" to "Episode Terbaru", + "$mainUrl/movie-terbaru/page/" to "Movie Terbaru", + "$mainUrl/genres/donghua/page/" to "Donghua" + ) + + override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse { + val document = request(request.data + page).document + val home = document.select("article").map { + it.toSearchResult() + } + return newHomePageResponse(request.name, home) + } + + private fun getProperAnimeLink(uri: String): String { + return if (uri.contains("/anime/")) { + uri + } else { + var title = uri.substringAfter("$mainUrl/") + title = when { + (title.contains("-episode")) && !(title.contains("-movie")) -> title.substringBefore( + "-episode" + ) + (title.contains("-movie")) -> title.substringBefore("-movie") + else -> title + } + + "$mainUrl/anime/$title" + } + } + + private fun Element.toSearchResult(): AnimeSearchResponse { + val href = getProperAnimeLink(fixUrlNull(this.selectFirst("a")?.attr("href")).toString()) + val title = this.select(".tt > h2").text().trim() + val posterUrl = fixUrlNull(this.selectFirst("div.limit img")?.attr("src")) + val epNum = this.selectFirst(".tt > h2")?.text()?.let { + Regex("Episode\\s?([0-9]+)").find(it)?.groupValues?.getOrNull(1)?.toIntOrNull() + } + return newAnimeSearchResponse(title, href, TvType.Anime) { + this.posterUrl = posterUrl + addSub(epNum) + } + + } + + override suspend fun search(query: String): List { + val link = "$mainUrl/?s=$query" + val document = request(link).document + + return document.select("div.listupd article").map { + it.toSearchResult() + } + } + + override suspend fun load(url: String): LoadResponse { + val document = request(url).document + + val title = document.selectFirst("h1.entry-title")?.text().toString().trim() + val type = getType( + document.select("tbody th:contains(Tipe)").next().text() + ) + val episodes = document.select("ul.daftar > li").map { + val header = it.select("a").text().trim() + val name = + Regex("(Episode\\s?[0-9]+)").find(header)?.groupValues?.getOrNull(0) ?: header + val link = fixUrl(it.select("a").attr("href")) + Episode(link, name = name) + }.reversed() + + return newAnimeLoadResponse(title, url, type) { + posterUrl = document.selectFirst("div.entry-content > img")?.attr("src") + this.year = + document.select("tbody th:contains(Dirilis)").next().text().trim().toIntOrNull() + addEpisodes(DubStatus.Subbed, episodes) + showStatus = + getStatus(document.select("tbody th:contains(Status)").next().text().trim()) + plot = document.selectFirst("div.entry-content > p")?.text() + this.tags = + document.select("tbody th:contains(Genre)").next().select("a").map { it.text() } + } + } + + override suspend fun loadLinks( + data: String, + isCasting: Boolean, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ): Boolean { + + val document = request(data).document + + document.select(".mobius > .mirror > option").apmap { + safeApiCall { + val iframe = fixUrl( + Jsoup.parse(base64Decode(it.attr("data-em"))).select("iframe").attr("src") + ?: throw ErrorLoadingException("No iframe found") + ) + + when { + iframe.startsWith("$mainUrl/utils/player/arch/") || iframe.startsWith( + "$mainUrl/utils/player/race/" + ) -> request(iframe, ref = data).document.select("source").attr("src") + .let { link -> + val source = + when { + iframe.contains("/arch/") -> "Arch" + iframe.contains("/race/") -> "Race" + else -> this.name + } + val quality = + Regex("\\.([0-9]{3,4})\\.").find(link)?.groupValues?.get(1) + callback.invoke( + ExtractorLink( + source = source, + name = source, + url = link, + referer = mainUrl, + quality = quality?.toIntOrNull() ?: Qualities.Unknown.value + ) + ) + } +// skip for now +// iframe.startsWith("$mainUrl/utils/player/fichan/") -> "" +// iframe.startsWith("$mainUrl/utils/player/blogger/") -> "" + iframe.startsWith("https://aghanim.xyz/tools/redirect/") -> { + val link = "https://rasa-cintaku-semakin-berantai.xyz/v/${iframe.substringAfter("id=").substringBefore("&token")}" + loadExtractor(link, mainUrl, subtitleCallback, callback) + } + iframe.startsWith("$mainUrl/utils/player/framezilla/") || iframe.startsWith("https://uservideo.xyz") -> { + request(iframe, ref = data).document.select("iframe").attr("src") + .let { link -> + loadExtractor(fixUrl(link), mainUrl, subtitleCallback, callback) + } + } + else -> { + loadExtractor(iframe, mainUrl, subtitleCallback, callback) + } + } + } + } + + return true + } + + +} \ No newline at end of file diff --git a/AnimeSailProvider/src/main/kotlin/com/hexated/AnimeSailProviderPlugin.kt b/AnimeSailProvider/src/main/kotlin/com/hexated/AnimeSailProviderPlugin.kt new file mode 100644 index 00000000..dfdc4c0c --- /dev/null +++ b/AnimeSailProvider/src/main/kotlin/com/hexated/AnimeSailProviderPlugin.kt @@ -0,0 +1,14 @@ + +package com.hexated + +import com.lagradost.cloudstream3.plugins.CloudstreamPlugin +import com.lagradost.cloudstream3.plugins.Plugin +import android.content.Context + +@CloudstreamPlugin +class AnimeSailProviderPlugin: Plugin() { + override fun load(context: Context) { + // All providers should be added in this manner. Please don't edit the providers list directly. + registerMainAPI(AnimeSailProvider()) + } +} \ No newline at end of file diff --git a/Anizm/build.gradle.kts b/Anizm/build.gradle.kts new file mode 100644 index 00000000..6c69805d --- /dev/null +++ b/Anizm/build.gradle.kts @@ -0,0 +1,27 @@ +// use an integer for version numbers +version = 1 + + +cloudstream { + language = "tr" + // All of these properties are optional, you can safely remove them + + // description = "Lorem Ipsum" + authors = listOf("Hexated") + + /** + * Status int as the following: + * 0: Down + * 1: Ok + * 2: Slow + * 3: Beta only + * */ + status = 1 // will be 3 if unspecified + tvTypes = listOf( + "AnimeMovie", + "Anime", + "OVA", + ) + + iconUrl = "https://www.google.com/s2/favicons?domain=anizm.net&sz=%size%" +} \ No newline at end of file diff --git a/Anizm/src/main/AndroidManifest.xml b/Anizm/src/main/AndroidManifest.xml new file mode 100644 index 00000000..874740e3 --- /dev/null +++ b/Anizm/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/Anizm/src/main/kotlin/com/hexated/Anizm.kt b/Anizm/src/main/kotlin/com/hexated/Anizm.kt new file mode 100644 index 00000000..1d5fb8c0 --- /dev/null +++ b/Anizm/src/main/kotlin/com/hexated/Anizm.kt @@ -0,0 +1,195 @@ +package com.hexated + +import android.util.Log +import com.fasterxml.jackson.annotation.JsonProperty +import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer +import com.lagradost.cloudstream3.mvvm.safeApiCall +import com.lagradost.cloudstream3.utils.* +import org.jsoup.Jsoup +import org.jsoup.nodes.Element + + +class Anizm : MainAPI() { + override var mainUrl = "https://anizm.net" + override var name = "Anizm" + override val hasMainPage = true + override var lang = "tr" + override val hasDownloadSupport = true + + override val supportedTypes = setOf( + TvType.Anime, + TvType.AnimeMovie, + TvType.OVA + ) + + companion object { + private const val mainServer = "https://anizmplayer.com" + } + + override val mainPage = mainPageOf( + "$mainUrl/anime-izle?sayfa=" to "Son Eklenen Animeler", + ) + + override suspend fun getMainPage( + page: Int, + request: MainPageRequest + ): HomePageResponse { + val document = app.get(request.data + page).document + val home = document.select("div.restrictedWidth div#episodesMiddle").mapNotNull { + it.toSearchResult() + } + return newHomePageResponse(request.name, home) + } + + private fun getProperAnimeLink(uri: String): String { + return if (uri.contains("-bolum")) { + "$mainUrl/${uri.substringAfter("$mainUrl/").replace(Regex("-[0-9]+-bolum.*"), "")}" + } else { + uri + } + } + + private fun Element.toSearchResult(): AnimeSearchResponse? { + val href = getProperAnimeLink(this.selectFirst("a")!!.attr("href")) + val title = this.selectFirst("div.title, h5.animeTitle a")?.text() ?: return null + val posterUrl = fixUrlNull(this.selectFirst("img")?.attr("src")) + val episode = this.selectFirst("div.truncateText")?.text()?.let { + Regex("([0-9]+).\\s?Bölüm").find(it)?.groupValues?.getOrNull(1)?.toIntOrNull() + } + + return newAnimeSearchResponse(title, href, TvType.Anime) { + this.posterUrl = posterUrl + addSub(episode) + } + } + + override suspend fun search(query: String): List { + val document = app.get( + "$mainUrl/fullViewSearch?search=$query&skip=0", + headers = mapOf("X-Requested-With" to "XMLHttpRequest") + ).document + + return document.select("div.searchResultItem").mapNotNull { + it.toSearchResult() + } + } + + override suspend fun load(url: String): LoadResponse { + val document = app.get(url).document + + val title = document.selectFirst("h2.anizm_pageTitle a")!!.text().trim() + val type = + if (document.select("div.ui.grid div.four.wide").size == 1) TvType.Movie else TvType.Anime + val trailer = document.select("div.yt-hd-thumbnail-inner-container iframe").attr("src") + val episodes = document.select("div.ui.grid div.four.wide").map { + val name = it.select("div.episodeBlock").text() + val link = fixUrl(it.selectFirst("a")?.attr("href").toString()) + Episode(link, name) + } + return newAnimeLoadResponse(title, url, type) { + posterUrl = fixUrlNull(document.selectFirst("div.infoPosterImg > img")?.attr("src")) + this.year = document.select("div.infoSta ul li:first-child").text().trim().toIntOrNull() + addEpisodes(DubStatus.Subbed, episodes) + plot = document.select("div.infoDesc").text().trim() + this.tags = document.select("span.dataValue span.ui.label").map { it.text() } + addTrailer(trailer) + } + } + + private suspend fun invokeLokalSource( + url: String, + translator: String, + sourceCallback: (ExtractorLink) -> Unit + ) { + app.get(url, referer = "$mainUrl/").document.select("script").find { script -> + script.data().contains("eval(function(p,a,c,k,e,d)") + }?.let { + val key = getAndUnpack(it.data()).substringAfter("FirePlayer(\"").substringBefore("\",") + val referer = "$mainServer/video/$key" + val link = "$mainServer/player/index.php?data=$key&do=getVideo" + Log.i("hexated", link) + app.post( + link, + data = mapOf("hash" to key, "r" to "$mainUrl/"), + referer = referer, + headers = mapOf( + "Accept" to "*/*", + "Origin" to mainServer, + "Content-Type" to "application/x-www-form-urlencoded; charset=UTF-8", + "X-Requested-With" to "XMLHttpRequest" + ) + ).parsedSafe()?.videoSource?.let { m3uLink -> + M3u8Helper.generateM3u8( + "${this.name} ($translator)", + m3uLink, + referer + ).forEach(sourceCallback) + } + } + } + + override suspend fun loadLinks( + data: String, + isCasting: Boolean, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ): Boolean { + val document = app.get(data).document + document.select("div.episodeTranslators div#fansec").map { + Pair(it.select("a").attr("translator"), it.select("div.title").text()) + }.apmap { (url, translator) -> + safeApiCall { + app.get( + url, + referer = data, + headers = mapOf( + "Accept" to "application/json, text/javascript, */*; q=0.01", + "X-Requested-With" to "XMLHttpRequest" + ) + ).parsedSafe()?.data?.let { + Jsoup.parse(it).select("a").apmap { video -> + app.get( + video.attr("video"), + referer = data, + headers = mapOf( + "Accept" to "application/json, text/javascript, */*; q=0.01", + "X-Requested-With" to "XMLHttpRequest" + ) + ).parsedSafe()?.player?.let { iframe -> + Jsoup.parse(iframe).select("iframe").attr("src").let { link -> + when { + link.startsWith(mainServer) -> { + invokeLokalSource(link, translator, callback) + } + else -> { + loadExtractor( + fixUrl(link), + "$mainUrl/", + subtitleCallback, + callback + ) + } + } + } + } + } + } + } + } + return true + } + + data class Source( + @JsonProperty("videoSource") val videoSource: String?, + ) + + data class Videos( + @JsonProperty("player") val player: String?, + ) + + data class Translators( + @JsonProperty("data") val data: String?, + ) + +} \ No newline at end of file diff --git a/ExampleProvider/src/main/kotlin/com/example/ExamplePlugin.kt b/Anizm/src/main/kotlin/com/hexated/AnizmPlugin.kt similarity index 77% rename from ExampleProvider/src/main/kotlin/com/example/ExamplePlugin.kt rename to Anizm/src/main/kotlin/com/hexated/AnizmPlugin.kt index 8ddce484..c6741426 100644 --- a/ExampleProvider/src/main/kotlin/com/example/ExamplePlugin.kt +++ b/Anizm/src/main/kotlin/com/hexated/AnizmPlugin.kt @@ -1,13 +1,14 @@ -package com.example + +package com.hexated import com.lagradost.cloudstream3.plugins.CloudstreamPlugin import com.lagradost.cloudstream3.plugins.Plugin import android.content.Context @CloudstreamPlugin -class TestPlugin: Plugin() { +class AnizmPlugin: Plugin() { override fun load(context: Context) { // All providers should be added in this manner. Please don't edit the providers list directly. - registerMainAPI(ExampleProvider()) + registerMainAPI(Anizm()) } } \ No newline at end of file diff --git a/DramaidProvider/build.gradle.kts b/DramaidProvider/build.gradle.kts new file mode 100644 index 00000000..c2173913 --- /dev/null +++ b/DramaidProvider/build.gradle.kts @@ -0,0 +1,26 @@ +// use an integer for version numbers +version = 2 + + +cloudstream { + language = "id" + // All of these properties are optional, you can safely remove them + + // description = "Lorem Ipsum" + authors = listOf("Hexated") + + /** + * Status int as the following: + * 0: Down + * 1: Ok + * 2: Slow + * 3: Beta only + * */ + status = 1 // will be 3 if unspecified + tvTypes = listOf( + "AsianDrama", + "Movie", + ) + + iconUrl = "https://www.google.com/s2/favicons?domain=dramaid.asia&sz=%size%" +} \ No newline at end of file diff --git a/ExampleProvider/src/main/AndroidManifest.xml b/DramaidProvider/src/main/AndroidManifest.xml similarity index 54% rename from ExampleProvider/src/main/AndroidManifest.xml rename to DramaidProvider/src/main/AndroidManifest.xml index 1863f02a..c98063f8 100644 --- a/ExampleProvider/src/main/AndroidManifest.xml +++ b/DramaidProvider/src/main/AndroidManifest.xml @@ -1,2 +1,2 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/DramaidProvider/src/main/kotlin/com/hexated/DramaidProvider.kt b/DramaidProvider/src/main/kotlin/com/hexated/DramaidProvider.kt new file mode 100644 index 00000000..c6412f66 --- /dev/null +++ b/DramaidProvider/src/main/kotlin/com/hexated/DramaidProvider.kt @@ -0,0 +1,213 @@ +package com.hexated + +import com.fasterxml.jackson.annotation.JsonProperty +import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.getQualityFromName +import com.lagradost.cloudstream3.utils.loadExtractor +import org.jsoup.Jsoup +import org.jsoup.nodes.Element + +class DramaidProvider : MainAPI() { + override var mainUrl = "https://dramaid.asia" + override var name = "DramaId" + override val hasQuickSearch = false + override val hasMainPage = true + override var lang = "id" + override val hasDownloadSupport = true + override val hasChromecastSupport = false + override val supportedTypes = setOf(TvType.AsianDrama) + + companion object { + fun getStatus(t: String): ShowStatus { + return when (t) { + "Completed" -> ShowStatus.Completed + "Ongoing" -> ShowStatus.Ongoing + else -> ShowStatus.Completed + } + } + } + + override val mainPage = mainPageOf( + "&status=&type=&order=update" to "Drama Terbaru", + "&order=latest" to "Baru Ditambahkan", + "&status=&type=&order=popular" to "Drama Popular", + ) + + override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse { + val document = app.get("$mainUrl/series/?page=$page${request.data}").document + val home = document.select("article[itemscope=itemscope]").mapNotNull { + it.toSearchResult() + } + return newHomePageResponse(request.name, home) + } + + private fun getProperDramaLink(uri: String): String { + return if (uri.contains("/series/")) { + uri + } else { + "$mainUrl/series/" + Regex("$mainUrl/(.+)-ep.+").find(uri)?.groupValues?.get(1) + .toString() + } + } + + private fun Element.toSearchResult(): SearchResponse? { + val href = getProperDramaLink(this.selectFirst("a.tip")!!.attr("href")) + val title = this.selectFirst("h2[itemprop=headline]")?.text()?.trim() ?: return null + val posterUrl = fixUrlNull(this.selectFirst(".limit > noscript > img")?.attr("src")) + + return newTvSeriesSearchResponse(title, href, TvType.AsianDrama) { + this.posterUrl = posterUrl + } + } + + override suspend fun search(query: String): List { + val link = "$mainUrl/?s=$query" + val document = app.get(link).document + + return document.select("article[itemscope=itemscope]").map { + val title = it.selectFirst("h2[itemprop=headline]")!!.text().trim() + val poster = it.selectFirst(".limit > noscript > img")!!.attr("src") + val href = it.selectFirst("a.tip")!!.attr("href") + + newTvSeriesSearchResponse(title, href, TvType.AsianDrama) { + this.posterUrl = poster + } + } + } + + override suspend fun load(url: String): LoadResponse { + val document = app.get(url).document + + val title = document.selectFirst("h1.entry-title")!!.text().trim() + val poster = document.select(".thumb > noscript > img").attr("src") + val tags = document.select(".genxed > a").map { it.text() } + + val year = Regex("\\d, ([0-9]*)").find( + document.selectFirst(".info-content > .spe > span > time")!!.text().trim() + )?.groupValues?.get(1).toString().toIntOrNull() + val status = getStatus( + document.select(".info-content > .spe > span:nth-child(1)") + .text().trim().replace("Status: ", "") + ) + val description = document.select(".entry-content > p").text().trim() + + val episodes = document.select(".eplister > ul > li").map { + val name = it.selectFirst("a > .epl-title")!!.text().trim() + val link = it.select("a").attr("href") + val epNum = it.selectFirst("a > .epl-num")!!.text().trim().toIntOrNull() + newEpisode(link) { + this.name = name + this.episode = epNum + } + }.reversed() + + val recommendations = + document.select(".listupd > article[itemscope=itemscope]").map { rec -> + val epTitle = rec.selectFirst("h2[itemprop=headline]")!!.text().trim() + val epPoster = rec.selectFirst(".limit > noscript > img")!!.attr("src") + val epHref = fixUrl(rec.selectFirst("a.tip")!!.attr("href")) + + newTvSeriesSearchResponse(epTitle, epHref, TvType.AsianDrama) { + this.posterUrl = epPoster + } + } + + if (episodes.size == 1) { + return newMovieLoadResponse(title, url, TvType.Movie, episodes[0].data) { + posterUrl = poster + this.year = year + plot = description + this.tags = tags + this.recommendations = recommendations + } + } else { + return newTvSeriesLoadResponse(title, url, TvType.AsianDrama, episodes = episodes) { + posterUrl = poster + this.year = year + showStatus = status + plot = description + this.tags = tags + this.recommendations = recommendations + } + } + + } + + private data class Sources( + @JsonProperty("file") val file: String, + @JsonProperty("label") val label: String, + @JsonProperty("type") val type: String, + @JsonProperty("default") val default: Boolean? + ) + + private data class Tracks( + @JsonProperty("file") val file: String, + @JsonProperty("label") val label: String, + @JsonProperty("kind") val type: String, + @JsonProperty("default") val default: Boolean? + ) + + private suspend fun invokeDriveSource( + url: String, + name: String, + subCallback: (SubtitleFile) -> Unit, + sourceCallback: (ExtractorLink) -> Unit + ) { + val server = app.get(url).document.selectFirst(".picasa")?.nextElementSibling()?.data() + + val source = "[${server!!.substringAfter("sources: [").substringBefore("],")}]".trimIndent() + val trackers = server.substringAfter("tracks:[").substringBefore("],") + .replace("//language", "") + .replace("file", "\"file\"") + .replace("label", "\"label\"") + .replace("kind", "\"kind\"").trimIndent() + + tryParseJson>(source)?.map { + sourceCallback( + ExtractorLink( + name, + "Drive", + fixUrl(it.file), + referer = "https://motonews.club/", + quality = getQualityFromName(it.label) + ) + ) + } + + tryParseJson(trackers)?.let { + subCallback.invoke( + SubtitleFile( + if (it.label.contains("Indonesia")) "${it.label}n" else it.label, + it.file + ) + ) + } + + } + + override suspend fun loadLinks( + data: String, + isCasting: Boolean, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ): Boolean { + val document = app.get(data).document + val sources = document.select(".mobius > .mirror > option").mapNotNull { + fixUrl(Jsoup.parse(base64Decode(it.attr("value"))).select("iframe").attr("src")) + } + + sources.map { + it.replace("https://ndrama.xyz", "https://www.fembed.com") + }.apmap { + when { + it.contains("motonews.club") -> invokeDriveSource(it, this.name, subtitleCallback, callback) + else -> loadExtractor(it, data, subtitleCallback, callback) + } + } + + return true + } + +} diff --git a/DramaidProvider/src/main/kotlin/com/hexated/DramaidProviderPlugin.kt b/DramaidProvider/src/main/kotlin/com/hexated/DramaidProviderPlugin.kt new file mode 100644 index 00000000..25753bb4 --- /dev/null +++ b/DramaidProvider/src/main/kotlin/com/hexated/DramaidProviderPlugin.kt @@ -0,0 +1,14 @@ + +package com.hexated + +import com.lagradost.cloudstream3.plugins.CloudstreamPlugin +import com.lagradost.cloudstream3.plugins.Plugin +import android.content.Context + +@CloudstreamPlugin +class DramaidProviderPlugin: Plugin() { + override fun load(context: Context) { + // All providers should be added in this manner. Please don't edit the providers list directly. + registerMainAPI(DramaidProvider()) + } +} \ No newline at end of file diff --git a/DubokuProvider/build.gradle.kts b/DubokuProvider/build.gradle.kts new file mode 100644 index 00000000..c5826742 --- /dev/null +++ b/DubokuProvider/build.gradle.kts @@ -0,0 +1,27 @@ +// use an integer for version numbers +version = 1 + + +cloudstream { + language = "zh" + // All of these properties are optional, you can safely remove them + + // description = "Lorem Ipsum" + authors = listOf("Hexated") + + /** + * Status int as the following: + * 0: Down + * 1: Ok + * 2: Slow + * 3: Beta only + * */ + status = 1 // will be 3 if unspecified + tvTypes = listOf( + "AsianDrama", + "TvSeries", + "Movie", + ) + + iconUrl = "https://www.google.com/s2/favicons?domain=www.duboku.tv&sz=%size%" +} \ No newline at end of file diff --git a/DubokuProvider/src/main/AndroidManifest.xml b/DubokuProvider/src/main/AndroidManifest.xml new file mode 100644 index 00000000..c98063f8 --- /dev/null +++ b/DubokuProvider/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/DubokuProvider/src/main/kotlin/com/hexated/DubokuProvider.kt b/DubokuProvider/src/main/kotlin/com/hexated/DubokuProvider.kt new file mode 100644 index 00000000..1262fb5d --- /dev/null +++ b/DubokuProvider/src/main/kotlin/com/hexated/DubokuProvider.kt @@ -0,0 +1,133 @@ +package com.hexated + +import com.fasterxml.jackson.annotation.JsonProperty +import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.LoadResponse.Companion.addActors +import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.M3u8Helper +import org.jsoup.nodes.Element + +class DubokuProvider : MainAPI() { + override var mainUrl = "https://www.duboku.tv" + override var name = "Duboku" + override val hasMainPage = true + override var lang = "zh" + override val hasDownloadSupport = true + override val supportedTypes = setOf( + TvType.Movie, + TvType.TvSeries, + TvType.AsianDrama, + ) + + override val mainPage = mainPageOf( + "$mainUrl/vodshow/2--time------" to "连续剧 时间", + "$mainUrl/vodshow/2--hits------" to "连续剧 人气", + "$mainUrl/vodshow/13--time------" to "陆剧 时间", + "$mainUrl/vodshow/13--hits------" to "陆剧 人气", + "$mainUrl/vodshow/15--time------" to "日韩剧 时间", + "$mainUrl/vodshow/15--hits------" to "日韩剧 人气", + "$mainUrl/vodshow/21--time------" to "短剧 时间", + "$mainUrl/vodshow/21--hits------" to "短剧 人气", + "$mainUrl/vodshow/16--time------" to "英美剧 时间", + "$mainUrl/vodshow/16--hits------" to "英美剧 人气", + "$mainUrl/vodshow/14--time------" to "台泰剧 时间", + "$mainUrl/vodshow/14--hits------" to "台泰剧 人气", + "$mainUrl/vodshow/20--time------" to "港剧 时间", + "$mainUrl/vodshow/20--hits------" to "港剧 人气", + ) + + override suspend fun getMainPage( + page: Int, + request: MainPageRequest + ): HomePageResponse { + val document = app.get("${request.data}$page---.html").document + val home = document.select("ul.myui-vodlist.clearfix li").mapNotNull { + it.toSearchResult() + } + return newHomePageResponse(request.name, home) + } + + private fun Element.toSearchResult(): SearchResponse? { + val title = this.selectFirst("h4.title a")?.text()?.trim() ?: return null + val href = fixUrl(this.selectFirst("a")?.attr("href").toString()) + val posterUrl = fixUrlNull(this.selectFirst("a")?.attr("data-original")) + val episode = this.selectFirst("span.pic-text.text-right")?.text()?.filter { it.isDigit() } + ?.toIntOrNull() + + return newAnimeSearchResponse(title, href, TvType.Movie) { + this.posterUrl = posterUrl + addSub(episode) + } + } + + override suspend fun search(query: String): List { + val document = app.get("$mainUrl/vodsearch/-------------.html?wd=$query&submit=").document + + return document.select("ul#searchList li").mapNotNull { + it.toSearchResult() + } + } + + override suspend fun load(url: String): LoadResponse? { + val document = app.get(url).document + + val title = document.selectFirst("h1.title")?.text()?.trim() ?: return null + val tvType = if (document.select("ul.myui-content__list li").size == 1 + ) TvType.Movie else TvType.TvSeries + val actors = document.select("p.data")[2].select("a").map { it.text() } + + val episodes = document.select("ul.myui-content__list li").map { + val href = fixUrl(it.select("a").attr("href")) + val name = it.select("a").text().trim() + Episode( + data = href, + name = name, + ) + } + return newTvSeriesLoadResponse(title, url, tvType, episodes) { + this.posterUrl = fixUrlNull( + document.selectFirst("a.myui-vodlist__thumb.picture img")?.attr("data-original") + ) + this.year = + document.select("p.data")[0].select("a").last()?.text()?.trim()?.toIntOrNull() + this.plot = document.selectFirst("span.sketch.content")?.text()?.trim() + this.tags = document.select("p.data")[0].select("a").map { it.text() } + this.rating = document.select("div#rating span.branch").text().toRatingInt() + addActors(actors) + } + + } + + override suspend fun loadLinks( + data: String, + isCasting: Boolean, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ): Boolean { + + app.get(data).document.select("script").map { script -> + if (script.data().contains("var player_data={")) { + val dataJson = + script.data().substringAfter("var player_data={").substringBefore("}") + tryParseJson("{$dataJson}")?.let { source -> + M3u8Helper.generateM3u8( + this.name, + source.url ?: return@map, + referer = "https://w.duboku.io/", + headers = mapOf("Origin" to "https://w.duboku.io") + ).forEach(callback) + } + } + } + + + return true + } + + data class Sources( + @JsonProperty("url") val url: String?, + ) + + +} \ No newline at end of file diff --git a/DubokuProvider/src/main/kotlin/com/hexated/DubokuProviderPlugin.kt b/DubokuProvider/src/main/kotlin/com/hexated/DubokuProviderPlugin.kt new file mode 100644 index 00000000..b82c70b4 --- /dev/null +++ b/DubokuProvider/src/main/kotlin/com/hexated/DubokuProviderPlugin.kt @@ -0,0 +1,14 @@ + +package com.hexated + +import com.lagradost.cloudstream3.plugins.CloudstreamPlugin +import com.lagradost.cloudstream3.plugins.Plugin +import android.content.Context + +@CloudstreamPlugin +class DubokuProviderPlugin: Plugin() { + override fun load(context: Context) { + // All providers should be added in this manner. Please don't edit the providers list directly. + registerMainAPI(DubokuProvider()) + } +} \ No newline at end of file diff --git a/ExampleProvider/build.gradle.kts b/ExampleProvider/build.gradle.kts deleted file mode 100644 index 58645fe8..00000000 --- a/ExampleProvider/build.gradle.kts +++ /dev/null @@ -1,24 +0,0 @@ -// 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 - - // List of video source types. Users are able to filter for extensions in a given category. - // You can find a list of avaliable types here: - // https://recloudstream.github.io/cloudstream/html/app/com.lagradost.cloudstream3/-tv-type/index.html - tvTypes = listOf("Others") -} diff --git a/ExampleProvider/src/main/kotlin/com/example/ExampleProvider.kt b/ExampleProvider/src/main/kotlin/com/example/ExampleProvider.kt deleted file mode 100644 index e44a21b7..00000000 --- a/ExampleProvider/src/main/kotlin/com/example/ExampleProvider.kt +++ /dev/null @@ -1,21 +0,0 @@ -package com.example - -import com.lagradost.cloudstream3.TvType -import com.lagradost.cloudstream3.MainAPI -import com.lagradost.cloudstream3.SearchResponse - -class ExampleProvider : MainAPI() { // all providers must be an instance of MainAPI - override var mainUrl = "https://example.com/" - override var name = "Example provider" - override val supportedTypes = setOf(TvType.Movie) - - override var lang = "en" - - // enable this when your provider has a main page - override val hasMainPage = true - - // this function gets called when you search for something - override suspend fun search(query: String): List { - return listOf() - } -} \ No newline at end of file diff --git a/GomunimeProvider/build.gradle.kts b/GomunimeProvider/build.gradle.kts new file mode 100644 index 00000000..96c05f73 --- /dev/null +++ b/GomunimeProvider/build.gradle.kts @@ -0,0 +1,27 @@ +// use an integer for version numbers +version = 2 + + +cloudstream { + language = "id" + // All of these properties are optional, you can safely remove them + +// description = "Lorem Ipsum" + authors = listOf("Hexated") + + /** + * Status int as the following: + * 0: Down + * 1: Ok + * 2: Slow + * 3: Beta only + * */ + status = 0 // will be 3 if unspecified + tvTypes = listOf( + "AnimeMovie", + "Anime", + "OVA", + ) + + iconUrl = "https://www.google.com/s2/favicons?domain=185.231.223.76&sz=%size%" +} \ No newline at end of file diff --git a/GomunimeProvider/src/main/AndroidManifest.xml b/GomunimeProvider/src/main/AndroidManifest.xml new file mode 100644 index 00000000..c98063f8 --- /dev/null +++ b/GomunimeProvider/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/GomunimeProvider/src/main/kotlin/com/hexated/GomunimeProvider.kt b/GomunimeProvider/src/main/kotlin/com/hexated/GomunimeProvider.kt new file mode 100644 index 00000000..d9fa137b --- /dev/null +++ b/GomunimeProvider/src/main/kotlin/com/hexated/GomunimeProvider.kt @@ -0,0 +1,238 @@ +package com.hexated + +import com.fasterxml.jackson.annotation.JsonProperty +import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer +import com.lagradost.cloudstream3.mvvm.safeApiCall +import com.lagradost.cloudstream3.utils.AppUtils.parseJson +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.M3u8Helper +import com.lagradost.cloudstream3.utils.Qualities +import com.lagradost.cloudstream3.utils.loadExtractor +import org.jsoup.Jsoup + +class GomunimeProvider : MainAPI() { + override var mainUrl = "https://185.231.223.76" + override var name = "Gomunime" + override val hasMainPage = true + override var lang = "id" + override val hasDownloadSupport = true + + override val supportedTypes = setOf( + TvType.Anime, + TvType.AnimeMovie, + TvType.OVA + ) + + companion object { + + private const val mainServer = "https://path.onicdn.xyz/app/rapi.php" + + 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) { + "Completed" -> ShowStatus.Completed + "Ongoing" -> ShowStatus.Ongoing + else -> ShowStatus.Completed + } + } + } + + override val mainPage = mainPageOf( + "e" to "Episode Baru", + "c" to "Completed", + "la" to "Live Action", + "t" to "Trending" + ) + + override suspend fun getMainPage( + page: Int, + request: MainPageRequest + ): HomePageResponse { + val home = Jsoup.parse( + (app.post( + url = "$mainUrl/wp-admin/admin-ajax.php/wp-admin/admin-ajax.php", + headers = mapOf("Referer" to mainUrl), + data = mapOf( + "action" to "home_ajax", + "fungsi" to request.data, + "pag" to "$page" + ) + ).parsedSafe()?.html ?: throw ErrorLoadingException("Invalid Json reponse")) + ).select("li").mapNotNull { + val title = it.selectFirst("a.name")?.text()?.trim() ?: return@mapNotNull null + val href = getProperAnimeLink(it.selectFirst("a")!!.attr("href")) + val posterUrl = it.selectFirst("img")?.attr("src") + val type = getType(it.selectFirst(".taglist > span")!!.text().trim()) + val epNum = it.select(".tag.ep").text().replace(Regex("[^0-9]"), "").trim() + .toIntOrNull() + newAnimeSearchResponse(title, href, type) { + this.posterUrl = posterUrl + addSub(epNum) + } + } + + return newHomePageResponse(request.name, home) + } + + private fun getProperAnimeLink(uri: String): String { + return if (uri.contains("-episode")) { + val href = + "$mainUrl/anime/" + Regex("\\w\\d/(.*)-episode.*").find(uri)?.groupValues?.get(1) + .toString() + when { + href.contains("pokemon") -> href.replace(Regex("-[0-9]+"), "") + else -> href + } + } else { + uri + } + } + + override suspend fun search(query: String): List { + val link = "$mainUrl/?s=$query" + val document = app.get(link).document + + return document.select(".anime-list > li").map { + val title = it.selectFirst("a.name")!!.text() + val poster = it.selectFirst("img")!!.attr("src") + val tvType = getType(it.selectFirst(".taglist > span")?.text().toString()) + val href = fixUrl(it.selectFirst("a.name")!!.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(".entry-title")?.text().toString() + val poster = document.selectFirst(".thumbposter > img")?.attr("data-lazy-src") + val tags = document.select(".genxed > a").map { it.text() } + + val year = Regex("\\d, ([0-9]*)").find( + document.select("time[itemprop = datePublished]").text() + )?.groupValues?.get(1)?.toIntOrNull() + val status = getStatus(document.selectFirst(".spe > span")!!.ownText()) + val description = document.select("div[itemprop = description] > p").text() + val trailer = document.selectFirst("div.embed-responsive noscript iframe")?.attr("src") + val episodes = parseJson>( + Regex("var episodelist = (\\[.*])").find( + document.select(".bixbox.bxcl.epcheck > script").toString().trim() + )?.groupValues?.get(1).toString().replace(Regex("""\\"""), "").trim() + ).map { + val name = + Regex("(Episode\\s?[0-9]+)").find(it.epTitle.toString())?.groupValues?.getOrNull(0) + ?: it.epTitle + val link = it.epLink + Episode(link, name) + }.reversed() + + return newAnimeLoadResponse(title, url, TvType.Anime) { + engName = title + posterUrl = poster + this.year = year + addEpisodes(DubStatus.Subbed, episodes) + showStatus = status + plot = description + this.tags = tags + addTrailer(trailer) + } + } + + override suspend fun loadLinks( + data: String, + isCasting: Boolean, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ): Boolean { + val document = app.get(data).document + val scriptData = document.select("aside.sidebar > script").dataNodes().toString() + val key = scriptData.substringAfter("var a_ray = '").substringBefore("';") + val title = scriptData.substringAfter("var judul_postingan = \"").substringBefore("\";") + .replace(" ", "+") + val image = document.select("img#tempvid").last()?.attr("src").toString() + + val sources: List> = app.post( + url = mainServer, + data = mapOf("data" to key, "gambar" to image, "judul" to title, "func" to "mirror"), + referer = "$mainUrl/" + ).document.select("div.gomunime-server-mirror").map { + Pair( + it.attr("data-vhash"), + it.attr("data-type") + ) + } + + sources.apmap { + safeApiCall { + when { + it.second.contains("frame") -> { + loadExtractor(it.first, mainUrl, subtitleCallback, callback) + } + // Skip for now +// it.second.contains("hls") -> { +// app.post( +// url = mainServer, +// data = mapOf("fid" to it.first, "func" to "hls") +// ).text.let { link -> +// M3u8Helper.generateM3u8( +// this.name, +// link, +// "$mainUrl/", +// headers = mapOf("Origin" to mainUrl) +// ).forEach(callback) +// } +// } + it.second.contains("mp4") -> { + app.post( + url = mainServer, + data = mapOf("data" to it.first, "func" to "blogs") + ).parsed>().map { + callback.invoke( + ExtractorLink( + source = name, + name = "Mobi SD", + url = it.file, + referer = "$mainUrl/", + quality = Qualities.P360.value + ) + ) + } + } + else -> null + } + } + } + + return true + } + + private data class Response( + @JsonProperty("status") val status: Boolean, + @JsonProperty("html") val html: String + ) + + data class MobiSource( + @JsonProperty("file") val file: String, + @JsonProperty("label") val label: String, + @JsonProperty("type") val type: String + ) + + private data class EpisodeElement( + @JsonProperty("data-index") val dataIndex: Long?, + @JsonProperty("ep-num") val epNum: String?, + @JsonProperty("ep-title") val epTitle: String?, + @JsonProperty("ep-link") val epLink: String, + @JsonProperty("ep-date") val epDate: String? + ) + +} \ No newline at end of file diff --git a/GomunimeProvider/src/main/kotlin/com/hexated/GomunimeProviderPlugin.kt b/GomunimeProvider/src/main/kotlin/com/hexated/GomunimeProviderPlugin.kt new file mode 100644 index 00000000..06fa91e8 --- /dev/null +++ b/GomunimeProvider/src/main/kotlin/com/hexated/GomunimeProviderPlugin.kt @@ -0,0 +1,14 @@ + +package com.hexated + +import com.lagradost.cloudstream3.plugins.CloudstreamPlugin +import com.lagradost.cloudstream3.plugins.Plugin +import android.content.Context + +@CloudstreamPlugin +class GomunimeProviderPlugin: Plugin() { + override fun load(context: Context) { + // All providers should be added in this manner. Please don't edit the providers list directly. + registerMainAPI(GomunimeProvider()) + } +} \ No newline at end of file diff --git a/Gomunimeis/build.gradle.kts b/Gomunimeis/build.gradle.kts new file mode 100644 index 00000000..b329c01b --- /dev/null +++ b/Gomunimeis/build.gradle.kts @@ -0,0 +1,27 @@ +// use an integer for version numbers +version = 1 + + +cloudstream { + language = "id" + // All of these properties are optional, you can safely remove them + + // description = "Lorem Ipsum" + authors = listOf("Hexated") + + /** + * Status int as the following: + * 0: Down + * 1: Ok + * 2: Slow + * 3: Beta only + * */ + status = 1 // will be 3 if unspecified + tvTypes = listOf( + "AnimeMovie", + "Anime", + "OVA", + ) + + iconUrl = "https://www.google.com/s2/favicons?domain=gomunime.is&sz=%size%" +} \ No newline at end of file diff --git a/Gomunimeis/src/main/AndroidManifest.xml b/Gomunimeis/src/main/AndroidManifest.xml new file mode 100644 index 00000000..c98063f8 --- /dev/null +++ b/Gomunimeis/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/Gomunimeis/src/main/kotlin/com/hexated/Gomunimeis.kt b/Gomunimeis/src/main/kotlin/com/hexated/Gomunimeis.kt new file mode 100644 index 00000000..e9312963 --- /dev/null +++ b/Gomunimeis/src/main/kotlin/com/hexated/Gomunimeis.kt @@ -0,0 +1,162 @@ +package com.hexated + +import com.fasterxml.jackson.annotation.JsonProperty +import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.utils.* +import java.util.ArrayList + + +class Gomunimeis : MainAPI() { + override var mainUrl = "https://gomunime.is" + override var name = "Gomunime.is" + override val hasMainPage = true + override var lang = "id" + override val hasQuickSearch = true + override val hasDownloadSupport = true + + override val supportedTypes = setOf( + TvType.Anime, + TvType.AnimeMovie, + TvType.OVA + ) + + companion object { + + private const val mainImageUrl = "https://upload.anoboy.live" + + fun getType(t: String): TvType { + return if (t.contains("OVA", true) || t.contains("Special", true)) TvType.OVA + else if (t.contains("Movie", true)) TvType.AnimeMovie + else TvType.Anime + } + + fun getStatus(t: String): ShowStatus { + return when (t) { + "Completed" -> ShowStatus.Completed + "Ongoing" -> ShowStatus.Ongoing + else -> ShowStatus.Completed + } + } + } + + override val mainPage = mainPageOf( + "&limit=12&action=load_movie_last_update&status=Ongoing" to "Episode Baru", + "&limit=15&action=load_movie_last_update&status=Completed" to "Completed", + "&limit=15&action=load_movie_last_update&type=Live Action" to "Live Action", + "&limit=15&action=load_movie_trending" to "Trending" + ) + + override suspend fun getMainPage( + page: Int, + request: MainPageRequest + ): HomePageResponse { + val home = app.get( + "$mainUrl/my-ajax?page=$page${request.data}", + headers = mapOf("X-Requested-With" to "XMLHttpRequest") + ) + .parsedSafe()?.data + ?.mapNotNull { media -> + media.toSearchResponse() + } ?: throw ErrorLoadingException("Invalid Json reponse") + return newHomePageResponse(request.name, home) + } + + private fun Anime.toSearchResponse(): SearchResponse? { + + return newAnimeSearchResponse( + postTitle ?: return null, + "$mainUrl/anime/$postName.$salt", + TvType.TvSeries, + ) { + this.posterUrl = "$mainImageUrl/$image" + addSub(totalEpisode?.toIntOrNull()) + } + } + + override suspend fun quickSearch(query: String): List = search(query) + + override suspend fun search(query: String): List { + return app.get( + "$mainUrl/my-ajax?page=1&limit=10&action=load_search_movie&keyword=$query", + referer = "$mainUrl/search/?keyword=$query", + headers = mapOf("X-Requested-With" to "XMLHttpRequest") + ).parsedSafe()?.data + ?.mapNotNull { media -> + media.toSearchResponse() + } ?: throw ErrorLoadingException("Invalid Json reponse") + } + + override suspend fun load(url: String): LoadResponse { + val document = app.get(url).document + + val title = document.selectFirst(".entry-title")?.text().toString() + val poster = document.selectFirst(".thumbposter > img")?.attr("src") + val tags = document.select(".genxed > a").map { it.text() } + val type = getType(document.selectFirst("div.info-content .spe span:last-child")?.ownText().toString()) + val year = Regex("\\d, ([0-9]*)").find( + document.selectFirst("div.info-content .spe span.split")?.ownText().toString() + )?.groupValues?.get(1)?.toIntOrNull() + val status = getStatus(document.selectFirst(".spe > span")!!.ownText()) + val description = document.select("div[itemprop = description] > p").text() + + val episodes = document.select(".eplister > ul > li").map { + val header = it.select(".epl-title").text() + val name = Regex("(Episode\\s?[0-9]+)").find(header)?.groupValues?.getOrNull(0) ?: header + val link = it.select("a").attr("href") + Episode(link, name) + }.reversed() + + return newAnimeLoadResponse(title, url, type) { + engName = title + posterUrl = poster + this.year = year + addEpisodes(DubStatus.Subbed, episodes) + showStatus = status + plot = description + this.tags = tags + } + } + + override suspend fun loadLinks( + data: String, + isCasting: Boolean, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ): Boolean { + + val document = app.get(data).document + + document.select("div.player-container iframe").attr("src").substringAfter("html#").let { id -> + app.get("https://gomunimes.com/stream?id=$id").parsedSafe()?.server?.streamsb?.link?.let { link -> + loadExtractor(link, "https://vidgomunime.xyz/", subtitleCallback, callback) + } + } + + return true + } + + data class Streamsb( + @JsonProperty("link") val link: String?, + ) + + data class Server( + @JsonProperty("streamsb") val streamsb: Streamsb?, + ) + + data class Sources( + @JsonProperty("server") val server: Server?, + ) + + data class Responses( + @JsonProperty("data") val data: ArrayList? = arrayListOf(), + ) + + data class Anime( + @JsonProperty("post_title") val postTitle: String?, + @JsonProperty("post_name") val postName: String?, + @JsonProperty("image") val image: String?, + @JsonProperty("total_episode") val totalEpisode: String?, + @JsonProperty("salt") val salt: String?, + ) + +} \ No newline at end of file diff --git a/Gomunimeis/src/main/kotlin/com/hexated/GomunimeisPlugin.kt b/Gomunimeis/src/main/kotlin/com/hexated/GomunimeisPlugin.kt new file mode 100644 index 00000000..36a76324 --- /dev/null +++ b/Gomunimeis/src/main/kotlin/com/hexated/GomunimeisPlugin.kt @@ -0,0 +1,14 @@ + +package com.hexated + +import com.lagradost.cloudstream3.plugins.CloudstreamPlugin +import com.lagradost.cloudstream3.plugins.Plugin +import android.content.Context + +@CloudstreamPlugin +class GomunimeisPlugin: Plugin() { + override fun load(context: Context) { + // All providers should be added in this manner. Please don't edit the providers list directly. + registerMainAPI(Gomunimeis()) + } +} \ No newline at end of file diff --git a/HDrezkaProvider/build.gradle.kts b/HDrezkaProvider/build.gradle.kts new file mode 100644 index 00000000..4f6da247 --- /dev/null +++ b/HDrezkaProvider/build.gradle.kts @@ -0,0 +1,28 @@ +// use an integer for version numbers +version = 2 + + +cloudstream { + language = "ru" + // All of these properties are optional, you can safely remove them + + // description = "Lorem Ipsum" + authors = listOf("Hexated") + + /** + * Status int as the following: + * 0: Down + * 1: Ok + * 2: Slow + * 3: Beta only + * */ + status = 1 // will be 3 if unspecified + tvTypes = listOf( + "AsianDrama", + "Anime", + "TvSeries", + "Movie", + ) + + iconUrl = "https://www.google.com/s2/favicons?domain=hdrezka19139.org&sz=%size%" +} \ No newline at end of file diff --git a/HDrezkaProvider/src/main/AndroidManifest.xml b/HDrezkaProvider/src/main/AndroidManifest.xml new file mode 100644 index 00000000..c98063f8 --- /dev/null +++ b/HDrezkaProvider/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/HDrezkaProvider/src/main/kotlin/com/hexated/HDrezkaProvider.kt b/HDrezkaProvider/src/main/kotlin/com/hexated/HDrezkaProvider.kt new file mode 100644 index 00000000..f3570c5e --- /dev/null +++ b/HDrezkaProvider/src/main/kotlin/com/hexated/HDrezkaProvider.kt @@ -0,0 +1,407 @@ +package com.hexated + +import com.fasterxml.jackson.annotation.JsonProperty +import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.LoadResponse.Companion.addActors +import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer +import com.lagradost.cloudstream3.mvvm.suspendSafeApiCall +import com.lagradost.cloudstream3.utils.AppUtils.toJson +import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.Qualities +import com.lagradost.cloudstream3.utils.getQualityFromName +import org.jsoup.Jsoup +import org.jsoup.nodes.Element +import java.util.* + +class HDrezkaProvider : MainAPI() { + override var mainUrl = "https://rezka.ag" + override var name = "HDrezka" + override val hasMainPage = true + override var lang = "ru" + override val hasDownloadSupport = true + override val supportedTypes = setOf( + TvType.Movie, + TvType.TvSeries, + TvType.Anime, + TvType.AsianDrama + ) + + override val mainPage = mainPageOf( + "$mainUrl/films/?filter=watching" to "фильмы", + "$mainUrl/series/?filter=watching" to "сериалы", + "$mainUrl/cartoons/?filter=watching" to "мультфильмы", + "$mainUrl/animation/?filter=watching" to "аниме", + ) + + override suspend fun getMainPage( + page: Int, + request: MainPageRequest + ): HomePageResponse { + val url = request.data.split("?") + val home = app.get("${url.first()}page/$page/?${url.last()}").document.select( + "div.b-content__inline_items div.b-content__inline_item" + ).map { + it.toSearchResult() + } + + return newHomePageResponse(request.name, home) + } + + private fun Element.toSearchResult(): SearchResponse { + val title = + this.selectFirst("div.b-content__inline_item-link > a")?.text()?.trim().toString() + val href = this.selectFirst("a")?.attr("href").toString() + val posterUrl = this.select("img").attr("src") + val type = if (this.select("span.info").isNotEmpty()) TvType.TvSeries else TvType.Movie + return if (type == TvType.Movie) { + newMovieSearchResponse(title, href, TvType.Movie) { + this.posterUrl = posterUrl + } + } else { + val episode = + this.select("span.info").text().substringAfter(",").replace(Regex("[^0-9]"), "") + .toIntOrNull() + newAnimeSearchResponse(title, href, TvType.TvSeries) { + this.posterUrl = posterUrl + addDubStatus( + dubExist = true, + dubEpisodes = episode, + subExist = true, + subEpisodes = episode + ) + } + } + } + + override suspend fun search(query: String): List { + val link = "$mainUrl/search/?do=search&subaction=search&q=$query" + val document = app.get(link).document + + return document.select("div.b-content__inline_items div.b-content__inline_item").map { + it.toSearchResult() + } + } + + override suspend fun load(url: String): LoadResponse { + val document = app.get(url).document + + val id = url.split("/").last().split("-").first() + val title = (document.selectFirst("div.b-post__origtitle")?.text()?.trim() + ?: document.selectFirst("div.b-post__title h1")?.text()?.trim()).toString() + val poster = fixUrlNull(document.selectFirst("div.b-sidecover img")?.attr("src")) + val tags = + document.select("table.b-post__info > tbody > tr:nth-child(5) span[itemprop=genre]") + .map { it.text() } + val year = document.select("div.film-info > div:nth-child(2) a").text().toIntOrNull() + val tvType = if (document.select("div#simple-episodes-tabs") + .isNullOrEmpty() + ) TvType.Movie else TvType.TvSeries + val description = document.selectFirst("div.b-post__description_text")?.text()?.trim() + val trailer = app.post( + "$mainUrl/engine/ajax/gettrailervideo.php", + data = mapOf("id" to id), + referer = url + ).parsedSafe()?.code.let { + Jsoup.parse(it.toString()).select("iframe").attr("src") + } + val rating = + document.selectFirst("table.b-post__info > tbody > tr:nth-child(1) span.bold")?.text() + .toRatingInt() + val actors = document.select("table.b-post__info > tbody > tr:last-child span.item").map { + Actor( + it.selectFirst("span[itemprop=name]")?.text().toString(), + it.selectFirst("span[itemprop=actor]")?.attr("data-photo") + ) + } + + val recommendations = document.select("div.b-sidelist div.b-content__inline_item").map { + it.toSearchResult() + } + + val data = HashMap() + val server = ArrayList>() + + data["id"] = id + data["favs"] = document.selectFirst("input#ctrl_favs")?.attr("value").toString() + data["ref"] = url + + return if (tvType == TvType.TvSeries) { + document.select("ul#translators-list li").map { res -> + server.add( + mapOf( + "translator_name" to res.text(), + "translator_id" to res.attr("data-translator_id"), + ) + ) + } + val episodes = document.select("div#simple-episodes-tabs ul li").map { + val season = it.attr("data-season_id").toIntOrNull() + val episode = it.attr("data-episode_id").toIntOrNull() + val name = "Episode $episode" + + data["season"] = "$season" + data["episode"] = "$episode" + data["server"] = server + data["action"] = "get_stream" + + Episode( + data.toJson(), + name, + season, + episode, + ) + } + + newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodes) { + this.posterUrl = poster + this.year = year + this.plot = description + this.tags = tags + this.rating = rating + addActors(actors) + this.recommendations = recommendations + addTrailer(trailer) + } + } else { + document.select("ul#translators-list li").map { res -> + server.add( + mapOf( + "translator_name" to res.text(), + "translator_id" to res.attr("data-translator_id"), + "camrip" to res.attr("data-camrip"), + "ads" to res.attr("data-ads"), + "director" to res.attr("data-director") + ) + ) + } + + data["server"] = server + data["action"] = "get_movie" + + newMovieLoadResponse(title, url, TvType.Movie, data.toJson()) { + this.posterUrl = poster + this.year = year + this.plot = description + this.tags = tags + this.rating = rating + addActors(actors) + this.recommendations = recommendations + addTrailer(trailer) + } + } + } + + private fun decryptStreamUrl(data: String): String { + + fun getTrash(arr: List, item: Int): List { + val trash = ArrayList>() + for (i in 1..item) { + trash.add(arr) + } + return trash.reduce { acc, list -> + val temp = ArrayList() + acc.forEach { ac -> + list.forEach { li -> + temp.add(ac.plus(li)) + } + } + return@reduce temp + } + } + + val trashList = listOf("@", "#", "!", "^", "$") + val trashSet = getTrash(trashList, 2) + getTrash(trashList, 3) + var trashString = data.replace("#h", "").split("//_//").joinToString("") + + trashSet.forEach { + val temp = base64Encode(it.toByteArray()) + trashString = trashString.replace(temp, "") + } + + return base64Decode(trashString) + + } + + private fun cleanCallback( + source: String, + url: String, + quality: String, + isM3u8: Boolean, + sourceCallback: (ExtractorLink) -> Unit + ) { + sourceCallback.invoke( + ExtractorLink( + source, + source, + url, + "$mainUrl/", + getQuality(quality), + isM3u8, + headers = mapOf( + "Origin" to mainUrl + ) + ) + ) + } + + private fun getLanguage(str: String): String { + return when (str) { + "Русский" -> "Russian" + "Українська" -> "Ukrainian" + else -> str + } + } + + private fun getQuality(str: String): Int { + return when (str) { + "360p" -> Qualities.P240.value + "480p" -> Qualities.P360.value + "720p" -> Qualities.P480.value + "1080p" -> Qualities.P720.value + "1080p Ultra" -> Qualities.P1080.value + else -> getQualityFromName(str) + } + } + + private fun invokeSources( + source: String, + url: String, + subtitle: String, + subCallback: (SubtitleFile) -> Unit, + sourceCallback: (ExtractorLink) -> Unit + ) { + decryptStreamUrl(url).split(",").map { links -> + val quality = + Regex("\\[([0-9]*p.*?)]").find(links)?.groupValues?.getOrNull(1) + .toString().trim() + links.replace("[$quality]", "").split("or").map { it.trim() } + .map { link -> + + if (link.endsWith(".m3u8")) { + cleanCallback( + "$source (Main)", + link, + quality, + true, + sourceCallback, + ) + } else { + cleanCallback( + "$source (Backup)", + link, + quality, + false, + sourceCallback, + ) + } + } + } + + subtitle.split(",").map { sub -> + val language = + Regex("\\[(.*)]").find(sub)?.groupValues?.getOrNull(1) + .toString() + val link = sub.replace("[$language]", "").trim() + subCallback.invoke( + SubtitleFile( + getLanguage(language), + link + ) + ) + } + } + + override suspend fun loadLinks( + data: String, + isCasting: Boolean, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ): Boolean { + + tryParseJson(data)?.let { res -> + if (res.server?.isEmpty() == true) { + val document = app.get(res.ref ?: return@let).document + document.select("script").map { script -> + if (script.data().contains("sof.tv.initCDNMoviesEvents(")) { + val dataJson = + script.data().substringAfter("false, {").substringBefore("});") + tryParseJson("{$dataJson}")?.let { source -> + invokeSources( + this.name, + source.streams, + source.subtitle.toString(), + subtitleCallback, + callback + ) + } + } + } + } else { + res.server?.apmap { server -> + suspendSafeApiCall { + app.post( + url = "$mainUrl/ajax/get_cdn_series/?t=${Date().time}", + data = mapOf( + "id" to res.id, + "translator_id" to server.translator_id, + "favs" to res.favs, + "is_camrip" to server.camrip, + "is_ads" to server.ads, + "is_director" to server.director, + "season" to res.season, + "episode" to res.episode, + "action" to res.action, + ).filterValues { it != null }.mapValues { it.value as String }, + referer = res.ref + ).parsedSafe()?.let { source -> + invokeSources( + server.translator_name.toString(), + source.url, + source.subtitle.toString(), + subtitleCallback, + callback + ) + } + } + } + } + } + + return true + } + + data class LocalSources( + @JsonProperty("streams") val streams: String, + @JsonProperty("subtitle") val subtitle: Any?, + ) + + data class Sources( + @JsonProperty("url") val url: String, + @JsonProperty("subtitle") val subtitle: Any?, + ) + + data class Server( + @JsonProperty("translator_name") val translator_name: String?, + @JsonProperty("translator_id") val translator_id: String?, + @JsonProperty("camrip") val camrip: String?, + @JsonProperty("ads") val ads: String?, + @JsonProperty("director") val director: String?, + ) + + data class Data( + @JsonProperty("id") val id: String?, + @JsonProperty("favs") val favs: String?, + @JsonProperty("server") val server: List?, + @JsonProperty("season") val season: String?, + @JsonProperty("episode") val episode: String?, + @JsonProperty("action") val action: String?, + @JsonProperty("ref") val ref: String?, + ) + + data class Trailer( + @JsonProperty("success") val success: Boolean?, + @JsonProperty("code") val code: String?, + ) + +} \ No newline at end of file diff --git a/HDrezkaProvider/src/main/kotlin/com/hexated/HDrezkaProviderPlugin.kt b/HDrezkaProvider/src/main/kotlin/com/hexated/HDrezkaProviderPlugin.kt new file mode 100644 index 00000000..7b7f122c --- /dev/null +++ b/HDrezkaProvider/src/main/kotlin/com/hexated/HDrezkaProviderPlugin.kt @@ -0,0 +1,14 @@ + +package com.hexated + +import com.lagradost.cloudstream3.plugins.CloudstreamPlugin +import com.lagradost.cloudstream3.plugins.Plugin +import android.content.Context + +@CloudstreamPlugin +class HDrezkaProviderPlugin: Plugin() { + override fun load(context: Context) { + // All providers should be added in this manner. Please don't edit the providers list directly. + registerMainAPI(HDrezkaProvider()) + } +} \ No newline at end of file diff --git a/Hdfilmcehennemi/build.gradle.kts b/Hdfilmcehennemi/build.gradle.kts new file mode 100644 index 00000000..c10c4e99 --- /dev/null +++ b/Hdfilmcehennemi/build.gradle.kts @@ -0,0 +1,26 @@ +// use an integer for version numbers +version = 1 + + +cloudstream { + language = "tr" + // All of these properties are optional, you can safely remove them + + // description = "Lorem Ipsum" + authors = listOf("Hexated") + + /** + * Status int as the following: + * 0: Down + * 1: Ok + * 2: Slow + * 3: Beta only + * */ + status = 1 // will be 3 if unspecified + tvTypes = listOf( + "TvSeries", + "Movie", + ) + + iconUrl = "https://www.google.com/s2/favicons?domain=hdfilmcehennemi.live&sz=%size%" +} \ No newline at end of file diff --git a/Hdfilmcehennemi/src/main/AndroidManifest.xml b/Hdfilmcehennemi/src/main/AndroidManifest.xml new file mode 100644 index 00000000..c98063f8 --- /dev/null +++ b/Hdfilmcehennemi/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/Hdfilmcehennemi/src/main/kotlin/com/hexated/Hdfilmcehennemi.kt b/Hdfilmcehennemi/src/main/kotlin/com/hexated/Hdfilmcehennemi.kt new file mode 100644 index 00000000..5440aa02 --- /dev/null +++ b/Hdfilmcehennemi/src/main/kotlin/com/hexated/Hdfilmcehennemi.kt @@ -0,0 +1,205 @@ +package com.hexated + +import com.fasterxml.jackson.annotation.JsonProperty +import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.LoadResponse.Companion.addActors +import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer +import com.lagradost.cloudstream3.mvvm.safeApiCall +import com.lagradost.cloudstream3.utils.* +import org.jsoup.nodes.Element + +class Hdfilmcehennemi : MainAPI() { + override var mainUrl = "https://www.hdfilmcehennemi.live" + override var name = "hdfilmcehennemi" + override val hasMainPage = true + override var lang = "tr" + override val hasQuickSearch = true + override val hasDownloadSupport = true + override val supportedTypes = setOf( + TvType.Movie, + TvType.TvSeries, + ) + + override val mainPage = mainPageOf( + "$mainUrl/category/tavsiye-filmler-izle1/page/" to "Tavsiye Filmler Kategorisi", + "$mainUrl/yabancidizi/page/" to "Son Eklenen Yabancı Diziler", + "$mainUrl/imdb-7-puan-uzeri-filmler/page/" to "Imdb 7+ Filmler", + "$mainUrl/en-cok-yorumlananlar/page/" to "En Çok Yorumlananlar", + "$mainUrl/en-cok-begenilen-filmleri-izle/page/" to "En Çok Beğenilenler", + ) + + override suspend fun getMainPage( + page: Int, + request: MainPageRequest + ): HomePageResponse { + val document = app.get(request.data + page).document + val home = document.select("div.card-body div.row div.col-6.col-sm-3.poster-container") + .mapNotNull { + it.toSearchResult() + } + return newHomePageResponse(request.name, home) + } + + private fun Element.toSearchResult(): SearchResponse? { + val title = this.selectFirst("a")?.text() ?: return null + val href = fixUrlNull(this.selectFirst("a")?.attr("href")) ?: return null + val posterUrl = fixUrlNull(this.selectFirst("img")?.attr("data-src")) + return newMovieSearchResponse(title, href, TvType.Movie) { + this.posterUrl = posterUrl + } + + } + + private fun Media.toSearchResponse(): SearchResponse? { + return newMovieSearchResponse( + title ?: return null, + "$mainUrl/$slugPrefix$slug", + TvType.TvSeries, + ) { + this.posterUrl = "$mainUrl/uploads/poster/$poster" + } + } + + override suspend fun quickSearch(query: String): List = search(query) + + override suspend fun search(query: String): List { + return app.post( + "$mainUrl/search/", + data = mapOf("query" to query), + referer = "$mainUrl/", + headers = mapOf( + "Accept" to "application/json, text/javascript, */*; q=0.01", + "X-Requested-With" to "XMLHttpRequest" + ) + ).parsedSafe()?.result?.mapNotNull { media -> + media.toSearchResponse() + } ?: throw ErrorLoadingException("Invalid Json reponse") + } + + override suspend fun load(url: String): LoadResponse? { + val document = app.get(url).document + + val title = document.selectFirst("div.card-header > h1, div.card-header > h2")?.text() + ?: return null + val poster = fixUrlNull(document.selectFirst("img.img-fluid")?.attr("src")) + val tags = document.select("div.mb-0.lh-lg div:nth-child(5) a").map { it.text() } + val year = + document.selectFirst("div.mb-0.lh-lg div:nth-child(4) a")?.text()?.trim()?.toIntOrNull() + val tvType = if (document.select("nav#seasonsTabs").isNullOrEmpty() + ) TvType.Movie else TvType.TvSeries + val description = document.selectFirst("article.text-white > p")?.text()?.trim() + val rating = document.selectFirst("div.rating-votes div.rate span")?.text()?.toRatingInt() + val actors = document.select("div.mb-0.lh-lg div:last-child a.chip").map { + Actor(it.text(), it.select("img").attr("src")) + } + val recommendations = + document.select("div.swiper-wrapper div.poster.poster-pop").mapNotNull { + val recName = it.selectFirst("h2.title")?.text() ?: return@mapNotNull null + val recHref = + fixUrlNull(it.selectFirst("a")?.attr("href")) ?: return@mapNotNull null + val recPosterUrl = fixUrlNull(it.selectFirst("img")?.attr("data-src")) + newTvSeriesSearchResponse(recName, recHref, TvType.TvSeries) { + this.posterUrl = recPosterUrl + } + } + + return if (tvType == TvType.TvSeries) { + val trailer = + document.selectFirst("button.btn.btn-fragman.btn-danger")?.attr("data-trailer") + ?.let { + "https://www.youtube.com/embed/$it" + } + val episodes = document.select("div#seasonsTabs-tabContent div.card-list-item").map { + val href = it.select("a").attr("href") + val name = it.select("h3").text().trim() + val episode = it.select("h3").text().let { num -> + Regex("Sezon\\s?([0-9]+).").find(num)?.groupValues?.getOrNull(1)?.toIntOrNull() + } + val season = it.parents()[1].attr("id").substringAfter("-").toIntOrNull() + Episode( + href, + name, + season, + episode, + ) + } + newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodes) { + this.posterUrl = poster + this.year = year + this.plot = description + this.tags = tags + this.rating = rating + addActors(actors) + this.recommendations = recommendations + addTrailer(trailer) + } + } else { + val trailer = + document.selectFirst("nav.nav.card-nav.nav-slider a[data-bs-toggle=\"modal\"]") + ?.attr("data-trailer")?.let { + "https://www.youtube.com/embed/$it" + } + newMovieLoadResponse(title, url, TvType.Movie, url) { + this.posterUrl = poster + this.year = year + this.plot = description + this.tags = tags + this.rating = rating + addActors(actors) + this.recommendations = recommendations + addTrailer(trailer) + } + } + } + + private suspend fun invokeLocalSource( + source: String, + url: String, + sourceCallback: (ExtractorLink) -> Unit + ) { + val m3uLink = + app.get(url, referer = "$mainUrl/").document.select("script") + .find { + it.data().contains("var sources = [];") || it.data() + .contains("playerInstance =") + }?.data() + ?.substringAfter("[{file:\"")?.substringBefore("\"}]") ?: return + + M3u8Helper.generateM3u8( + source, + m3uLink, + if (url.startsWith(mainUrl)) "$mainUrl/" else "https://vidmoly.to/" + ).forEach(sourceCallback) + + } + + override suspend fun loadLinks( + data: String, + isCasting: Boolean, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ): Boolean { + app.get(data).document.select("nav.nav.card-nav.nav-slider a.nav-link").map { + Pair(it.attr("href"), it.text()) + }.apmap { (url, source) -> + safeApiCall { + app.get(url).document.select("div.card-video > iframe").attr("data-src") + .let { link -> + invokeLocalSource(source, link, callback) + } + } + } + return true + } + + data class Result( + @JsonProperty("result") val result: ArrayList? = arrayListOf(), + ) + + data class Media( + @JsonProperty("title") val title: String? = null, + @JsonProperty("poster") val poster: String? = null, + @JsonProperty("slug") val slug: String? = null, + @JsonProperty("slug_prefix") val slugPrefix: String? = null, + ) +} \ No newline at end of file diff --git a/Hdfilmcehennemi/src/main/kotlin/com/hexated/HdfilmcehennemiPlugin.kt b/Hdfilmcehennemi/src/main/kotlin/com/hexated/HdfilmcehennemiPlugin.kt new file mode 100644 index 00000000..257679b0 --- /dev/null +++ b/Hdfilmcehennemi/src/main/kotlin/com/hexated/HdfilmcehennemiPlugin.kt @@ -0,0 +1,14 @@ + +package com.hexated + +import com.lagradost.cloudstream3.plugins.CloudstreamPlugin +import com.lagradost.cloudstream3.plugins.Plugin +import android.content.Context + +@CloudstreamPlugin +class HdfilmcehennemiPlugin: Plugin() { + override fun load(context: Context) { + // All providers should be added in this manner. Please don't edit the providers list directly. + registerMainAPI(Hdfilmcehennemi()) + } +} \ No newline at end of file diff --git a/IdlixProvider/build.gradle.kts b/IdlixProvider/build.gradle.kts new file mode 100644 index 00000000..acdda45d --- /dev/null +++ b/IdlixProvider/build.gradle.kts @@ -0,0 +1,26 @@ +// use an integer for version numbers +version = 2 + + +cloudstream { + language = "id" + // All of these properties are optional, you can safely remove them + + // description = "Lorem Ipsum" + authors = listOf("Hexated") + + /** + * Status int as the following: + * 0: Down + * 1: Ok + * 2: Slow + * 3: Beta only + * */ + status = 1 // will be 3 if unspecified + tvTypes = listOf( + "TvSeries", + "Movie", + ) + + iconUrl = "https://www.google.com/s2/favicons?domain=94.103.82.88&sz=%size%" +} \ No newline at end of file diff --git a/IdlixProvider/src/main/AndroidManifest.xml b/IdlixProvider/src/main/AndroidManifest.xml new file mode 100644 index 00000000..c98063f8 --- /dev/null +++ b/IdlixProvider/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/IdlixProvider/src/main/kotlin/com/hexated/IdlixProvider.kt b/IdlixProvider/src/main/kotlin/com/hexated/IdlixProvider.kt new file mode 100644 index 00000000..8350fba4 --- /dev/null +++ b/IdlixProvider/src/main/kotlin/com/hexated/IdlixProvider.kt @@ -0,0 +1,385 @@ +package com.hexated + +import com.fasterxml.jackson.annotation.JsonProperty +import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.LoadResponse.Companion.addActors +import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer +import com.lagradost.cloudstream3.mvvm.safeApiCall +import com.lagradost.cloudstream3.utils.* +import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson +import org.jsoup.nodes.Element +import java.net.URI + +class IdlixProvider : MainAPI() { + override var mainUrl = "https://195.2.92.213" + override var name = "Idlix" + override val hasMainPage = true + override var lang = "id" + override val hasDownloadSupport = true + override val supportedTypes = setOf( + TvType.Movie, + TvType.TvSeries, + ) + + override val mainPage = mainPageOf( + "$mainUrl/trending/page/?get=movies" to "Trending Movies", + "$mainUrl/trending/page/?get=tv" to "Trending TV Series", + "$mainUrl/movie/page/" to "Movie Terbaru", + "$mainUrl/tvseries/page/" to "TV Series Terbaru", + "$mainUrl/season/page/" to "Season Terbaru", + "$mainUrl/episode/page/" to "Episode Terbaru", + ) + + override suspend fun getMainPage( + page: Int, + request: MainPageRequest + ): HomePageResponse { + val url = request.data.split("?") + val document = app.get("${url.first()}$page/?${url.lastOrNull()}").document + val home = document.select("div.items.full article, div#archive-content article").mapNotNull { + it.toSearchResult() + } + return newHomePageResponse(request.name, home) + } + + private fun getProperLink(uri: String): String { + return when { + uri.contains("/episode/") -> { + var title = uri.substringAfter("$mainUrl/episode/") + title = Regex("(.+?)-season").find(title)?.groupValues?.get(1).toString() + "$mainUrl/tvseries/$title" + } + uri.contains("/season/") -> { + var title = uri.substringAfter("$mainUrl/season/") + title = Regex("(.+?)-season").find(title)?.groupValues?.get(1).toString() + "$mainUrl/tvseries/$title" + } + else -> { + uri + } + } + } + + private fun Element.toSearchResult(): SearchResponse { + val title = this.selectFirst("h3 > a")!!.text().replace(Regex("\\(\\d{4}\\)"), "").trim() + val href = getProperLink(this.selectFirst("h3 > a")!!.attr("href")) + val posterUrl = this.select("div.poster > img").attr("src").toString() + val quality = getQualityFromString(this.select("span.quality").text()) + return newMovieSearchResponse(title, href, TvType.Movie) { + this.posterUrl = posterUrl + this.quality = quality + } + + } + + override suspend fun search(query: String): List { + val link = "$mainUrl/search/$query" + val document = app.get(link).document + + return document.select("div.result-item").map { + val title = + it.selectFirst("div.title > a")!!.text().replace(Regex("\\(\\d{4}\\)"), "").trim() + val href = getProperLink(it.selectFirst("div.title > a")!!.attr("href")) + val posterUrl = it.selectFirst("img")!!.attr("src").toString() + newMovieSearchResponse(title, href, TvType.TvSeries) { + this.posterUrl = posterUrl + } + } + } + + override suspend fun load(url: String): LoadResponse { + val document = app.get(url).document + + val title = + document.selectFirst("div.data > h1")?.text()?.replace(Regex("\\(\\d{4}\\)"), "") + ?.trim().toString() + val poster = document.select("div.poster > img").attr("src").toString() + val tags = document.select("div.sgeneros > a").map { it.text() } + + val year = Regex(",\\s?(\\d+)").find( + document.select("span.date").text().trim() + )?.groupValues?.get(1).toString().toIntOrNull() + val tvType = if (document.select("ul#section > li:nth-child(1)").text().contains("Episodes") + ) TvType.TvSeries else TvType.Movie + val description = document.select("div.wp-content > p").text().trim() + val trailer = document.selectFirst("div.embed iframe")?.attr("src") + val rating = + document.selectFirst("span.dt_rating_vgs")?.text()?.toRatingInt() + val actors = document.select("div.persons > div[itemprop=actor]").map { + Actor(it.select("meta[itemprop=name]").attr("content"), it.select("img").attr("src")) + } + + val recommendations = document.select("div.owl-item").map { + val recName = + it.selectFirst("a")!!.attr("href").toString().removeSuffix("/").split("/").last() + val recHref = it.selectFirst("a")!!.attr("href") + val recPosterUrl = it.selectFirst("img")?.attr("src").toString() + newTvSeriesSearchResponse(recName, recHref, TvType.TvSeries) { + this.posterUrl = recPosterUrl + } + } + + return if (tvType == TvType.TvSeries) { + val episodes = document.select("ul.episodios > li").map { + val href = it.select("a").attr("href") + val name = fixTitle(it.select("div.episodiotitle > a").text().trim()) + val image = it.select("div.imagen > img").attr("src") + val episode = it.select("div.numerando").text().replace(" ", "").split("-").last() + .toIntOrNull() + val season = it.select("div.numerando").text().replace(" ", "").split("-").first() + .toIntOrNull() + Episode( + href, + name, + season, + episode, + image + ) + } + newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodes) { + this.posterUrl = poster + this.year = year + this.plot = description + this.tags = tags + this.rating = rating + addActors(actors) + this.recommendations = recommendations + addTrailer(trailer) + } + } else { + newMovieLoadResponse(title, url, TvType.Movie, url) { + this.posterUrl = poster + this.year = year + this.plot = description + this.tags = tags + this.rating = rating + addActors(actors) + this.recommendations = recommendations + addTrailer(trailer) + } + } + } + + private fun getLanguage(str: String): String { + return when { + str.lowercase().contains("indonesia") || str.lowercase() + .contains("bahasa") -> "Indonesian" + else -> str + } + } + + data class ResponseHash( + @JsonProperty("embed_url") val embed_url: String, + @JsonProperty("type") val type: String?, + ) + + data class ResponseSource( + @JsonProperty("hls") val hls: Boolean, + @JsonProperty("videoSource") val videoSource: String, + @JsonProperty("securedLink") val securedLink: String?, + ) + + data class Tracks( + @JsonProperty("kind") val kind: String?, + @JsonProperty("file") val file: String, + @JsonProperty("label") val label: String?, + ) + + private suspend fun invokeLokalSource( + url: String, + subCallback: (SubtitleFile) -> Unit, + sourceCallback: (ExtractorLink) -> Unit + ) { + val document = app.get(url, referer = "$mainUrl/").document + val hash = url.split("/").last().substringAfter("data=") + + val m3uLink = app.post( + url = "https://jeniusplay.com/player/index.php?data=$hash&do=getVideo", + data = mapOf("hash" to hash, "r" to "$mainUrl/"), + referer = url, + headers = mapOf("X-Requested-With" to "XMLHttpRequest") + ).parsed().videoSource + + M3u8Helper.generateM3u8( + this.name, + m3uLink, + url, + ).forEach(sourceCallback) + + + document.select("script").map { script -> + if (script.data().contains("eval(function(p,a,c,k,e,d)")) { + val subData = + getAndUnpack(script.data()).substringAfter("\"tracks\":[").substringBefore("],") + tryParseJson>("[$subData]")?.map { subtitle -> + subCallback.invoke( + SubtitleFile( + getLanguage(subtitle.label!!), + subtitle.file + ) + ) + } + } + } + } + + data class ResponseLaviolaSource( + @JsonProperty("file") val file: String, + @JsonProperty("label") val label: String?, + ) + + private suspend fun invokeLaviolaSource( + url: String, + subCallback: (SubtitleFile) -> Unit, + sourceCallback: (ExtractorLink) -> Unit + ) { + val document = app.get(url, referer = "$mainUrl/").document + val baseName = "Laviola" + val baseUrl = "https://laviola.live/" + document.select("script").map { script -> + if (script.data().contains("var config = {")) { + val data = script.data().substringAfter("sources: [").substringBefore("],") + tryParseJson>("[$data]")?.map { m3u -> + val m3uData = app.get(m3u.file, referer = baseUrl).text + val quality = + Regex("\\d{3,4}\\.m3u8").findAll(m3uData).map { it.value }.toList() + quality.forEach { + sourceCallback.invoke( + ExtractorLink( + source = baseName, + name = baseName, + url = m3u.file.replace("video.m3u8", it), + referer = baseUrl, + quality = getQualityFromName("${it.replace(".m3u8", "")}p"), + isM3u8 = true + ) + ) + } + } + + val subData = script.data().substringAfter("tracks: [").substringBefore("],") + tryParseJson>("[$subData]")?.map { subtitle -> + subCallback.invoke( + SubtitleFile( + getLanguage(subtitle.label!!), + (if (subtitle.kind!!.contains("captions")) subtitle.file else null)!! + ) + ) + } + } + } + } + + private data class Captions( + @JsonProperty("id") val id: String, + @JsonProperty("hash") val hash: String, + @JsonProperty("language") val language: String, + ) + + private data class Data( + @JsonProperty("file") val file: String, + @JsonProperty("label") val label: String, + ) + + private data class Player( + @JsonProperty("poster_file") val poster_file: String, + ) + + private data class ResponseCdn( + @JsonProperty("success") val success: Boolean, + @JsonProperty("player") val player: Player, + @JsonProperty("data") val data: List?, + @JsonProperty("captions") val captions: List? + ) + + private suspend fun invokeCdnSource( + url: String, + subCallback: (SubtitleFile) -> Unit, + sourceCallback: (ExtractorLink) -> Unit + ) { + val domainUrl = "https://cdnplayer.online" + val id = url.trimEnd('/').split("/").last() + val sources = app.post( + url = "$domainUrl/api/source/$id", + data = mapOf("r" to mainUrl, "d" to URI(url).host) + ).parsed() + + sources.data?.map { + sourceCallback.invoke( + ExtractorLink( + name, + "Cdnplayer", + fixUrl(it.file), + referer = url, + quality = getQualityFromName(it.label) + ) + ) + } + val userData = sources.player.poster_file.split("/")[2] + sources.captions?.map { subtitle -> + subCallback.invoke( + SubtitleFile( + getLanguage(subtitle.language), + "$domainUrl/asset/userdata/$userData/caption/${subtitle.hash}/${subtitle.id}.srt" + ) + ) + } + + } + + override suspend fun loadLinks( + data: String, + isCasting: Boolean, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ): Boolean { + + val document = app.get(data).document + val id = document.select("meta#dooplay-ajax-counter").attr("data-postid") + val type = if (data.contains("/movie/")) "movie" else "tv" + + document.select("ul#playeroptionsul > li").map { + it.attr("data-nume") + }.apmap { nume -> + safeApiCall { + var source = app.post( + url = "$mainUrl/wp-admin/admin-ajax.php", + data = mapOf( + "action" to "doo_player_ajax", + "post" to id, + "nume" to nume, + "type" to type + ) + ).parsed().embed_url + + when { + source.startsWith("https://jeniusplay.com") -> invokeLokalSource( + source, + subtitleCallback, + callback + ) + source.startsWith("https://laviola.live") -> invokeLaviolaSource( + source, + subtitleCallback, + callback + ) + source.startsWith("https://cdnplayer.online") -> invokeCdnSource( + source, + subtitleCallback, + callback + ) + else -> { + if (source.startsWith("https://uservideo.xyz")) { + source = app.get(source).document.select("iframe").attr("src") + } + loadExtractor(source, data, subtitleCallback, callback) + } + } + } + } + + return true + } + + +} \ No newline at end of file diff --git a/IdlixProvider/src/main/kotlin/com/hexated/IdlixProviderPlugin.kt b/IdlixProvider/src/main/kotlin/com/hexated/IdlixProviderPlugin.kt new file mode 100644 index 00000000..115b22a6 --- /dev/null +++ b/IdlixProvider/src/main/kotlin/com/hexated/IdlixProviderPlugin.kt @@ -0,0 +1,14 @@ + +package com.hexated + +import com.lagradost.cloudstream3.plugins.CloudstreamPlugin +import com.lagradost.cloudstream3.plugins.Plugin +import android.content.Context + +@CloudstreamPlugin +class IdlixProviderPlugin: Plugin() { + override fun load(context: Context) { + // All providers should be added in this manner. Please don't edit the providers list directly. + registerMainAPI(IdlixProvider()) + } +} \ No newline at end of file diff --git a/KisskhProvider/build.gradle.kts b/KisskhProvider/build.gradle.kts new file mode 100644 index 00000000..cc54a0a1 --- /dev/null +++ b/KisskhProvider/build.gradle.kts @@ -0,0 +1,28 @@ +// use an integer for version numbers +version = 3 + + +cloudstream { + language = "en" + // All of these properties are optional, you can safely remove them + + // description = "Lorem Ipsum" + authors = listOf("Hexated") + + /** + * Status int as the following: + * 0: Down + * 1: Ok + * 2: Slow + * 3: Beta only + * */ + status = 1 // will be 3 if unspecified + tvTypes = listOf( + "AsianDrama", + "TvSeries", + "Anime", + "Movie", + ) + + iconUrl = "https://www.google.com/s2/favicons?domain=kisskh.me&sz=%size%" +} \ No newline at end of file diff --git a/KisskhProvider/src/main/AndroidManifest.xml b/KisskhProvider/src/main/AndroidManifest.xml new file mode 100644 index 00000000..c98063f8 --- /dev/null +++ b/KisskhProvider/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/KisskhProvider/src/main/kotlin/com/hexated/KisskhProvider.kt b/KisskhProvider/src/main/kotlin/com/hexated/KisskhProvider.kt new file mode 100644 index 00000000..c0d770d7 --- /dev/null +++ b/KisskhProvider/src/main/kotlin/com/hexated/KisskhProvider.kt @@ -0,0 +1,217 @@ +package com.hexated + +import com.fasterxml.jackson.annotation.JsonProperty +import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.mvvm.safeApiCall +import com.lagradost.cloudstream3.utils.AppUtils.parseJson +import com.lagradost.cloudstream3.utils.AppUtils.toJson +import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.M3u8Helper +import com.lagradost.cloudstream3.utils.loadExtractor +import java.util.ArrayList + +class KisskhProvider : MainAPI() { + override var mainUrl = "https://kisskh.me" + override var name = "Kisskh" + override val hasMainPage = true + override val hasDownloadSupport = true + override val supportedTypes = setOf( + TvType.AsianDrama, + TvType.Anime + ) + + override val mainPage = mainPageOf( + "&type=2&sub=0&country=2&status=0&order=1" to "Movie Popular", + "&type=2&sub=0&country=2&status=0&order=2" to "Movie Last Update", + "&type=1&sub=0&country=2&status=0&order=1" to "TVSeries Popular", + "&type=1&sub=0&country=2&status=0&order=2" to "TVSeries Last Update", + "&type=3&sub=0&country=0&status=0&order=1" to "Anime Popular", + "&type=3&sub=0&country=0&status=0&order=2" to "Anime Last Update", + "&type=4&sub=0&country=0&status=0&order=1" to "Hollywood Popular", + "&type=4&sub=0&country=0&status=0&order=2" to "Hollywood Last Update", + ) + + override suspend fun getMainPage( + page: Int, + request: MainPageRequest + ): HomePageResponse { + val home = app.get("$mainUrl/api/DramaList/List?page=$page${request.data}") + .parsedSafe()?.data + ?.mapNotNull { media -> + media.toSearchResponse() + } ?: throw ErrorLoadingException("Invalid Json reponse") + return newHomePageResponse( + list = HomePageList( + name = request.name, + list = home, + isHorizontalImages = true + ), + hasNext = true + ) + } + + private fun Media.toSearchResponse(): SearchResponse? { + + return newAnimeSearchResponse( + title ?: return null, + "$title/$id", + TvType.TvSeries, + ) { + this.posterUrl = thumbnail + addSub(episodesCount) + } + } + + override suspend fun search(query: String): List { + val searchResponse = + app.get("$mainUrl/api/DramaList/Search?q=$query&type=0", referer = "$mainUrl/").text + return tryParseJson>(searchResponse)?.mapNotNull { media -> + media.toSearchResponse() + } ?: throw ErrorLoadingException("Invalid Json reponse") + } + + private fun getTitle(str: String): String { + return str.replace(Regex("[^a-zA-Z0-9]"), "-") + } + + override suspend fun load(url: String): LoadResponse? { + val id = url.split("/") + val res = app.get( + "$mainUrl/api/DramaList/Drama/${id.last()}?isq=false", + referer = "$mainUrl/Drama/${ + getTitle(id.first()) + }?id=${id.last()}" + ).parsedSafe() + ?: throw ErrorLoadingException("Invalid Json reponse") + + val episodes = res.episodes?.map { eps -> + Episode( + data = Data(res.title, eps.number, res.id, eps.id).toJson(), + episode = eps.number + ) + } ?: throw ErrorLoadingException("No Episode") + + return newTvSeriesLoadResponse( + res.title ?: return null, + url, + if (res.type == "Movie" || episodes.size == 1) TvType.Movie else TvType.TvSeries, + episodes + ) { + this.posterUrl = res.thumbnail + this.year = res.releaseDate?.split("-")?.first()?.toIntOrNull() + this.plot = res.description + this.tags = listOf("${res.country}", "${res.status}", "${res.type}") + this.showStatus = when (res.status) { + "Completed" -> ShowStatus.Completed + "Ongoing" -> ShowStatus.Ongoing + else -> null + } + } + + } + + private fun getLanguage(str: String): String { + return when (str) { + "Indonesia" -> "Indonesian" + else -> str + } + } + + override suspend fun loadLinks( + data: String, + isCasting: Boolean, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ): Boolean { + + val loadData = parseJson(data) + + app.get( + "$mainUrl/api/DramaList/Episode/${loadData.epsId}.png?err=false&ts=&time=", + referer = "$mainUrl/Drama/${getTitle("${loadData.title}")}/Episode-${loadData.eps}?id=${loadData.id}&ep=${loadData.epsId}&page=0&pageSize=100" + ).parsedSafe()?.let { source -> + listOf(source.video, source.thirdParty).apmap { link -> + safeApiCall { + if (link?.contains(".m3u8") == true) { + M3u8Helper.generateM3u8( + this.name, + link, + referer = "$mainUrl/", + headers = mapOf("Origin" to mainUrl) + ).forEach(callback) + } else { + loadExtractor( + link?.substringBefore("=http") ?: return@safeApiCall, + "$mainUrl/", + subtitleCallback, + callback + ) + } + } + } + } + + // parsedSafe doesn't work in > + app.get("$mainUrl/api/Sub/${loadData.epsId}").text.let { res -> + tryParseJson>(res)?.map { sub -> + subtitleCallback.invoke( + SubtitleFile( + getLanguage(sub.label ?: return@map), + sub.src ?: return@map + ) + ) + } + } + + return true + + } + + data class Data( + val title: String?, + val eps: Int?, + val id: Int?, + val epsId: Int?, + ) + + data class Sources( + @JsonProperty("Video") val video: String?, + @JsonProperty("ThirdParty") val thirdParty: String?, + ) + + data class Subtitle( + @JsonProperty("src") val src: String?, + @JsonProperty("label") val label: String?, + ) + + data class Responses( + @JsonProperty("data") val data: ArrayList? = arrayListOf(), + ) + + data class Media( + @JsonProperty("episodesCount") val episodesCount: Int?, + @JsonProperty("thumbnail") val thumbnail: String?, + @JsonProperty("id") val id: Int?, + @JsonProperty("title") val title: String?, + ) + + data class Episodes( + @JsonProperty("id") val id: Int?, + @JsonProperty("number") val number: Int?, + @JsonProperty("sub") val sub: Int?, + ) + + data class MediaDetail( + @JsonProperty("description") val description: String?, + @JsonProperty("releaseDate") val releaseDate: String?, + @JsonProperty("status") val status: String?, + @JsonProperty("type") val type: String?, + @JsonProperty("country") val country: String?, + @JsonProperty("episodes") val episodes: ArrayList? = arrayListOf(), + @JsonProperty("thumbnail") val thumbnail: String?, + @JsonProperty("id") val id: Int?, + @JsonProperty("title") val title: String?, + ) + +} diff --git a/KisskhProvider/src/main/kotlin/com/hexated/KisskhProviderPlugin.kt b/KisskhProvider/src/main/kotlin/com/hexated/KisskhProviderPlugin.kt new file mode 100644 index 00000000..70f05e71 --- /dev/null +++ b/KisskhProvider/src/main/kotlin/com/hexated/KisskhProviderPlugin.kt @@ -0,0 +1,14 @@ + +package com.hexated + +import com.lagradost.cloudstream3.plugins.CloudstreamPlugin +import com.lagradost.cloudstream3.plugins.Plugin +import android.content.Context + +@CloudstreamPlugin +class KisskhProviderPlugin: Plugin() { + override fun load(context: Context) { + // All providers should be added in this manner. Please don't edit the providers list directly. + registerMainAPI(KisskhProvider()) + } +} \ No newline at end of file diff --git a/KuramanimeProvider/build.gradle.kts b/KuramanimeProvider/build.gradle.kts new file mode 100644 index 00000000..4c82120c --- /dev/null +++ b/KuramanimeProvider/build.gradle.kts @@ -0,0 +1,27 @@ +// use an integer for version numbers +version = 2 + + +cloudstream { + language = "id" + // All of these properties are optional, you can safely remove them + + // description = "Lorem Ipsum" + authors = listOf("Hexated") + + /** + * Status int as the following: + * 0: Down + * 1: Ok + * 2: Slow + * 3: Beta only + * */ + status = 1 // will be 3 if unspecified + tvTypes = listOf( + "AnimeMovie", + "Anime", + "OVA", + ) + + iconUrl = "https://www.google.com/s2/favicons?domain=kuramanime.com&sz=%size%" +} \ No newline at end of file diff --git a/KuramanimeProvider/src/main/AndroidManifest.xml b/KuramanimeProvider/src/main/AndroidManifest.xml new file mode 100644 index 00000000..c98063f8 --- /dev/null +++ b/KuramanimeProvider/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/KuramanimeProvider/src/main/kotlin/com/hexated/KuramanimeProvider.kt b/KuramanimeProvider/src/main/kotlin/com/hexated/KuramanimeProvider.kt new file mode 100644 index 00000000..1edb9f0c --- /dev/null +++ b/KuramanimeProvider/src/main/kotlin/com/hexated/KuramanimeProvider.kt @@ -0,0 +1,164 @@ +package com.hexated + +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 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 { + val link = "$mainUrl/anime?search=$query&order_by=latest" + val document = app.get(link).document + + return document.select("div#animeList div.col-lg-4.col-md-6.col-sm-6").mapNotNull { + it.toSearchResult() + } + } + + 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, + headers = mapOf( + "Range" to "bytes=0-" + ) + ) + ) + } + } + + return true + } + +} \ No newline at end of file diff --git a/KuramanimeProvider/src/main/kotlin/com/hexated/KuramanimeProviderPlugin.kt b/KuramanimeProvider/src/main/kotlin/com/hexated/KuramanimeProviderPlugin.kt new file mode 100644 index 00000000..fe6b59a1 --- /dev/null +++ b/KuramanimeProvider/src/main/kotlin/com/hexated/KuramanimeProviderPlugin.kt @@ -0,0 +1,14 @@ + +package com.hexated + +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()) + } +} \ No newline at end of file diff --git a/KuronimeProvider/build.gradle.kts b/KuronimeProvider/build.gradle.kts new file mode 100644 index 00000000..51f46556 --- /dev/null +++ b/KuronimeProvider/build.gradle.kts @@ -0,0 +1,27 @@ +// use an integer for version numbers +version = 2 + + +cloudstream { + language = "id" + // All of these properties are optional, you can safely remove them + + // description = "Lorem Ipsum" + authors = listOf("Hexated") + + /** + * Status int as the following: + * 0: Down + * 1: Ok + * 2: Slow + * 3: Beta only + * */ + status = 1 // will be 3 if unspecified + tvTypes = listOf( + "AnimeMovie", + "Anime", + "OVA", + ) + + iconUrl = "https://www.google.com/s2/favicons?domain=45.12.2.2&sz=%size%" +} \ No newline at end of file diff --git a/KuronimeProvider/src/main/AndroidManifest.xml b/KuronimeProvider/src/main/AndroidManifest.xml new file mode 100644 index 00000000..c98063f8 --- /dev/null +++ b/KuronimeProvider/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/KuronimeProvider/src/main/kotlin/com/hexated/KuronimeProvider.kt b/KuronimeProvider/src/main/kotlin/com/hexated/KuronimeProvider.kt new file mode 100644 index 00000000..85a13423 --- /dev/null +++ b/KuronimeProvider/src/main/kotlin/com/hexated/KuronimeProvider.kt @@ -0,0 +1,197 @@ +package com.hexated + +import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer +import com.lagradost.cloudstream3.mvvm.safeApiCall +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.getQualityFromName +import com.lagradost.cloudstream3.utils.loadExtractor +import org.jsoup.Jsoup +import org.jsoup.nodes.Element + +class KuronimeProvider : MainAPI() { + override var mainUrl = "https://45.12.2.2" + override var name = "Kuronime" + 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) { + "Completed" -> ShowStatus.Completed + "Ongoing" -> ShowStatus.Ongoing + else -> ShowStatus.Completed + } + } + } + + override val mainPage = mainPageOf( + "$mainUrl/page/" to "New Episodes", + "$mainUrl/popular-anime/page/" to "Popular Anime", + "$mainUrl/movies/page/" to "Movies", + "$mainUrl/genres/donghua/page/" to "Donghua", + "$mainUrl/live-action/page/" to "Live Action", + ) + + override suspend fun getMainPage( + page: Int, + request: MainPageRequest + ): HomePageResponse { + val document = app.get(request.data + page).document + val home = document.select("article").map { + it.toSearchResult() + } + return newHomePageResponse(request.name, home) + } + + private fun getProperAnimeLink(uri: String): String { + return if (uri.contains("/anime/")) { + uri + } else { + var title = uri.substringAfter("$mainUrl/") + title = when { + (title.contains("-episode")) && !(title.contains("-movie")) -> Regex("nonton-(.+)-episode").find( + title + )?.groupValues?.get(1).toString() + (title.contains("-movie")) -> Regex("nonton-(.+)-movie").find(title)?.groupValues?.get( + 1 + ).toString() + else -> title + } + + "$mainUrl/anime/$title" + } + } + + private fun Element.toSearchResult(): AnimeSearchResponse { + val href = getProperAnimeLink(fixUrlNull(this.selectFirst("a")?.attr("href")).toString()) + val title = this.select(".bsuxtt, .tt > h4").text().trim() + val posterUrl = fixUrlNull( + this.selectFirst("div.view,div.bt")?.nextElementSibling()?.select("img") + ?.attr("data-src") + ) + val epNum = this.select(".ep").text().replace(Regex("[^0-9]"), "").trim().toIntOrNull() + val tvType = getType(this.selectFirst(".bt > span")?.text().toString()) + return newAnimeSearchResponse(title, href, tvType) { + this.posterUrl = posterUrl + addSub(epNum) + } + + } + + override suspend fun search(query: String): List { + val link = "$mainUrl/?s=$query" + val document = app.get(link).document + + return document.select("article.bs").map { + it.toSearchResult() + } + } + + override suspend fun load(url: String): LoadResponse { + val document = app.get(url).document + + val title = document.selectFirst(".entry-title")?.text().toString().trim() + val poster = document.selectFirst("div.l[itemprop=image] > img")?.attr("data-src") + val tags = document.select(".infodetail > ul > li:nth-child(2) > a").map { it.text() } + val type = getType( + document.selectFirst(".infodetail > ul > li:nth-child(7)")?.ownText()?.trim().toString() + ) + val trailer = document.selectFirst("div.tply iframe")?.attr("data-src") + val year = Regex("\\d, ([0-9]*)").find( + document.select(".infodetail > ul > li:nth-child(5)").text() + )?.groupValues?.get(1)?.toIntOrNull() + val status = getStatus( + document.selectFirst(".infodetail > ul > li:nth-child(3)")!!.ownText() + .replace(Regex("\\W"), "") + ) + val description = document.select("span.const > p").text() + + val episodes = document.select("div.bixbox.bxcl > ul > li").map { + val name = it.selectFirst("a")?.text()?.trim() + val episode = + it.selectFirst("a")?.text()?.trim()?.replace("Episode", "")?.trim()?.toIntOrNull() + val link = it.selectFirst("a")!!.attr("href") + Episode(link, name = name, episode = episode) + }.reversed() + + return newAnimeLoadResponse(title, url, type) { + engName = title + posterUrl = poster + this.year = year + addEpisodes(DubStatus.Subbed, episodes) + showStatus = status + plot = description + addTrailer(trailer) + this.tags = tags + } + } + + private suspend fun invokeKuroSource( + url: String, + sourceCallback: (ExtractorLink) -> Unit + ) { + val doc = app.get(url, referer = "${mainUrl}/").document + + doc.select("script").map { script -> + if (script.data().contains("function jalankan_jwp() {")) { + val data = script.data() + val doma = data.substringAfter("var doma = \"").substringBefore("\";") + val token = data.substringAfter("var token = \"").substringBefore("\";") + val pat = data.substringAfter("var pat = \"").substringBefore("\";") + val link = "$doma$token$pat/index.m3u8" + val quality = + Regex("\\d{3,4}p").find(doc.select("title").text())?.groupValues?.get(0) + + sourceCallback.invoke( + ExtractorLink( + this.name, + this.name, + link, + referer = "https://animeku.org/", + quality = getQualityFromName(quality), + headers = mapOf("Origin" to "https://animeku.org"), + isM3u8 = true + ) + ) + } + } + } + + override suspend fun loadLinks( + data: String, + isCasting: Boolean, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ): Boolean { + val document = app.get(data).document + val sources = document.select(".mobius > .mirror > option").mapNotNull { + fixUrl(Jsoup.parse(base64Decode(it.attr("value"))).select("iframe").attr("data-src")) + } + + sources.apmap { + safeApiCall { + when { + it.startsWith("https://animeku.org") -> invokeKuroSource(it, callback) + else -> loadExtractor(it, mainUrl, subtitleCallback, callback) + } + } + } + return true + } + +} \ No newline at end of file diff --git a/KuronimeProvider/src/main/kotlin/com/hexated/KuronimeProviderPlugin.kt b/KuronimeProvider/src/main/kotlin/com/hexated/KuronimeProviderPlugin.kt new file mode 100644 index 00000000..acbc54ef --- /dev/null +++ b/KuronimeProvider/src/main/kotlin/com/hexated/KuronimeProviderPlugin.kt @@ -0,0 +1,14 @@ + +package com.hexated + +import com.lagradost.cloudstream3.plugins.CloudstreamPlugin +import com.lagradost.cloudstream3.plugins.Plugin +import android.content.Context + +@CloudstreamPlugin +class KuronimeProviderPlugin: Plugin() { + override fun load(context: Context) { + // All providers should be added in this manner. Please don't edit the providers list directly. + registerMainAPI(KuronimeProvider()) + } +} \ No newline at end of file diff --git a/LayarKacaProvider/build.gradle.kts b/LayarKacaProvider/build.gradle.kts new file mode 100644 index 00000000..27c96ea7 --- /dev/null +++ b/LayarKacaProvider/build.gradle.kts @@ -0,0 +1,27 @@ +// use an integer for version numbers +version = 2 + + +cloudstream { + language = "id" + // All of these properties are optional, you can safely remove them + + // description = "Lorem Ipsum" + authors = listOf("Hexated") + + /** + * Status int as the following: + * 0: Down + * 1: Ok + * 2: Slow + * 3: Beta only + * */ + status = 1 // will be 3 if unspecified + tvTypes = listOf( + "AsianDrama", + "TvSeries", + "Movie", + ) + + iconUrl = "https://www.google.com/s2/favicons?domain=lk21.homes&sz=%size%" +} \ No newline at end of file diff --git a/LayarKacaProvider/src/main/AndroidManifest.xml b/LayarKacaProvider/src/main/AndroidManifest.xml new file mode 100644 index 00000000..c98063f8 --- /dev/null +++ b/LayarKacaProvider/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/LayarKacaProvider/src/main/kotlin/com/hexated/LayarKacaProvider.kt b/LayarKacaProvider/src/main/kotlin/com/hexated/LayarKacaProvider.kt new file mode 100644 index 00000000..09b37f2c --- /dev/null +++ b/LayarKacaProvider/src/main/kotlin/com/hexated/LayarKacaProvider.kt @@ -0,0 +1,176 @@ +package com.hexated + +import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.LoadResponse.Companion.addActors +import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.loadExtractor +import org.jsoup.Jsoup +import org.jsoup.nodes.Element + +class LayarKacaProvider : MainAPI() { + override var mainUrl = "https://lk21.homes" + override var name = "LayarKaca" + override val hasMainPage = true + override var lang = "id" + override val hasDownloadSupport = true + override val supportedTypes = setOf( + TvType.Movie, + TvType.TvSeries, + TvType.AsianDrama + ) + + override val mainPage = mainPageOf( + "$mainUrl/populer/page/" to "Film Terplopuler", + "$mainUrl/latest-series/page/" to "Series Terbaru", + "$mainUrl/series/asian/page/" to "Film Asian Terbaru", + "$mainUrl/latest/page/" to "Film Upload Terbaru", + ) + + override suspend fun getMainPage( + page: Int, + request: MainPageRequest + ): HomePageResponse { + val document = app.get(request.data + page).document + val home = document.select("article.mega-item").mapNotNull { + it.toSearchResult() + } + return newHomePageResponse(request.name, home) + } + + private fun Element.toSearchResult(): SearchResponse? { + val title = this.selectFirst("h1.grid-title > a")?.ownText()?.trim() ?: return null + val href = fixUrl(this.selectFirst("h1.grid-title > a")!!.attr("href")) + val posterUrl = fixUrlNull(this.selectFirst(".grid-poster > a > img")?.attr("src")) + val quality = this.select("div.quality").text().trim() + return newMovieSearchResponse(title, href, TvType.Movie) { + this.posterUrl = posterUrl + addQuality(quality) + } + } + + override suspend fun search(query: String): List { + val link = "$mainUrl/?s=$query" + val document = app.get(link).document + + return document.select("div.search-item").map { + val title = it.selectFirst("h2 > a")!!.text().trim() + val href = it.selectFirst("h2 > a")!!.attr("href") + val posterUrl = fixUrl(it.selectFirst("img.img-thumbnail")?.attr("src").toString()) + newTvSeriesSearchResponse(title, href, TvType.TvSeries) { + this.posterUrl = posterUrl + } + } + } + + override suspend fun load(url: String): LoadResponse { + val document = app.get(url).document + + val title = document.selectFirst("li.last > span[itemprop=name]")?.text()?.trim().toString() + val poster = fixUrl(document.select("img.img-thumbnail").attr("src").toString()) + val tags = document.select("div.content > div:nth-child(5) > h3 > a").map { it.text() } + + val year = Regex("\\d, (\\d+)").find( + document.select("div.content > div:nth-child(7) > h3").text().trim() + )?.groupValues?.get(1).toString().toIntOrNull() + val tvType = if (document.select("div.serial-wrapper") + .isNotEmpty() + ) TvType.TvSeries else TvType.Movie + val description = document.select("div.content > blockquote").text().trim() + val trailer = document.selectFirst("div.action-player li > a.fancybox")?.attr("href") + val rating = + document.selectFirst("div.content > div:nth-child(6) > h3")?.text()?.toRatingInt() + val actors = + document.select("div.col-xs-9.content > div:nth-child(3) > h3 > a").map { it.text() } + + val recommendations = document.select("div.row.item-media").map { + val recName = it.selectFirst("h3")?.text()?.trim().toString() + val recHref = it.selectFirst(".content-media > a")!!.attr("href") + val recPosterUrl = + fixUrl(it.selectFirst(".poster-media > a > img")?.attr("src").toString()) + newTvSeriesSearchResponse(recName, recHref, TvType.TvSeries) { + this.posterUrl = recPosterUrl + } + } + + return if (tvType == TvType.TvSeries) { + val episodes = document.select("div.episode-list > a:matches(\\d+)").map { + val href = fixUrl(it.attr("href")) + val episode = it.text().toIntOrNull() + val season = + it.attr("href").substringAfter("season-").substringBefore("-").toIntOrNull() + Episode( + href, + "Episode $episode", + season, + episode, + ) + }.reversed() + newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodes) { + this.posterUrl = poster + this.year = year + this.plot = description + this.tags = tags + this.rating = rating + addActors(actors) + this.recommendations = recommendations + addTrailer(trailer) + } + } else { + newMovieLoadResponse(title, url, TvType.Movie, url) { + this.posterUrl = poster + this.year = year + this.plot = description + this.tags = tags + this.rating = rating + addActors(actors) + this.recommendations = recommendations + addTrailer(trailer) + } + } + } + + override suspend fun loadLinks( + data: String, + isCasting: Boolean, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ): Boolean { + + val document = app.get(data).document + +// maybe will need this in future +// val sources = if (data.contains("-episode-")) { +// document.select("script").mapNotNull { script -> +// if (script.data().contains("var data =")) { +// val scriptData = +// script.toString().substringAfter("var data = '").substringBefore("';") +// Jsoup.parse(scriptData).select("li").map { +// fixUrl(it.select("a").attr("href")) +// } +// } else { +// null +// } +// }[0] +// } else { +// document.select("ul#loadProviders > li").map { +// fixUrl(it.select("a").attr("href")) +// } +// } + + document.select("ul#loadProviders > li").map { + fixUrl(it.select("a").attr("href")) + }.apmap { + val link = if (it.startsWith("https://layarkacaxxi.icu")) { + it.substringBeforeLast("/") + } else { + it + } + loadExtractor(link, data, subtitleCallback, callback) + } + + return true + } + + +} \ No newline at end of file diff --git a/LayarKacaProvider/src/main/kotlin/com/hexated/LayarKacaProviderPlugin.kt b/LayarKacaProvider/src/main/kotlin/com/hexated/LayarKacaProviderPlugin.kt new file mode 100644 index 00000000..9743b456 --- /dev/null +++ b/LayarKacaProvider/src/main/kotlin/com/hexated/LayarKacaProviderPlugin.kt @@ -0,0 +1,14 @@ + +package com.hexated + +import com.lagradost.cloudstream3.plugins.CloudstreamPlugin +import com.lagradost.cloudstream3.plugins.Plugin +import android.content.Context + +@CloudstreamPlugin +class LayarKacaProviderPlugin: Plugin() { + override fun load(context: Context) { + // All providers should be added in this manner. Please don't edit the providers list directly. + registerMainAPI(LayarKacaProvider()) + } +} \ No newline at end of file diff --git a/MultiplexProvider/build.gradle.kts b/MultiplexProvider/build.gradle.kts new file mode 100644 index 00000000..aaeb74f5 --- /dev/null +++ b/MultiplexProvider/build.gradle.kts @@ -0,0 +1,27 @@ +// use an integer for version numbers +version = 1 + + +cloudstream { + language = "id" + // All of these properties are optional, you can safely remove them + + // description = "Lorem Ipsum" + authors = listOf("Hexated") + + /** + * Status int as the following: + * 0: Down + * 1: Ok + * 2: Slow + * 3: Beta only + * */ + status = 1 // will be 3 if unspecified + tvTypes = listOf( + "AsianDrama", + "TvSeries", + "Movie", + ) + + iconUrl = "https://www.google.com/s2/favicons?domain=146.19.24.137&sz=%size%" +} \ No newline at end of file diff --git a/MultiplexProvider/src/main/AndroidManifest.xml b/MultiplexProvider/src/main/AndroidManifest.xml new file mode 100644 index 00000000..c98063f8 --- /dev/null +++ b/MultiplexProvider/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/MultiplexProvider/src/main/kotlin/com/hexated/MultiplexProvider.kt b/MultiplexProvider/src/main/kotlin/com/hexated/MultiplexProvider.kt new file mode 100644 index 00000000..851c267e --- /dev/null +++ b/MultiplexProvider/src/main/kotlin/com/hexated/MultiplexProvider.kt @@ -0,0 +1,188 @@ +package com.hexated + +import com.fasterxml.jackson.annotation.JsonProperty +import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.LoadResponse.Companion.addActors +import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer +import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.getQualityFromName +import org.jsoup.nodes.Element + +class MultiplexProvider : MainAPI() { + override var mainUrl = "https://146.19.24.137" + override var name = "Multiplex" + override val hasMainPage = true + override var lang = "id" + override val hasDownloadSupport = true + override val supportedTypes = setOf( + TvType.Movie, + TvType.TvSeries, + TvType.AsianDrama + ) + + override val mainPage = mainPageOf( + "$mainUrl/genre/top-popular-movies/page/" to "Top Popolar Movies", + "$mainUrl/genre/series-ongoing/page/" to "Series Ongoing", + "$mainUrl/genre/series-barat/page/" to "Series Barat", + "$mainUrl/genre/series-korea/page/" to "Series Korea", + ) + + override suspend fun getMainPage( + page: Int, + request: MainPageRequest + ): HomePageResponse { + val document = app.get(request.data + page).document + val home = document.select("article.item").mapNotNull { + it.toSearchResult() + } + return newHomePageResponse(request.name, home) + } + + private fun Element.toSearchResult(): SearchResponse? { + val title = this.selectFirst("h2.entry-title > a")?.text()?.trim() ?: return null + val href = fixUrl(this.selectFirst("a")!!.attr("href")) + val posterUrl = fixUrlNull(this.selectFirst("a > img")?.attr("data-src")) + val quality = this.select("div.gmr-quality-item > a").text().trim() + return if (quality.isEmpty()) { + val episode = this.select("div.gmr-numbeps > span").text().toIntOrNull() + newAnimeSearchResponse(title, href, TvType.TvSeries) { + this.posterUrl = posterUrl + addSub(episode) + } + } else { + newMovieSearchResponse(title, href, TvType.Movie) { + this.posterUrl = posterUrl + addQuality(quality) + } + } + } + + private fun Element.toBottomSearchResult(): SearchResponse? { + val title = this.selectFirst("a > span.idmuvi-rp-title")?.text()?.trim() ?: return null + val href = this.selectFirst("a")!!.attr("href") + val posterUrl = fixUrl(this.selectFirst("a > img")?.attr("data-src").toString()) + return newMovieSearchResponse(title, href, TvType.Movie) { + this.posterUrl = posterUrl + } + } + + override suspend fun search(query: String): List { + val link = "$mainUrl/?s=$query&post_type[]=post&post_type[]=tv" + val document = app.get(link).document + return document.select("article.item").mapNotNull { + it.toSearchResult() + } + } + + override suspend fun load(url: String): LoadResponse { + val document = app.get(url).document + + val title = + document.selectFirst("h1.entry-title")?.text()?.substringBefore("Season")?.trim() + .toString() + val poster = + fixUrl(document.selectFirst("figure.pull-left > img")?.attr("data-src").toString()) + val tags = document.select("span.gmr-movie-genre:contains(Genre:) > a").map { it.text() } + + val year = + document.select("span.gmr-movie-genre:contains(Year:) > a").text().trim().toIntOrNull() + val tvType = if (url.contains("/tv/")) TvType.TvSeries else TvType.Movie + val description = document.selectFirst("div[itemprop=description] > p")?.text()?.trim() + val trailer = document.selectFirst("ul.gmr-player-nav li a.gmr-trailer-popup")?.attr("href") + val rating = + document.selectFirst("div.gmr-meta-rating > span[itemprop=ratingValue]")?.text() + ?.toRatingInt() + val actors = document.select("div.gmr-moviedata").last()?.select("span[itemprop=actors]") + ?.map { it.select("a").text() } + + val recommendations = document.select("div.idmuvi-rp ul li").mapNotNull { + it.toBottomSearchResult() + } + + return if (tvType == TvType.TvSeries) { + val episodes = document.select("div.gmr-listseries > a").map { + val href = fixUrl(it.attr("href")) + val episode = it.text().split(" ").last().toIntOrNull() + val season = it.text().split(" ").first().substringAfter("S").toIntOrNull() + Episode( + href, + "Episode $episode", + season, + episode, + ) + } + newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodes) { + this.posterUrl = poster + this.year = year + this.plot = description + this.tags = tags + this.rating = rating + addActors(actors) + this.recommendations = recommendations + addTrailer(trailer) + } + } else { + newMovieLoadResponse(title, url, TvType.Movie, url) { + this.posterUrl = poster + this.year = year + this.plot = description + this.tags = tags + this.rating = rating + addActors(actors) + this.recommendations = recommendations + addTrailer(trailer) + } + } + } + + private data class ResponseSource( + @JsonProperty("file") val file: String, + @JsonProperty("type") val type: String?, + @JsonProperty("label") val label: String? + ) + + override suspend fun loadLinks( + data: String, + isCasting: Boolean, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ): Boolean { + + val document = app.get(data).document + + val id = document.selectFirst("div#muvipro_player_content_id")!!.attr("data-id") + val server = app.post( + "$mainUrl/wp-admin/admin-ajax.php", + data = mapOf("action" to "muvipro_player_content", "tab" to "player1", "post_id" to id) + ).document.select("iframe").attr("src") + + app.get(server, referer = "$mainUrl/").document.select("script").map { script -> + if (script.data().contains("var config = {")) { + val source = script.data().substringAfter("sources: [").substringBefore("],") + tryParseJson>("[$source]")?.map { m3u -> + val m3uData = app.get(m3u.file, referer = "https://gdriveplayer.link/").text + val quality = + Regex("\\d{3,4}\\.m3u8").findAll(m3uData).map { it.value }.toList() + quality.forEach { + callback.invoke( + ExtractorLink( + source = name, + name = name, + url = m3u.file.replace("video.m3u8", it), + referer = "https://gdriveplayer.link/", + quality = getQualityFromName("${it.replace(".m3u8", "")}p"), + isM3u8 = true + ) + ) + } + } + } + } + + return true + + } + + +} \ No newline at end of file diff --git a/MultiplexProvider/src/main/kotlin/com/hexated/MultiplexProviderPlugin.kt b/MultiplexProvider/src/main/kotlin/com/hexated/MultiplexProviderPlugin.kt new file mode 100644 index 00000000..f689b83f --- /dev/null +++ b/MultiplexProvider/src/main/kotlin/com/hexated/MultiplexProviderPlugin.kt @@ -0,0 +1,14 @@ + +package com.hexated + +import com.lagradost.cloudstream3.plugins.CloudstreamPlugin +import com.lagradost.cloudstream3.plugins.Plugin +import android.content.Context + +@CloudstreamPlugin +class MultiplexProviderPlugin: Plugin() { + override fun load(context: Context) { + // All providers should be added in this manner. Please don't edit the providers list directly. + registerMainAPI(MultiplexProvider()) + } +} \ No newline at end of file diff --git a/NeonimeProvider/build.gradle.kts b/NeonimeProvider/build.gradle.kts new file mode 100644 index 00000000..e9d0e72a --- /dev/null +++ b/NeonimeProvider/build.gradle.kts @@ -0,0 +1,28 @@ +// use an integer for version numbers +version = 1 + + +cloudstream { + language = "id" + // All of these properties are optional, you can safely remove them + + // description = "Lorem Ipsum" + authors = listOf("Hexated") + + /** + * Status int as the following: + * 0: Down + * 1: Ok + * 2: Slow + * 3: Beta only + * */ + status = 1 // will be 3 if unspecified + tvTypes = listOf( + "AnimeMovie", + "Anime", + "Movie", + "OVA", + ) + + iconUrl = "https://www.google.com/s2/favicons?domain=neonime.watch&sz=%size%" +} \ No newline at end of file diff --git a/NeonimeProvider/src/main/AndroidManifest.xml b/NeonimeProvider/src/main/AndroidManifest.xml new file mode 100644 index 00000000..c98063f8 --- /dev/null +++ b/NeonimeProvider/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/NeonimeProvider/src/main/kotlin/com/hexated/NeonimeProvider.kt b/NeonimeProvider/src/main/kotlin/com/hexated/NeonimeProvider.kt new file mode 100644 index 00000000..b86f43f0 --- /dev/null +++ b/NeonimeProvider/src/main/kotlin/com/hexated/NeonimeProvider.kt @@ -0,0 +1,178 @@ +package com.hexated + +import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.loadExtractor +import org.jsoup.nodes.Element +import java.util.* + +class NeonimeProvider : MainAPI() { + override var mainUrl = "https://neonime.watch" + override var name = "Neonime" + 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) { + "Ended" -> ShowStatus.Completed + "OnGoing" -> ShowStatus.Ongoing + "Ongoing" -> ShowStatus.Ongoing + "In Production" -> ShowStatus.Ongoing + "Returning Series" -> ShowStatus.Ongoing + else -> ShowStatus.Completed + } + } + } + + override val mainPage = mainPageOf( + "$mainUrl/episode/page/" to "Episode Terbaru", + "$mainUrl/tvshows/page/" to "Anime Terbaru", + "$mainUrl/movies/page/" to "Movie", + ) + + override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse { + val document = app.get(request.data + page).document + val home = document.select("tbody tr,div.item").mapNotNull { + it.toSearchResult() + } + return newHomePageResponse(request.name, home) + } + + private fun getProperAnimeLink(uri: String): String { + return when { + uri.contains("/episode") -> { + val title = uri.substringAfter("$mainUrl/episode/").let { tt -> + val fixTitle = Regex("(.*)-\\d{1,2}x\\d+").find(tt)?.groupValues?.getOrNull(1).toString() + when { + !tt.contains("-season") && !tt.contains(Regex("-1x\\d+")) && !tt.contains("one-piece") -> "$fixTitle-season-${Regex("-(\\d{1,2})x\\d+").find(tt)?.groupValues?.getOrNull(1).toString()}" + tt.contains("-special") -> fixTitle.replace(Regex("-x\\d+"), "") + !fixTitle.contains("-subtitle-indonesia") -> "$fixTitle-subtitle-indonesia" + else -> fixTitle + } + } + +// title = when { +// title.contains("youkoso-jitsuryoku") && !title.contains("-season") -> title.replace("-e-", "-e-tv-") +// else -> title +// } + + "$mainUrl/tvshows/$title" + } + else -> uri + } + } + + private fun Element.toSearchResult(): AnimeSearchResponse? { + val title = this.selectFirst("td.bb a")?.ownText() ?: this.selectFirst("h2")?.text() ?: return null + val href = getProperAnimeLink(fixUrl(this.select("a").attr("href"))) + val posterUrl = fixUrl(this.select("img").attr("data-src")) + val epNum = this.selectFirst("td.bb span")?.text()?.let { eps -> + Regex("Episode\\s?([0-9]+)").find(eps)?.groupValues?.getOrNull(1)?.toIntOrNull() + } + + return newAnimeSearchResponse(title, href, TvType.Anime) { + this.posterUrl = posterUrl + addSub(epNum) + } + + } + + override suspend fun search(query: String): List { + val link = "$mainUrl/?s=$query" + val document = app.get(link).document + + return document.select("div.item.episode-home").mapNotNull { + val title = it.selectFirst("div.judul-anime > span")!!.text() + val poster = it.select("img").attr("data-src").toString().trim() + val episodes = it.selectFirst("div.fixyear > h2.text-center")!! + .text().replace(Regex("[^0-9]"), "").trim().toIntOrNull() + val tvType = getType(it.selectFirst("span.calidad2.episode")?.text().toString()) + val href = getProperAnimeLink(fixUrl(it.selectFirst("a")!!.attr("href"))) + + newAnimeSearchResponse(title, href, tvType) { + this.posterUrl = poster + addSub(episodes) + } + } + } + + override suspend fun load(url: String): LoadResponse { + val document = app.get(url).document + + if (url.contains("movie") || url.contains("live-action")) { + val mTitle = document.selectFirst(".sbox > .data > h1[itemprop = name]")?.text().toString().trim() + val mTrailer = document.selectFirst("div.youtube_id iframe")?.attr("data-wpfc-original-src")?.substringAfterLast("html#")?.let{ "https://www.youtube.com/embed/$it"} + + return newMovieLoadResponse(name = mTitle, url = url, type = TvType.Movie, dataUrl = url) { + posterUrl = document.selectFirst(".sbox > .imagen > .fix > img[itemprop = image]")?.attr("data-src") + year = document.selectFirst("a[href*=release-year]")!!.text().toIntOrNull() + plot = document.select("div[itemprop = description]").text().trim() + rating = document.select("span[itemprop = ratingValue]").text().toIntOrNull() + tags = document.select("p.meta_dd > a").map { it.text() } + addTrailer(mTrailer) + } + } + else { + val title = document.select("h1[itemprop = name]").text().trim() + val trailer = document.selectFirst("div.youtube_id_tv iframe")?.attr("data-wpfc-original-src")?.substringAfterLast("html#")?.let{ "https://www.youtube.com/embed/$it"} + + val episodes = document.select("ul.episodios > li").mapNotNull { + val header = it.selectFirst(".episodiotitle > a")?.ownText().toString() + val name = Regex("(Episode\\s?[0-9]+)").find(header)?.groupValues?.getOrNull(0) ?: header + val link = fixUrl(it.selectFirst(".episodiotitle > a")!!.attr("href")) + Episode(link, name) + }.reversed() + + return newAnimeLoadResponse(title, url, TvType.Anime) { + engName = title + posterUrl = document.selectFirst(".imagen > img")?.attr("data-src") + year = document.select("#info a[href*=\"-year/\"]").text().toIntOrNull() + addEpisodes(DubStatus.Subbed, episodes) + showStatus = getStatus(document.select("div.metadatac > span").last()!!.text().trim()) + plot = document.select("div[itemprop = description] > p").text().trim() + tags = document.select("#info a[href*=\"-genre/\"]").map { it.text() } + addTrailer(trailer) + } + } + } + + override suspend fun loadLinks( + data: String, + isCasting: Boolean, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ): Boolean { + val source = if(data.contains("movie") || data.contains("live-action")) { + app.get(data).document.select("#player2-1 > div[id*=div]").mapNotNull { + fixUrl(it.select("iframe").attr("data-src")) + } + } else { + app.get(data).document.select(".player2 > .embed2 > div[id*=player]").mapNotNull { + fixUrl(it.select("iframe").attr("data-src")) + } + } + + source.apmap { + loadExtractor(it, data, subtitleCallback, callback) + } + + return true + } + +} \ No newline at end of file diff --git a/NeonimeProvider/src/main/kotlin/com/hexated/NeonimeProviderPlugin.kt b/NeonimeProvider/src/main/kotlin/com/hexated/NeonimeProviderPlugin.kt new file mode 100644 index 00000000..9a6be431 --- /dev/null +++ b/NeonimeProvider/src/main/kotlin/com/hexated/NeonimeProviderPlugin.kt @@ -0,0 +1,14 @@ + +package com.hexated + +import com.lagradost.cloudstream3.plugins.CloudstreamPlugin +import com.lagradost.cloudstream3.plugins.Plugin +import android.content.Context + +@CloudstreamPlugin +class NeonimeProviderPlugin: Plugin() { + override fun load(context: Context) { + // All providers should be added in this manner. Please don't edit the providers list directly. + registerMainAPI(NeonimeProvider()) + } +} \ No newline at end of file diff --git a/NontonAnimeIDProvider/build.gradle.kts b/NontonAnimeIDProvider/build.gradle.kts new file mode 100644 index 00000000..3407d449 --- /dev/null +++ b/NontonAnimeIDProvider/build.gradle.kts @@ -0,0 +1,27 @@ +// use an integer for version numbers +version = 3 + + +cloudstream { + language = "id" + // All of these properties are optional, you can safely remove them + + // description = "Lorem Ipsum" + authors = listOf("Hexated") + + /** + * Status int as the following: + * 0: Down + * 1: Ok + * 2: Slow + * 3: Beta only + * */ + status = 1 // will be 3 if unspecified + tvTypes = listOf( + "AnimeMovie", + "Anime", + "OVA", + ) + + iconUrl = "https://www.google.com/s2/favicons?domain=75.119.159.228&sz=%size%" +} \ No newline at end of file diff --git a/NontonAnimeIDProvider/src/main/AndroidManifest.xml b/NontonAnimeIDProvider/src/main/AndroidManifest.xml new file mode 100644 index 00000000..c98063f8 --- /dev/null +++ b/NontonAnimeIDProvider/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/NontonAnimeIDProvider/src/main/kotlin/com/hexated/NontonAnimeIDProvider.kt b/NontonAnimeIDProvider/src/main/kotlin/com/hexated/NontonAnimeIDProvider.kt new file mode 100644 index 00000000..3e3389cd --- /dev/null +++ b/NontonAnimeIDProvider/src/main/kotlin/com/hexated/NontonAnimeIDProvider.kt @@ -0,0 +1,257 @@ +package com.hexated + +import com.fasterxml.jackson.annotation.JsonProperty +import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.loadExtractor +import org.jsoup.Jsoup +import org.jsoup.nodes.Element + +class NontonAnimeIDProvider : MainAPI() { + override var mainUrl = "https://75.119.159.228" + override var name = "NontonAnimeID" + 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 when { + t.contains("TV") -> TvType.Anime + t.contains("Movie") -> TvType.AnimeMovie + else -> TvType.OVA + } + } + + fun getStatus(t: String): ShowStatus { + return when (t) { + "Finished Airing" -> ShowStatus.Completed + "Currently Airing" -> ShowStatus.Ongoing + else -> ShowStatus.Completed + } + } + } + + override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse { + val document = app.get(mainUrl).document + + val homePageList = ArrayList() + + document.select("section#postbaru").forEach { block -> + val header = block.selectFirst("h2")!!.text().trim() + val animes = block.select("article.animeseries").mapNotNull { + it.toSearchResult() + } + if (animes.isNotEmpty()) homePageList.add(HomePageList(header, animes)) + } + + document.select("aside#sidebar_right > div.side").forEach { block -> + val header = block.selectFirst("h3")!!.ownText().trim() + val animes = block.select("ul li.fullwdth").mapNotNull { + it.toSearchResultPopular() + } + if (animes.isNotEmpty()) homePageList.add(HomePageList(header, animes)) + } + + return HomePageResponse(homePageList) + } + + private fun getProperAnimeLink(uri: String): String { + return if (uri.contains("/anime/")) { + uri + } else { + var title = uri.substringAfter("$mainUrl/") + val fixTitle = Regex("(.*)-episode.*").find(title)?.groupValues?.getOrNull(1).toString() + title = when { + title.contains("utawarerumono-season-3") -> fixTitle.replace( + "season-3", + "futari-no-hakuoro" + ) + title.contains("kingdom-season-4") -> fixTitle.replace("season-4", "4th-season") + title.contains("maou-sama-season-2") -> fixTitle.replace("season-2", "2") + title.contains("overlord-season-4") -> fixTitle.replace("season-4", "iv") + title.contains("kyoushitsu-e-season-2") -> fixTitle.replace( + "kyoushitsu-e-season-2", + "kyoushitsu-e-tv-2nd-season" + ) + title.contains("season-2") -> fixTitle.replace("season-2", "2nd-season") + title.contains("season-3") -> fixTitle.replace("season-3", "3rd-season") + title.contains("movie") -> title.substringBefore("-movie") + else -> fixTitle + } + "$mainUrl/anime/$title" + } + } + + private fun Element.toSearchResult(): AnimeSearchResponse? { + val href = getProperAnimeLink(fixUrl(this.selectFirst("a")!!.attr("href"))) + val title = this.selectFirst("h3.title")?.text() ?: return null + val posterUrl = fixUrl(this.select("img").attr("data-src")) + + return newAnimeSearchResponse(title, href, TvType.Anime) { + this.posterUrl = posterUrl + addDubStatus(dubExist = false, subExist = true) + } + + } + + private fun Element.toSearchResultPopular(): AnimeSearchResponse? { + val href = getProperAnimeLink(fixUrl(this.selectFirst("a")!!.attr("href"))) + val title = this.selectFirst("h4")?.text()?.trim() ?: return null + val posterUrl = fixUrl(this.select("img").attr("data-src")) + + return newAnimeSearchResponse(title, href, TvType.Anime) { + this.posterUrl = posterUrl + addDubStatus(dubExist = false, subExist = true) + } + + } + + override suspend fun search(query: String): List { + val link = "$mainUrl/?s=$query" + val document = app.get(link).document + + return document.select(".result > ul > li").mapNotNull { + val title = it.selectFirst("h2")!!.text().trim() + val poster = it.selectFirst("img")!!.attr("src") + val tvType = getType( + it.selectFirst(".boxinfores > span.typeseries")!!.text().toString() + ) + val href = fixUrl(it.selectFirst("a")!!.attr("href")) + + newAnimeSearchResponse(title, href, tvType) { + this.posterUrl = poster + addDubStatus(dubExist = false, subExist = true) + } + } + } + + private data class EpResponse( + @JsonProperty("posts") val posts: String?, + @JsonProperty("max_page") val max_page: Int?, + @JsonProperty("found_posts") val found_posts: Int?, + @JsonProperty("content") val content: String + ) + + override suspend fun load(url: String): LoadResponse { + val document = app.get(url).document + + val title = document.selectFirst("h1.entry-title.cs")!!.text().trim() + val poster = document.selectFirst(".poster > img")?.attr("data-src") + val tags = document.select(".tagline > a").map { it.text() } + + val year = Regex("\\d, ([0-9]*)").find( + document.select(".bottomtitle > span:nth-child(5)").text() + )?.groupValues?.get(1)?.toIntOrNull() + val status = getStatus( + document.select("span.statusseries").text().trim() + ) + val type = getType(document.select("span.typeseries").text().trim()) + val rating = document.select("span.nilaiseries").text().trim().toIntOrNull() + val description = document.select(".entry-content.seriesdesc > p").text().trim() + val trailer = document.selectFirst("a.trailerbutton")?.attr("href") + + val episodes = if (document.select("button.buttfilter").isNotEmpty()) { + val id = document.select("input[name=series_id]").attr("value") + val numEp = + document.selectFirst(".latestepisode > a")?.text()?.replace(Regex("[^0-9]"), "") + .toString() + Jsoup.parse( + app.post( + url = "$mainUrl/wp-admin/admin-ajax.php", + data = mapOf( + "misha_number_of_results" to numEp, + "misha_order_by" to "date-DESC", + "action" to "mishafilter", + "series_id" to id + ) + ).parsed().content + ).select("li").map { + val name = Regex("(Episode\\s?[0-9]+)").find( + it.selectFirst("a")?.text().toString() + )?.groupValues?.getOrNull(0) ?: it.selectFirst("a")?.text() + val link = fixUrl(it.selectFirst("a")!!.attr("href")) + Episode(link, name) + }.reversed() + } else { + document.select("ul.misha_posts_wrap2 > li").map { + val name = Regex("(Episode\\s?[0-9]+)").find( + it.selectFirst("a")?.text().toString() + )?.groupValues?.getOrNull(0) ?: it.selectFirst("a")?.text() + val link = it.select("a").attr("href") + Episode(link, name) + }.reversed() + } + + + val recommendations = document.select(".result > li").mapNotNull { + val epHref = it.selectFirst("a")!!.attr("href") + val epTitle = it.selectFirst("h3")!!.text() + val epPoster = it.select(".top > img").attr("data-src") + + newAnimeSearchResponse(epTitle, epHref, TvType.Anime) { + this.posterUrl = epPoster + addDubStatus(dubExist = false, subExist = true) + } + } + + return newAnimeLoadResponse(title, url, type) { + engName = title + posterUrl = poster + this.year = year + addEpisodes(DubStatus.Subbed, episodes) + showStatus = status + this.rating = rating + plot = description + addTrailer(trailer) + this.tags = tags + this.recommendations = recommendations + } + + } + + override suspend fun loadLinks( + data: String, + isCasting: Boolean, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ): Boolean { + + val document = app.get(data).document + val sources = ArrayList() + + document.select(".container1 > ul > li:not(.boxtab)").apmap { + val dataPost = it.attr("data-post") + val dataNume = it.attr("data-nume") + val dataType = it.attr("data-type") + + val iframe = app.post( + url = "$mainUrl/wp-admin/admin-ajax.php", + data = mapOf( + "action" to "player_ajax", + "post" to dataPost, + "nume" to dataNume, + "type" to dataType + ), + referer = data, + headers = mapOf("X-Requested-With" to "XMLHttpRequest") + ).document.select("iframe").attr("src") + + sources.add(fixUrl(iframe)) + } + + sources.apmap { + loadExtractor(it, "$mainUrl/", subtitleCallback, callback) + } + + return true + } +} diff --git a/NontonAnimeIDProvider/src/main/kotlin/com/hexated/NontonAnimeIDProviderPlugin.kt b/NontonAnimeIDProvider/src/main/kotlin/com/hexated/NontonAnimeIDProviderPlugin.kt new file mode 100644 index 00000000..748c030e --- /dev/null +++ b/NontonAnimeIDProvider/src/main/kotlin/com/hexated/NontonAnimeIDProviderPlugin.kt @@ -0,0 +1,14 @@ + +package com.hexated + +import com.lagradost.cloudstream3.plugins.CloudstreamPlugin +import com.lagradost.cloudstream3.plugins.Plugin +import android.content.Context + +@CloudstreamPlugin +class NontonAnimeIDProviderPlugin: Plugin() { + override fun load(context: Context) { + // All providers should be added in this manner. Please don't edit the providers list directly. + registerMainAPI(NontonAnimeIDProvider()) + } +} \ No newline at end of file diff --git a/OploverzProvider/build.gradle.kts b/OploverzProvider/build.gradle.kts new file mode 100644 index 00000000..aafc3f95 --- /dev/null +++ b/OploverzProvider/build.gradle.kts @@ -0,0 +1,27 @@ +// use an integer for version numbers +version = 1 + + +cloudstream { + language = "id" + // All of these properties are optional, you can safely remove them + + // description = "Lorem Ipsum" + authors = listOf("Hexated") + + /** + * Status int as the following: + * 0: Down + * 1: Ok + * 2: Slow + * 3: Beta only + * */ + status = 1 // will be 3 if unspecified + tvTypes = listOf( + "AnimeMovie", + "Anime", + "OVA", + ) + + iconUrl = "https://www.google.com/s2/favicons?domain=65.108.132.145&sz=%size%" +} \ No newline at end of file diff --git a/OploverzProvider/src/main/AndroidManifest.xml b/OploverzProvider/src/main/AndroidManifest.xml new file mode 100644 index 00000000..c98063f8 --- /dev/null +++ b/OploverzProvider/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/OploverzProvider/src/main/kotlin/com/hexated/OploverzProvider.kt b/OploverzProvider/src/main/kotlin/com/hexated/OploverzProvider.kt new file mode 100644 index 00000000..14c5c0b5 --- /dev/null +++ b/OploverzProvider/src/main/kotlin/com/hexated/OploverzProvider.kt @@ -0,0 +1,203 @@ +package com.hexated + +import com.fasterxml.jackson.annotation.JsonProperty +import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer +import com.lagradost.cloudstream3.utils.* +import org.jsoup.Jsoup +import org.jsoup.nodes.Element +import java.util.ArrayList + + +class OploverzProvider : MainAPI() { + override var mainUrl = "https://65.108.132.145" + override var name = "Oploverz" + 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 when { + t.contains("TV") -> TvType.Anime + t.contains("Movie") -> TvType.AnimeMovie + else -> TvType.OVA + } + } + + fun getStatus(t: String): ShowStatus { + return when (t) { + "Completed" -> ShowStatus.Completed + "Ongoing" -> ShowStatus.Ongoing + else -> ShowStatus.Completed + } + } + } + + override val mainPage = mainPageOf( + "&status=&type=&order=update" to "Episode Terbaru", + "&status=&type=&order=latest" to "Anime Terbaru", + "&sub=&order=popular" to "Popular Anime", + ) + + override suspend fun getMainPage( + page: Int, + request: MainPageRequest + ): HomePageResponse { + val document = app.get("$mainUrl/anime/?page=$page${request.data}").document + val home = document.select("article[itemscope=itemscope]").mapNotNull { + it.toSearchResult() + } + return newHomePageResponse(request.name, home) + } + + private fun getProperAnimeLink(uri: String): String { + + return if (uri.contains("/anime/")) { + uri + } else { + var title = uri.substringAfter("$mainUrl/") + title = when { + (title.contains("-episode")) && !(title.contains("-ova")) -> Regex("(.+)-episode").find( + title + )?.groupValues?.get(1).toString() + (title.contains("-ova")) -> Regex("(.+)-ova").find(title)?.groupValues?.get(1) + .toString() + (title.contains("-movie")) -> Regex("(.+)-subtitle").find(title)?.groupValues?.get(1) + .toString() + else -> Regex("(.+)-subtitle").find(title)?.groupValues?.get(1).toString() + .replace(Regex("-\\d+"), "") + } + + when { + title.contains("overlord") -> { + title = title.replace("s", "season-") + } + title.contains("kaguya-sama") -> { + title = title.replace("s3", "ultra-romantic") + } + } + + "$mainUrl/anime/$title" + } + + } + + private fun Element.toSearchResult(): AnimeSearchResponse? { + val href = getProperAnimeLink(this.selectFirst("a.tip")!!.attr("href")) + val title = this.selectFirst("h2[itemprop=headline]")?.text()?.trim() ?: return null + val posterUrl = fixUrlNull(this.selectFirst("img")?.attr("src")) + val type = getType(this.selectFirst(".eggtype, .typez")?.text()?.trim().toString()) + + return newAnimeSearchResponse(title, href, type) { + this.posterUrl = posterUrl + } + } + + override suspend fun search(query: String): List { + val link = "$mainUrl/?s=$query" + val document = app.get(link).document + + return document.select("article[itemscope=itemscope]").map { + val title = it.selectFirst(".tt")?.ownText()?.trim().toString() + val poster = fixUrlNull(it.selectFirst("img")?.attr("src")) + val tvType = getType(it.selectFirst(".typez")?.text().toString()) + val href = fixUrl(it.selectFirst("a.tip")!!.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("h1.entry-title")!!.text().trim() + val poster = document.select(".thumb > img").attr("src") + val tags = document.select(".genxed > a").map { it.text() } + + val year = Regex("\\d, ([0-9]*)").find( + document.selectFirst(".info-content > .spe > span > time")!!.text().trim() + )?.groupValues?.get(1).toString().toIntOrNull() + val status = getStatus( + document.select(".info-content > .spe > span:nth-child(1)") + .text().trim().replace("Status: ", "") + ) + val typeCheck = + when (document.select(".info-content > .spe > span:nth-child(5), .info-content > .spe > span") + .text().trim()) { + "OVA" -> "OVA" + "Movie" -> "Movie" + else -> "TV" + } + val type = getType(typeCheck) + val description = document.select(".entry-content > p").text().trim() + val trailer = document.selectFirst("a.trailerbutton")?.attr("href") + + val episodes = document.select(".eplister > ul > li").map { + val header = it.select(".epl-title").text() + val name = + Regex("(Episode\\s?[0-9]+)").find(header)?.groupValues?.getOrNull(0) ?: header + val link = fixUrl(it.select("a").attr("href")) + Episode(link, name) + }.reversed() + + val recommendations = + document.select(".listupd > article[itemscope=itemscope]").mapNotNull { rec -> + val epTitle = rec.selectFirst(".tt")!!.ownText().trim() + val epPoster = rec.selectFirst("img")!!.attr("src") + val epType = getType(rec.selectFirst(".typez")?.text().toString()) + val epHref = fixUrl(rec.selectFirst("a.tip")!!.attr("href")) + + newAnimeSearchResponse(epTitle, epHref, epType) { + this.posterUrl = epPoster + addDubStatus(dubExist = false, subExist = true) + } + } + + return newAnimeLoadResponse(title, url, type) { + engName = title + posterUrl = poster + this.year = year + addEpisodes(DubStatus.Subbed, episodes) + showStatus = status + plot = description + this.tags = tags + this.recommendations = recommendations + addTrailer(trailer) + } + + } + + data class Source( + @JsonProperty("play_url") val play_url: String, + @JsonProperty("format_id") val format_id: Int + ) + + override suspend fun loadLinks( + data: String, + isCasting: Boolean, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ): Boolean { + val document = app.get(data).document + val sources = document.select(".mobius > .mirror > option").mapNotNull { + fixUrl(Jsoup.parse(base64Decode(it.attr("value"))).select("iframe").attr("src")) + } + + sources.apmap { + loadExtractor(it, data, subtitleCallback, callback) + } + + return true + } + +} \ No newline at end of file diff --git a/OploverzProvider/src/main/kotlin/com/hexated/OploverzProviderPlugin.kt b/OploverzProvider/src/main/kotlin/com/hexated/OploverzProviderPlugin.kt new file mode 100644 index 00000000..157869bd --- /dev/null +++ b/OploverzProvider/src/main/kotlin/com/hexated/OploverzProviderPlugin.kt @@ -0,0 +1,14 @@ + +package com.hexated + +import com.lagradost.cloudstream3.plugins.CloudstreamPlugin +import com.lagradost.cloudstream3.plugins.Plugin +import android.content.Context + +@CloudstreamPlugin +class OploverzProviderPlugin: Plugin() { + override fun load(context: Context) { + // All providers should be added in this manner. Please don't edit the providers list directly. + registerMainAPI(OploverzProvider()) + } +} \ No newline at end of file diff --git a/OtakudesuProvider/build.gradle.kts b/OtakudesuProvider/build.gradle.kts new file mode 100644 index 00000000..6c3e2594 --- /dev/null +++ b/OtakudesuProvider/build.gradle.kts @@ -0,0 +1,27 @@ +// use an integer for version numbers +version = 1 + + +cloudstream { + language = "id" + // All of these properties are optional, you can safely remove them + + // description = "Lorem Ipsum" + authors = listOf("Hexated") + + /** + * Status int as the following: + * 0: Down + * 1: Ok + * 2: Slow + * 3: Beta only + * */ + status = 1 // will be 3 if unspecified + tvTypes = listOf( + "AnimeMovie", + "Anime", + "OVA", + ) + + iconUrl = "https://www.google.com/s2/favicons?domain=otakudesu.watch&sz=%size%" +} \ No newline at end of file diff --git a/OtakudesuProvider/src/main/AndroidManifest.xml b/OtakudesuProvider/src/main/AndroidManifest.xml new file mode 100644 index 00000000..c98063f8 --- /dev/null +++ b/OtakudesuProvider/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/OtakudesuProvider/src/main/kotlin/com/hexated/OtakudesuProvider.kt b/OtakudesuProvider/src/main/kotlin/com/hexated/OtakudesuProvider.kt new file mode 100644 index 00000000..9d1e9a0e --- /dev/null +++ b/OtakudesuProvider/src/main/kotlin/com/hexated/OtakudesuProvider.kt @@ -0,0 +1,204 @@ +package com.hexated + +import com.fasterxml.jackson.annotation.JsonProperty +import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.loadExtractor +import org.jsoup.Jsoup +import org.jsoup.nodes.Element +import java.util.ArrayList + +class OtakudesuProvider : MainAPI() { + override var mainUrl = "https://otakudesu.watch" + override var name = "Otakudesu" + 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) { + "Completed" -> ShowStatus.Completed + "Ongoing" -> ShowStatus.Ongoing + else -> ShowStatus.Completed + } + } + } + + override val mainPage = mainPageOf( + "$mainUrl/ongoing-anime/page/" to "Anime Ongoing", + "$mainUrl/complete-anime/page/" to "Anime Completed" + ) + + override suspend fun getMainPage( + page: Int, + request: MainPageRequest + ): HomePageResponse { + val document = app.get(request.data + page).document + val home = document.select("div.venz > ul > li").mapNotNull { + it.toSearchResult() + } + return newHomePageResponse(request.name, home) + } + + private fun Element.toSearchResult(): AnimeSearchResponse? { + val title = this.selectFirst("h2.jdlflm")?.text()?.trim() ?: return null + val href = this.selectFirst("a")!!.attr("href") + val posterUrl = this.select("div.thumbz > img").attr("src").toString() + val epNum = this.selectFirst("div.epz")?.ownText()?.replace(Regex("[^0-9]"), "")?.trim() + ?.toIntOrNull() + return newAnimeSearchResponse(title, href, TvType.Anime) { + this.posterUrl = posterUrl + addSub(epNum) + } + + } + + override suspend fun search(query: String): List { + val link = "$mainUrl/?s=$query&post_type=anime" + val document = app.get(link).document + + return document.select("ul.chivsrc > li").map { + val title = it.selectFirst("h2 > a")!!.ownText().trim() + val href = it.selectFirst("h2 > a")!!.attr("href") + val posterUrl = it.selectFirst("img")!!.attr("src").toString() + newAnimeSearchResponse(title, href, TvType.Anime) { + this.posterUrl = posterUrl + } + } + } + + + override suspend fun load(url: String): LoadResponse { + val document = app.get(url).document + + val title = document.selectFirst("div.infozingle > p:nth-child(1) > span")?.ownText() + ?.replace(":", "")?.trim().toString() + val poster = document.selectFirst("div.fotoanime > img")?.attr("src") + val tags = document.select("div.infozingle > p:nth-child(11) > span > a").map { it.text() } + val type = getType( + document.selectFirst("div.infozingle > p:nth-child(5) > span")?.ownText() + ?.replace(":", "")?.trim().toString() + ) + val year = Regex("\\d, ([0-9]*)").find( + document.select("div.infozingle > p:nth-child(9) > span").text() + )?.groupValues?.get(1)?.toIntOrNull() + val status = getStatus( + document.selectFirst("div.infozingle > p:nth-child(6) > span")!!.ownText() + .replace(":", "") + .trim() + ) + val description = document.select("div.sinopc > p").text() + + val episodes = document.select("div.episodelist")[1].select("ul > li").mapNotNull { + val name = Regex("(Episode\\s?[0-9]+)").find( + it.selectFirst("a")?.text().toString() + )?.groupValues?.getOrNull(0) ?: it.selectFirst("a")?.text() + val link = fixUrl(it.selectFirst("a")!!.attr("href")) + Episode(link, name) + }.reversed() + + val recommendations = + document.select("div.isi-recommend-anime-series > div.isi-konten").map { + val recName = it.selectFirst("span.judul-anime > a")!!.text() + val recHref = it.selectFirst("a")!!.attr("href") + val recPosterUrl = it.selectFirst("a > img")?.attr("src").toString() + newAnimeSearchResponse(recName, recHref, TvType.Anime) { + this.posterUrl = recPosterUrl + } + } + + return newAnimeLoadResponse(title, url, type) { + engName = title + posterUrl = poster + this.year = year + addEpisodes(DubStatus.Subbed, episodes) + showStatus = status + plot = description + this.tags = tags + this.recommendations = recommendations + } + } + + + data class ResponseSources( + @JsonProperty("id") val id: String, + @JsonProperty("i") val i: String, + @JsonProperty("q") val q: String, + ) + + data class ResponseData( + @JsonProperty("data") val data: String + ) + + override suspend fun loadLinks( + data: String, + isCasting: Boolean, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ): Boolean { + + val document = app.get(data).document + val scriptData = document.select("script").last()?.data() + val token = scriptData?.substringAfter("{action:\"")?.substringBefore("\"}").toString() + + val nonce = app.post("$mainUrl/wp-admin/admin-ajax.php", data = mapOf("action" to token)) + .parsed().data + val action = scriptData?.substringAfter(",action:\"")?.substringBefore("\"}").toString() + + val mirrorData = document.select("div.mirrorstream > ul > li").mapNotNull { + base64Decode(it.select("a").attr("data-content")) + }.toString() + + tryParseJson>(mirrorData)?.apmap { res -> + val id = res.id + val i = res.i + val q = res.q + + var sources = Jsoup.parse( + base64Decode( + app.post( + "${mainUrl}/wp-admin/admin-ajax.php", data = mapOf( + "id" to id, + "i" to i, + "q" to q, + "nonce" to nonce, + "action" to action + ) + ).parsed().data + ) + ).select("iframe").attr("src") + + if (sources.startsWith("https://desustream.me")) { + if (!sources.contains("/arcg/") && !sources.contains("/odchan/") && !sources.contains( + "/desudrive/" + ) + ) { + sources = app.get(sources).document.select("iframe").attr("src") + } + if (sources.startsWith("https://yourupload.com")) { + sources = sources.replace("//", "//www.") + } + } + + loadExtractor(sources, data, subtitleCallback, callback) + + } + + return true + } + +} \ No newline at end of file diff --git a/OtakudesuProvider/src/main/kotlin/com/hexated/OtakudesuProviderPlugin.kt b/OtakudesuProvider/src/main/kotlin/com/hexated/OtakudesuProviderPlugin.kt new file mode 100644 index 00000000..be61c436 --- /dev/null +++ b/OtakudesuProvider/src/main/kotlin/com/hexated/OtakudesuProviderPlugin.kt @@ -0,0 +1,14 @@ + +package com.hexated + +import com.lagradost.cloudstream3.plugins.CloudstreamPlugin +import com.lagradost.cloudstream3.plugins.Plugin +import android.content.Context + +@CloudstreamPlugin +class OtakudesuProviderPlugin: Plugin() { + override fun load(context: Context) { + // All providers should be added in this manner. Please don't edit the providers list directly. + registerMainAPI(OtakudesuProvider()) + } +} \ No newline at end of file diff --git a/PhimmoichillProvider/build.gradle.kts b/PhimmoichillProvider/build.gradle.kts new file mode 100644 index 00000000..4eee2920 --- /dev/null +++ b/PhimmoichillProvider/build.gradle.kts @@ -0,0 +1,28 @@ +// use an integer for version numbers +version = 2 + + +cloudstream { + language = "vi" + // All of these properties are optional, you can safely remove them + + // description = "Lorem Ipsum" + authors = listOf("Hexated") + + /** + * Status int as the following: + * 0: Down + * 1: Ok + * 2: Slow + * 3: Beta only + * */ + status = 1 // will be 3 if unspecified + tvTypes = listOf( + "AsianDrama", + "Anime", + "TvSeries", + "Movie", + ) + + iconUrl = "https://www.google.com/s2/favicons?domain=phimmoichill.net&sz=%size%" +} \ No newline at end of file diff --git a/PhimmoichillProvider/src/main/AndroidManifest.xml b/PhimmoichillProvider/src/main/AndroidManifest.xml new file mode 100644 index 00000000..c98063f8 --- /dev/null +++ b/PhimmoichillProvider/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/PhimmoichillProvider/src/main/kotlin/com/hexated/PhimmoichillProvider.kt b/PhimmoichillProvider/src/main/kotlin/com/hexated/PhimmoichillProvider.kt new file mode 100644 index 00000000..2785c591 --- /dev/null +++ b/PhimmoichillProvider/src/main/kotlin/com/hexated/PhimmoichillProvider.kt @@ -0,0 +1,192 @@ +package com.hexated + +import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.LoadResponse.Companion.addActors +import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer +import com.lagradost.cloudstream3.mvvm.safeApiCall +import com.lagradost.cloudstream3.utils.* +import org.jsoup.nodes.Element +import java.net.URLDecoder + +class PhimmoichillProvider : MainAPI() { + override var mainUrl = "https://phimmoichill.net" + override var name = "Phimmoichill" + override val hasMainPage = true + override var lang = "vi" + override val hasDownloadSupport = true + override val supportedTypes = setOf( + TvType.Movie, + TvType.TvSeries, + TvType.Anime, + TvType.AsianDrama + ) + + override val mainPage = mainPageOf( + "$mainUrl/genre/phim-chieu-rap/page-" to "Phim Chiếu Rạp", + "$mainUrl/list/phim-le/page-" to "Phim Lẻ", + "$mainUrl/list/phim-bo/page-" to "Phim Bộ", + "$mainUrl/genre/phim-hoat-hinh/page-" to "Phim Hoạt Hình", + "$mainUrl/country/phim-han-quoc/page-" to "Phim Hàn Quốc", + "$mainUrl/country/phim-trung-quoc/page-" to "Phim Trung Quốc", + "$mainUrl/country/phim-thai-lan/page-" to "Phim Thái Lan", + ) + + override suspend fun getMainPage( + page: Int, + request: MainPageRequest + ): HomePageResponse { + val document = app.get(request.data + page).document + val home = document.select("li.item").mapNotNull { + it.toSearchResult() + } + return newHomePageResponse( + list = HomePageList( + name = request.name, + list = home, + isHorizontalImages = true + ), + hasNext = true + ) + } + + private fun decode(input: String): String? = URLDecoder.decode(input, "utf-8") + + private fun Element.toSearchResult(): SearchResponse { + val title = this.selectFirst("p,h3")?.text()?.trim().toString() + val href = fixUrl(this.selectFirst("a")!!.attr("href")) + val posterUrl = decode(this.selectFirst("img")!!.attr("src").substringAfter("url=")) + val temp = this.select("span.label").text() + return if (temp.contains(Regex("\\d"))) { + val episode = Regex("(\\((\\d+))|(\\s(\\d+))").find(temp)?.groupValues?.map { num -> + num.replace(Regex("\\(|\\s"), "") + }?.distinct()?.firstOrNull()?.toIntOrNull() + newAnimeSearchResponse(title, href, TvType.TvSeries) { + this.posterUrl = posterUrl + addSub(episode) + } + } else { + val quality = + temp.replace(Regex("(-.*)|(\\|.*)|(?i)(VietSub.*)|(?i)(Thuyết.*)"), "").trim() + newMovieSearchResponse(title, href, TvType.Movie) { + this.posterUrl = posterUrl + addQuality(quality) + } + } + } + + override suspend fun search(query: String): List { + val link = "$mainUrl/tim-kiem/$query" + val document = app.get(link).document + + return document.select("ul.list-film li").map { + it.toSearchResult() + } + } + + override suspend fun load(url: String): LoadResponse { + val document = app.get(url).document + + val title = document.selectFirst("h1[itemprop=name]")?.text()?.trim().toString() + val link = document.select("ul.list-button li:last-child a").attr("href") + val poster = document.selectFirst("div.image img[itemprop=image]")?.attr("src") + val tags = document.select("ul.entry-meta.block-film li:nth-child(4) a").map { it.text() } + val year = document.select("ul.entry-meta.block-film li:nth-child(2) a").text().trim() + .toIntOrNull() + val tvType = if (document.select("div.latest-episode").isNotEmpty() + ) TvType.TvSeries else TvType.Movie + val description = document.select("div#film-content").text().trim() + val trailer = + document.select("div#trailer script").last()?.data()?.substringAfter("file: \"") + ?.substringBefore("\",") + val rating = + document.select("ul.entry-meta.block-film li:nth-child(7) span").text().toRatingInt() + val actors = document.select("ul.entry-meta.block-film li:last-child a").map { it.text() } + val recommendations = document.select("ul#list-film-realted li.item").map { + it.toSearchResult().apply { + this.posterUrl = decode(it.selectFirst("img")!!.attr("data-src").substringAfter("url=")) + } + } + + return if (tvType == TvType.TvSeries) { + val docEpisodes = app.get(link).document + val episodes = docEpisodes.select("ul#list_episodes > li").map { + val href = it.select("a").attr("href") + val episode = + it.select("a").text().replace(Regex("[^0-9]"), "").trim().toIntOrNull() + val name = "Episode $episode" + Episode( + data = href, + name = name, + episode = episode, + ) + } + newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodes) { + this.posterUrl = poster + this.year = year + this.plot = description + this.tags = tags + this.rating = rating + addActors(actors) + this.recommendations = recommendations + addTrailer(trailer) + } + } else { + newMovieLoadResponse(title, url, TvType.Movie, link) { + this.posterUrl = poster + this.year = year + this.plot = description + this.tags = tags + this.rating = rating + addActors(actors) + this.recommendations = recommendations + addTrailer(trailer) + } + } + } + + override suspend fun loadLinks( + data: String, + isCasting: Boolean, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ): Boolean { + val document = app.get(data).document + + val key = document.select("div#content script") + .find { it.data().contains("filmInfo.episodeID =") }?.data()?.let { script -> + val id = script.substringAfter("filmInfo.episodeID = parseInt('") + app.post( + // Not mainUrl + url = "https://phimmoichills.net/pmplayer.php", + data = mapOf("qcao" to id, "sv" to "0"), + referer = data, + headers = mapOf( + "X-Requested-With" to "XMLHttpRequest", + "Content-Type" to "application/x-www-form-urlencoded; charset=UTF-8" + ) + ).text.substringAfterLast("iniPlayers(\"") + .substringBefore("\",") + } + + listOf( + Pair("https://so-trym.topphimmoi.org/raw/$key/index.m3u8", "PMFAST"), + Pair("https://dash.megacdn.xyz/raw/$key/index.m3u8", "PMHLS"), + Pair("https://dash.megacdn.xyz/dast/$key/index.m3u8", "PMBK") + ).apmap { (link, source) -> + safeApiCall { + callback.invoke( + ExtractorLink( + source, + source, + link, + referer = "$mainUrl/", + quality = Qualities.P1080.value, + isM3u8 = true, + ) + ) + } + } + return true + } + +} diff --git a/PhimmoichillProvider/src/main/kotlin/com/hexated/PhimmoichillProviderPlugin.kt b/PhimmoichillProvider/src/main/kotlin/com/hexated/PhimmoichillProviderPlugin.kt new file mode 100644 index 00000000..eebb608f --- /dev/null +++ b/PhimmoichillProvider/src/main/kotlin/com/hexated/PhimmoichillProviderPlugin.kt @@ -0,0 +1,14 @@ + +package com.hexated + +import com.lagradost.cloudstream3.plugins.CloudstreamPlugin +import com.lagradost.cloudstream3.plugins.Plugin +import android.content.Context + +@CloudstreamPlugin +class PhimmoichillProviderPlugin: Plugin() { + override fun load(context: Context) { + // All providers should be added in this manner. Please don't edit the providers list directly. + registerMainAPI(PhimmoichillProvider()) + } +} \ No newline at end of file diff --git a/RebahinProvider/build.gradle.kts b/RebahinProvider/build.gradle.kts new file mode 100644 index 00000000..8d2dfd1d --- /dev/null +++ b/RebahinProvider/build.gradle.kts @@ -0,0 +1,29 @@ +// use an integer for version numbers +version = 1 + + +cloudstream { + language = "id" + // All of these properties are optional, you can safely remove them + + // description = "Lorem Ipsum" + authors = listOf("Hexated") + + /** + * Status int as the following: + * 0: Down + * 1: Ok + * 2: Slow + * 3: Beta only + * */ + status = 1 // will be 3 if unspecified + tvTypes = listOf( + "AsianDrama", + "Anime", + "TvSeries", + "Movie", + ) + + + iconUrl = "https://www.google.com/s2/favicons?domain=104.237.198.194&sz=%size%" +} \ No newline at end of file diff --git a/RebahinProvider/src/main/AndroidManifest.xml b/RebahinProvider/src/main/AndroidManifest.xml new file mode 100644 index 00000000..c98063f8 --- /dev/null +++ b/RebahinProvider/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/RebahinProvider/src/main/kotlin/com/hexated/RebahinProvider.kt b/RebahinProvider/src/main/kotlin/com/hexated/RebahinProvider.kt new file mode 100644 index 00000000..3fd3e8d5 --- /dev/null +++ b/RebahinProvider/src/main/kotlin/com/hexated/RebahinProvider.kt @@ -0,0 +1,324 @@ +package com.hexated + +import com.fasterxml.jackson.annotation.JsonProperty +import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.LoadResponse.Companion.addActors +import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer +import com.lagradost.cloudstream3.mvvm.logError +import com.lagradost.cloudstream3.mvvm.safeApiCall +import com.lagradost.cloudstream3.network.WebViewResolver +import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.getQualityFromName +import com.lagradost.cloudstream3.utils.loadExtractor +import org.jsoup.nodes.Element +import java.net.URI + +class RebahinProvider : MainAPI() { + override var mainUrl = "http://104.237.198.194" + override var name = "Rebahin" + override val hasMainPage = true + override var lang = "id" + override val hasDownloadSupport = true + override val supportedTypes = setOf( + TvType.Movie, + TvType.TvSeries, + TvType.Anime, + TvType.AsianDrama + ) + + override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse { + val urls = listOf( + Pair("Featured", "xtab1"), + Pair("Film Terbaru", "xtab2"), + Pair("Romance", "xtab3"), + Pair("Drama", "xtab4"), + Pair("Action", "xtab5"), + Pair("Scifi", "xtab6"), + Pair("Tv Series Terbaru", "stab1"), + Pair("Anime Series", "stab2"), + Pair("Drakor Series", "stab3"), + Pair("West Series", "stab4"), + Pair("China Series", "stab5"), + Pair("Japan Series", "stab6"), + ) + + val items = ArrayList() + + for ((header, tab) in urls) { + try { + val home = + app.get("$mainUrl/wp-content/themes/indoxxi/ajax-top-$tab.php").document.select( + "div.ml-item" + ).map { + it.toSearchResult() + } + items.add(HomePageList(header, home)) + } catch (e: Exception) { + logError(e) + } + } + + if (items.size <= 0) throw ErrorLoadingException() + return HomePageResponse(items) + } + + private fun Element.toSearchResult(): SearchResponse { + val title = this.selectFirst("span.mli-info > h2")!!.text().trim() + val href = this.selectFirst("a")!!.attr("href") + val type = + if (this.select("span.mli-quality").isNotEmpty()) TvType.Movie else TvType.TvSeries + return if (type == TvType.Movie) { + val posterUrl = this.select("img").attr("src") + val quality = getQualityFromString(this.select("span.mli-quality").text().trim()) + newMovieSearchResponse(title, href, TvType.Movie) { + this.posterUrl = posterUrl + this.quality = quality + } + } else { + val posterUrl = + this.select("img").attr("src").ifEmpty { this.select("img").attr("data-original") } + val episode = + this.select("div.mli-eps > span").text().replace(Regex("[^0-9]"), "").toIntOrNull() + newAnimeSearchResponse(title, href, TvType.TvSeries) { + this.posterUrl = posterUrl + addSub(episode) + } + } + } + + override suspend fun search(query: String): List { + val link = "$mainUrl/?s=$query" + val document = app.get(link).document + + return document.select("div.ml-item").map { + it.toSearchResult() + } + } + + override suspend fun load(url: String): LoadResponse { + val document = app.get(url).document + + val title = document.selectFirst("h3[itemprop=name]")!!.ownText().trim() + val poster = document.select(".mvic-desc > div.thumb.mvic-thumb").attr("style") + .substringAfter("url(").substringBeforeLast(")") + val tags = document.select("span[itemprop=genre]").map { it.text() } + + val year = Regex("([0-9]{4}?)-").find( + document.selectFirst(".mvici-right > p:nth-child(3)")!!.ownText().trim() + )?.groupValues?.get(1).toString().toIntOrNull() + val tvType = if (url.contains("/series/")) TvType.TvSeries else TvType.Movie + val description = document.select("span[itemprop=reviewBody] > p").text().trim() + val trailer = fixUrlNull(document.selectFirst("div.modal-body-trailer iframe")?.attr("src")) + val rating = document.selectFirst("span[itemprop=ratingValue]")?.text()?.toRatingInt() + val duration = document.selectFirst(".mvici-right > p:nth-child(1)")!! + .ownText().replace(Regex("[^0-9]"), "").toIntOrNull() + val actors = document.select("span[itemprop=actor] > a").map { it.select("span").text() } + + val baseLink = fixUrl(document.select("div#mv-info > a").attr("href").toString()) + + return if (tvType == TvType.TvSeries) { + val episodes = app.get(baseLink).document.select("div#list-eps > a").map { + Pair(it.text(), it.attr("data-iframe")) + }.groupBy { it.first }.map { eps -> + Episode( + data = eps.value.map { fixUrl(base64Decode(it.second)) }.toString(), + name = eps.key, + episode = eps.key.filter { it.isDigit() }.toIntOrNull() + ) + + } + newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodes) { + this.posterUrl = poster + this.year = year + this.plot = description + this.tags = tags + this.rating = rating + this.duration = duration + addActors(actors) + addTrailer(trailer) + } + } else { + val links = + app.get(baseLink).document.select("div#server-list div.server-wrapper div[id*=episode]") + .map { + fixUrl(base64Decode(it.attr("data-iframe"))) + }.toString() + newMovieLoadResponse(title, url, TvType.Movie, links) { + this.posterUrl = poster + this.year = year + this.plot = description + this.tags = tags + this.rating = rating + this.duration = duration + addActors(actors) + addTrailer(trailer) + } + } + } + + private suspend fun invokeLokalSource( + url: String, + name: String, + ref: String, + subCallback: (SubtitleFile) -> Unit, + sourceCallback: (ExtractorLink) -> Unit + ) { + val document = app.get( + url, + allowRedirects = false, + referer = mainUrl, + headers = mapOf("Accept" to "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8") + ).document + + document.select("script").map { script -> + if (script.data().contains("sources: [")) { + val source = tryParseJson( + script.data().substringAfter("sources: [").substringBefore("],") + ) + val m3uData = app.get(source!!.file, referer = ref).text + val quality = Regex("\\d{3,4}\\.m3u8").findAll(m3uData).map { it.value }.toList() + + quality.forEach { + sourceCallback.invoke( + ExtractorLink( + source = name, + name = name, + url = source.file.replace("video.m3u8", it), + referer = ref, + quality = getQualityFromName("${it.replace(".m3u8", "")}p"), + isM3u8 = true + ) + ) + } + + val trackJson = script.data().substringAfter("tracks: [").substringBefore("],") + val track = tryParseJson>("[$trackJson]") + track?.map { + subCallback.invoke( + SubtitleFile( + "Indonesian", + (if (it.file.contains(".srt")) it.file else null)!! + ) + ) + } + } + } + } + + private suspend fun invokeKotakAjairSource( + url: String, + subCallback: (SubtitleFile) -> Unit, + sourceCallback: (ExtractorLink) -> Unit + ) { + val domainUrl = "https://kotakajair.xyz" + val id = url.trimEnd('/').split("/").last() + val sources = app.post( + url = "$domainUrl/api/source/$id", + data = mapOf("r" to mainUrl, "d" to URI(url).host) + ).parsed() + + sources.data?.map { + sourceCallback.invoke( + ExtractorLink( + name, + "KotakAjair", + fixUrl(it.file), + referer = url, + quality = getQualityFromName(it.label) + ) + ) + } + val userData = sources.player.poster_file.split("/")[2] + sources.captions?.map { + subCallback.invoke( + SubtitleFile( + if (it.language.lowercase().contains("eng")) it.language else "Indonesian", + "$domainUrl/asset/userdata/$userData/caption/${it.hash}/${it.id}.srt" + ) + ) + } + + } + + override suspend fun loadLinks( + data: String, + isCasting: Boolean, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ): Boolean { + + data.removeSurrounding("[", "]").split(",").map { it.trim() }.apmap { link -> + safeApiCall { + when { + link.startsWith("http://172.96.161.72") -> invokeLokalSource( + link, + this.name, + "http://172.96.161.72/", + subtitleCallback, + callback + ) + link.startsWith("https://kotakajair.xyz") -> invokeKotakAjairSource( + link, + subtitleCallback, + callback + ) + else -> { + loadExtractor(link, "$mainUrl/", subtitleCallback, callback) + if (link.startsWith("https://sbfull.com")) { + val response = app.get( + link, interceptor = WebViewResolver( + Regex("""\.srt""") + ) + ) + subtitleCallback.invoke( + SubtitleFile( + "Indonesian", + response.url + ) + ) + } + } + } + } + } + + return true + } + + private data class ResponseLocal( + @JsonProperty("file") val file: String, + @JsonProperty("label") val label: String, + @JsonProperty("type") val type: String? + ) + + private data class Tracks( + @JsonProperty("file") val file: String, + @JsonProperty("label") val label: String?, + @JsonProperty("kind") val kind: String? + ) + + private data class Captions( + @JsonProperty("id") val id: String, + @JsonProperty("hash") val hash: String, + @JsonProperty("language") val language: String, + ) + + private data class Data( + @JsonProperty("file") val file: String, + @JsonProperty("label") val label: String, + ) + + private data class Player( + @JsonProperty("poster_file") val poster_file: String, + ) + + private data class ResponseKotakAjair( + @JsonProperty("success") val success: Boolean, + @JsonProperty("player") val player: Player, + @JsonProperty("data") val data: List?, + @JsonProperty("captions") val captions: List? + ) + +} + diff --git a/RebahinProvider/src/main/kotlin/com/hexated/RebahinProviderPlugin.kt b/RebahinProvider/src/main/kotlin/com/hexated/RebahinProviderPlugin.kt new file mode 100644 index 00000000..7fc66950 --- /dev/null +++ b/RebahinProvider/src/main/kotlin/com/hexated/RebahinProviderPlugin.kt @@ -0,0 +1,14 @@ + +package com.hexated + +import com.lagradost.cloudstream3.plugins.CloudstreamPlugin +import com.lagradost.cloudstream3.plugins.Plugin +import android.content.Context + +@CloudstreamPlugin +class RebahinProviderPlugin: Plugin() { + override fun load(context: Context) { + // All providers should be added in this manner. Please don't edit the providers list directly. + registerMainAPI(RebahinProvider()) + } +} \ No newline at end of file diff --git a/TocanimeProvider/build.gradle.kts b/TocanimeProvider/build.gradle.kts new file mode 100644 index 00000000..d7be42c7 --- /dev/null +++ b/TocanimeProvider/build.gradle.kts @@ -0,0 +1,27 @@ +// use an integer for version numbers +version = 1 + + +cloudstream { + language = "vi" + // All of these properties are optional, you can safely remove them + + // description = "Lorem Ipsum" + authors = listOf("Hexated") + + /** + * Status int as the following: + * 0: Down + * 1: Ok + * 2: Slow + * 3: Beta only + * */ + status = 1 // will be 3 if unspecified + tvTypes = listOf( + "AnimeMovie", + "Anime", + "OVA", + ) + + iconUrl = "https://www.google.com/s2/favicons?domain=tocanime.co&sz=%size%" +} \ No newline at end of file diff --git a/TocanimeProvider/src/main/AndroidManifest.xml b/TocanimeProvider/src/main/AndroidManifest.xml new file mode 100644 index 00000000..c98063f8 --- /dev/null +++ b/TocanimeProvider/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/TocanimeProvider/src/main/kotlin/com/hexated/TocanimeProvider.kt b/TocanimeProvider/src/main/kotlin/com/hexated/TocanimeProvider.kt new file mode 100644 index 00000000..90a0f590 --- /dev/null +++ b/TocanimeProvider/src/main/kotlin/com/hexated/TocanimeProvider.kt @@ -0,0 +1,178 @@ +package com.hexated + +import com.fasterxml.jackson.annotation.JsonProperty +import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.Qualities +import org.jsoup.nodes.Element +import java.util.* + +class TocanimeProvider : MainAPI() { + override var mainUrl = "https://tocanime.co" + override var name = "Tocanime" + override val hasMainPage = true + override var lang = "vi" + override val hasDownloadSupport = true + + override val supportedTypes = setOf( + TvType.Anime, + TvType.AnimeMovie, + TvType.OVA + ) + + companion object { + fun getType(t: String): TvType { + return when { + t.contains("OVA") || t.contains("Special") -> TvType.OVA + t.contains("Movie") -> TvType.AnimeMovie + else -> TvType.Anime + } + } + + fun getStatus(t: String): ShowStatus { + return when (t) { + "Đã hoàn thành" -> ShowStatus.Completed + "Chưa hoàn thành" -> ShowStatus.Ongoing + else -> ShowStatus.Completed + } + } + } + + override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse { + val document = app.get(mainUrl).document + + val homePageList = ArrayList() + + document.select("div#playlists > div").forEach { block -> + val header = block.selectFirst("h2")?.text()?.trim() ?: "" + val items = block.select("div.col-lg-3.col-md-4.col-6").map { + it.toSearchResult() + } + if (items.isNotEmpty()) homePageList.add(HomePageList(header, items)) + } + + return HomePageResponse(homePageList) + } + + private fun Element.toSearchResult(): AnimeSearchResponse { + val title = this.selectFirst("h3 a")?.text()?.trim() ?: "" + val href = fixUrl(this.selectFirst("h3 a")!!.attr("href")) + val posterUrl = fixUrlNull(this.selectFirst("div.card-item-img")?.attr("data-original")) + val epNum = this.selectFirst("div.card-item-badget.rtl")?.text()?.let { eps -> + val num = eps.filter { it.isDigit() }.toIntOrNull() + if(eps.contains("Preview")) { + num?.minus(1) + } else { + num + } + } + return newAnimeSearchResponse(title, href, TvType.Anime) { + this.posterUrl = posterUrl + addSub(epNum) + } + + } + + override suspend fun search(query: String): List { + val document = app.get("$mainUrl/content/search?t=kw&q=$query").document + + return document.select("div.col-lg-3.col-md-4.col-6").map { + it.toSearchResult() + } + + } + + override suspend fun load(url: String): LoadResponse? { + val document = app.get(url).document + + val title = document.selectFirst("h1.title")?.text() ?: return null + val type = + if (document.select("div.me-list.scroller a").size == 1) TvType.AnimeMovie else TvType.Anime + val episodes = document.select("div.me-list.scroller a").mapNotNull { + Episode(fixUrl(it.attr("href")), it.text()) + }.reversed() + val trailer = + document.selectFirst("div#trailer script")?.data()?.substringAfter("