From 0af3c60c903358640e9a37c580b4e99a2a022f75 Mon Sep 17 00:00:00 2001 From: Hexated <37908684+hexated@users.noreply.github.com> Date: Mon, 23 May 2022 17:55:13 +0700 Subject: [PATCH] More Indonesia Provider (#1079) * Add files via upload * Add files via upload * Update MainAPI.kt * - Add NontonAnimeID and Kuramanime - refactoring code * add GomunimeProvider, add some source, fix minor code * add sources * add KuronimeProvider, add sources * small fix, (ready to merge..) * add indonesia provider, add extractor, add source, small fix * small fix (ready to merge) * fix --- .../com/lagradost/cloudstream3/MainAPI.kt | 4 + .../animeproviders/GomunimeProvider.kt | 23 +- .../animeproviders/KuronimeProvider.kt | 34 +- .../animeproviders/NeonimeProvider.kt | 17 +- .../animeproviders/NontonAnimeIDProvider.kt | 115 +----- .../animeproviders/OploverzProvider.kt | 11 +- .../cloudstream3/extractors/Blogger.kt | 45 +++ .../cloudstream3/extractors/Hxfile.kt | 89 +++++ .../cloudstream3/extractors/Mp4Upload.kt | 3 +- .../cloudstream3/extractors/StreamSB.kt | 9 +- .../cloudstream3/extractors/XStreamCdn.kt | 10 + .../movieproviders/DramaidProvider.kt | 5 +- .../movieproviders/LayarKaca21Provider.kt | 226 ++++++++++++ .../movieproviders/RebahinProvider.kt | 326 ++++++++++++++++++ .../cloudstream3/utils/ExtractorApi.kt | 12 +- 15 files changed, 762 insertions(+), 167 deletions(-) create mode 100644 app/src/main/java/com/lagradost/cloudstream3/extractors/Blogger.kt create mode 100644 app/src/main/java/com/lagradost/cloudstream3/extractors/Hxfile.kt create mode 100644 app/src/main/java/com/lagradost/cloudstream3/movieproviders/LayarKaca21Provider.kt create mode 100644 app/src/main/java/com/lagradost/cloudstream3/movieproviders/RebahinProvider.kt diff --git a/app/src/main/java/com/lagradost/cloudstream3/MainAPI.kt b/app/src/main/java/com/lagradost/cloudstream3/MainAPI.kt index 214324aa..204e2116 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/MainAPI.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/MainAPI.kt @@ -88,6 +88,8 @@ object APIHolder { StreamingcommunityProvider(), TantifilmProvider(), HDMovie5(), + RebahinProvider(), + LayarKaca21Provider(), // Metadata providers //TmdbProvider(), @@ -628,6 +630,8 @@ fun getQualityFromString(string: String?): SearchQuality? { "dvdscr" -> SearchQuality.DVD "blueray" -> SearchQuality.BlueRay "bluray" -> SearchQuality.BlueRay + "blu" -> SearchQuality.BlueRay + "fhd" -> SearchQuality.HD "br" -> SearchQuality.BlueRay "standard" -> SearchQuality.SD "sd" -> SearchQuality.SD diff --git a/app/src/main/java/com/lagradost/cloudstream3/animeproviders/GomunimeProvider.kt b/app/src/main/java/com/lagradost/cloudstream3/animeproviders/GomunimeProvider.kt index 98691fc2..d5f2706f 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/animeproviders/GomunimeProvider.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/animeproviders/GomunimeProvider.kt @@ -168,18 +168,6 @@ class GomunimeProvider : MainAPI() { } } - private fun invokeSource( - source: String, - sourceCallback: (ExtractorLink) -> Unit - ) { - M3u8Helper.generateM3u8( - source = this.name, - streamUrl = source, - referer = "$mainUrl/", - name = this.name, - ).forEach(sourceCallback) - } - data class MobiSource( @JsonProperty("file") val file: String, @JsonProperty("label") val label: String, @@ -219,15 +207,19 @@ class GomunimeProvider : MainAPI() { url = "https://path.gomuni.me/app/vapi.php", data = mapOf("fid" to it.first, "func" to "hls") ).text.let { link -> - invokeSource(link, callback) + M3u8Helper.generateM3u8( + this.name, + link, + mainUrl, + ).forEach(callback) } } - else -> { + it.second.contains("mp4") -> { app.post( url = "https://path.gomuni.me/app/vapi.php", data = mapOf("data" to it.first, "func" to "blogs") ).parsed>().map { - callback( + callback.invoke( ExtractorLink( source = name, name = "Mobi SD", @@ -238,6 +230,7 @@ class GomunimeProvider : MainAPI() { ) } } + else -> null } } } diff --git a/app/src/main/java/com/lagradost/cloudstream3/animeproviders/KuronimeProvider.kt b/app/src/main/java/com/lagradost/cloudstream3/animeproviders/KuronimeProvider.kt index bf59fd34..8af7e501 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/animeproviders/KuronimeProvider.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/animeproviders/KuronimeProvider.kt @@ -32,7 +32,7 @@ class KuronimeProvider : MainAPI() { fun getStatus(t: String): ShowStatus { return when (t) { - "Completed" -> ShowStatus.Completed + "Completed" -> ShowStatus.Completed "Ongoing" -> ShowStatus.Ongoing else -> ShowStatus.Completed } @@ -61,8 +61,12 @@ class KuronimeProvider : MainAPI() { } 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() + (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 } @@ -108,12 +112,17 @@ class KuronimeProvider : MainAPI() { it.select("img").attr("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 type = getType( + document.selectFirst(".infodetail > ul > li:nth-child(7)")?.ownText()?.trim().toString() + ) val trailer = document.select("iframe.entered.lazyloaded").attr("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 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 { @@ -156,7 +165,7 @@ class KuronimeProvider : MainAPI() { link, referer = "https://animeku.org/", quality = Qualities.Unknown.value, - isM3u8 = link.contains(".m3u8") + isM3u8 = true ) ) } @@ -170,21 +179,14 @@ class KuronimeProvider : MainAPI() { callback: (ExtractorLink) -> Unit ): Boolean { val document = app.get(data).document - val iframeLink = document.select(".mobius > .mirror > option").mapNotNull { + val sources = document.select(".mobius > .mirror > option").mapNotNull { fixUrl(Jsoup.parse(base64Decode(it.attr("value"))).select("iframe").attr("src")) } - iframeLink.map { - it.replace("https://ok.ru", "http://ok.ru") - }.apmap { + sources.apmap { safeApiCall { when { - it.contains("hxfile.co") -> invokeLocalSource( - it, - this.name, - sourceCallback = callback - ) -// it.contains("animeku.org") -> invokeKuroSource(it, callback) + it.contains("animeku.org") -> invokeKuroSource(it, callback) else -> loadExtractor(it, mainUrl, callback) } } diff --git a/app/src/main/java/com/lagradost/cloudstream3/animeproviders/NeonimeProvider.kt b/app/src/main/java/com/lagradost/cloudstream3/animeproviders/NeonimeProvider.kt index 426826be..2e3cceab 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/animeproviders/NeonimeProvider.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/animeproviders/NeonimeProvider.kt @@ -89,7 +89,7 @@ class NeonimeProvider : MainAPI() { 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") + 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()) @@ -102,11 +102,6 @@ class NeonimeProvider : MainAPI() { } } - data class NeonimeSyncData( - @JsonProperty("mal_id") val malId: String?, - @JsonProperty("anilist_id") val aniListId: String?, - ) - override suspend fun load(url: String): LoadResponse { val document = app.get(url).document @@ -174,14 +169,8 @@ class NeonimeProvider : MainAPI() { } } - source.map { - it.replace("https://ok.ru", "http://ok.ru") - }.apmap { - when { - it.contains("blogger.com") -> invokeBloggerSource(it, callback) - it.contains("7njctn.neonime.watch") || it.contains("8njctn.neonime.net") -> invokeLocalSource(it, mainUrl, redirect = false, callback) - else -> loadExtractor(it, data, callback) - } + source.apmap { + loadExtractor(it, data, callback) } return true diff --git a/app/src/main/java/com/lagradost/cloudstream3/animeproviders/NontonAnimeIDProvider.kt b/app/src/main/java/com/lagradost/cloudstream3/animeproviders/NontonAnimeIDProvider.kt index 0b4d6318..d3cf7772 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/animeproviders/NontonAnimeIDProvider.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/animeproviders/NontonAnimeIDProvider.kt @@ -74,7 +74,11 @@ class NontonAnimeIDProvider : MainAPI() { if (name.contains("movie")) { return "$mainUrl/anime/" + name.replace("-movie", "") } else { - "$mainUrl/anime/$name" + if (name.contains("kokurasetai-season-3")) { + "$mainUrl/anime/${name.replace("season-3", "ultra-romantic")}" + } else { + "$mainUrl/anime/$name" + } } } } @@ -233,115 +237,10 @@ class NontonAnimeIDProvider : MainAPI() { sources.add(fixUrl(iframe)) } - sources.map { - it.replace("https://ok.ru", "http://ok.ru") - }.apmap { - when { - it.contains("blogger.com") -> invokeBloggerSource(it, callback) - it.contains("kotakanimeid.com") -> invokeLocalSource( - it, - this.name, - sourceCallback = callback - ) - else -> loadExtractor(it, data, callback) - } + sources.apmap { + loadExtractor(it, data, callback) } return true } } - -// re-use as extractorApis - -suspend fun invokeBloggerSource( - url: String, - sourceCallback: (ExtractorLink) -> Unit -) { - val doc = app.get(url).document - val sourceName = Regex("[^w{3}]\\.?(.+)\\.").find(URI(url).host)?.groupValues?.get(1).toString() - .replace(Regex("\\w+\\."), "").replaceFirstChar { it.uppercase() } - - val server = - doc.selectFirst("script")?.data()!!.substringAfter("\"streams\":[").substringBefore("]") - tryParseJson>("[$server]")?.map { - sourceCallback.invoke( - ExtractorLink( - sourceName, - sourceName, - it.play_url, - referer = "https://www.youtube.com/", - quality = when (it.format_id) { - 18 -> 360 - 22 -> 720 - else -> Qualities.Unknown.value - } - ) - ) - } -} - -data class BloggerSource( - @JsonProperty("play_url") val play_url: String, - @JsonProperty("format_id") val format_id: Int -) - -suspend fun invokeLocalSource( - source: String, - ref: String, - redirect: Boolean = true, - sourceCallback: (ExtractorLink) -> Unit -) { - val doc = app.get(source, allowRedirects = redirect).document - val sourceName = - Regex("[^w{3}]\\.?(.+)\\.").find(URI(source).host)?.groupValues?.get(1).toString() - .replace(Regex("\\w+\\."), "").replaceFirstChar { it.uppercase() } - - doc.select("script").map { script -> - if (script.data().contains("eval(function(p,a,c,k,e,d)")) { - val data = getAndUnpack(script.data()) - val server = data.substringAfter("sources:[").substringBefore("]") - tryParseJson>("[$server]")?.map { - sourceCallback.invoke( - ExtractorLink( - sourceName, - sourceName, - it.file, - referer = ref, - quality = when { - source.contains("hxfile.co") -> getQualityFromName( - Regex("\\d\\.(.*?).mp4").find( - doc.select("title").text() - )?.groupValues?.get(1).toString() - ) - else -> getQualityFromName(it.label) - } - - ) - ) - } - } else { - if (script.data().contains("\"sources\":[")) { - val server = script.data().substringAfter("\"sources\":[").substringBefore("]") - tryParseJson>("[$server]")?.map { - sourceCallback.invoke( - ExtractorLink( - sourceName, - sourceName, - it.file, - referer = ref, - quality = getQualityFromName(it.label) - ) - ) - } - } else { - // skip for now - } - } - } -} - -data class ResponseSource( - @JsonProperty("file") val file: String, - @JsonProperty("type") val type: String?, - @JsonProperty("label") val label: String? -) \ No newline at end of file diff --git a/app/src/main/java/com/lagradost/cloudstream3/animeproviders/OploverzProvider.kt b/app/src/main/java/com/lagradost/cloudstream3/animeproviders/OploverzProvider.kt index ed064940..906c20ff 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/animeproviders/OploverzProvider.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/animeproviders/OploverzProvider.kt @@ -187,17 +187,12 @@ class OploverzProvider : MainAPI() { callback: (ExtractorLink) -> Unit ): Boolean { val document = app.get(data).document - val iframeLink = document.select(".mobius > .mirror > option").mapNotNull { + val sources = document.select(".mobius > .mirror > option").mapNotNull { fixUrl(Jsoup.parse(base64Decode(it.attr("value"))).select("iframe").attr("src")) } - iframeLink.map { - it.replace("https://ok.ru", "http://ok.ru") - }.apmap { - when { - it.contains("blogger.com") -> invokeBloggerSource(it, callback) - else -> loadExtractor(it, data, callback) - } + sources.apmap { + loadExtractor(it, data, callback) } return true diff --git a/app/src/main/java/com/lagradost/cloudstream3/extractors/Blogger.kt b/app/src/main/java/com/lagradost/cloudstream3/extractors/Blogger.kt new file mode 100644 index 00000000..cae77322 --- /dev/null +++ b/app/src/main/java/com/lagradost/cloudstream3/extractors/Blogger.kt @@ -0,0 +1,45 @@ +package com.lagradost.cloudstream3.extractors + +import com.fasterxml.jackson.annotation.JsonProperty +import com.lagradost.cloudstream3.app +import com.lagradost.cloudstream3.utils.* +import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson + +class Blogger : ExtractorApi() { + override val name = "Blogger" + override val mainUrl = "https://www.blogger.com" + override val requiresReferer = false + + override suspend fun getUrl(url: String, referer: String?): List { + val sources = mutableListOf() + with(app.get(url).document) { + this.select("script").map { script -> + if (script.data().contains("\"streams\":[")) { + val data = script.data().substringAfter("\"streams\":[") + .substringBefore("]") + tryParseJson>("[$data]")?.map { + sources.add( + ExtractorLink( + name, + name, + it.play_url, + referer = "https://www.youtube.com/", + quality = when (it.format_id) { + 18 -> 360 + 22 -> 720 + else -> Qualities.Unknown.value + } + ) + ) + } + } + } + } + return sources + } + + private data class ResponseSource( + @JsonProperty("play_url") val play_url: String, + @JsonProperty("format_id") val format_id: Int + ) +} \ No newline at end of file diff --git a/app/src/main/java/com/lagradost/cloudstream3/extractors/Hxfile.kt b/app/src/main/java/com/lagradost/cloudstream3/extractors/Hxfile.kt new file mode 100644 index 00000000..1bf370cf --- /dev/null +++ b/app/src/main/java/com/lagradost/cloudstream3/extractors/Hxfile.kt @@ -0,0 +1,89 @@ +package com.lagradost.cloudstream3.extractors + +import com.fasterxml.jackson.annotation.JsonProperty +import com.lagradost.cloudstream3.app +import com.lagradost.cloudstream3.utils.* +import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson + +class Neonime7n : Hxfile() { + override val name = "Neonime7n" + override val mainUrl = "https://7njctn.neonime.watch" + override val redirect = false +} + +class Neonime8n : Hxfile() { + override val name = "Neonime8n" + override val mainUrl = "https://8njctn.neonime.net" + override val redirect = false +} + +class KotakAnimeid : Hxfile() { + override val name = "KotakAnimeid" + override val mainUrl = "https://kotakanimeid.com" +} + +private data class ResponseSource( + @JsonProperty("file") val file: String, + @JsonProperty("type") val type: String?, + @JsonProperty("label") val label: String? +) + +open class Hxfile : ExtractorApi() { + override val name = "Hxfile" + override val mainUrl = "https://hxfile.co" + override val requiresReferer = false + open val redirect = true + + override suspend fun getUrl(url: String, referer: String?): List? { + val sources = mutableListOf() + val document = app.get(url, allowRedirects = redirect).document + with(document) { + this.select("script").map { script -> + if (script.data().contains("eval(function(p,a,c,k,e,d)")) { + val data = + getAndUnpack(script.data()).substringAfter("sources:[").substringBefore("]") + tryParseJson>("[$data]")?.map { + sources.add( + ExtractorLink( + name, + name, + it.file, + referer = mainUrl, + quality = when { + url.contains("hxfile.co") -> getQualityFromName( + Regex("\\d\\.(.*?).mp4").find( + document.select("title").text() + )?.groupValues?.get(1).toString() + ) + else -> getQualityFromName(it.label) + } + ) + ) + } + } else if (script.data().contains("\"sources\":[")) { + val data = script.data().substringAfter("\"sources\":[").substringBefore("]") + tryParseJson>("[$data]")?.map { + sources.add( + ExtractorLink( + name, + name, + it.file, + referer = mainUrl, + quality = when { + it.label?.contains("HD") == true -> Qualities.P720.value + it.label?.contains("SD") == true -> Qualities.P480.value + else -> getQualityFromName(it.label) + } + ) + ) + } + } + else { + null + } + } + } + return sources + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/lagradost/cloudstream3/extractors/Mp4Upload.kt b/app/src/main/java/com/lagradost/cloudstream3/extractors/Mp4Upload.kt index dee3c2e2..68a4a103 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/extractors/Mp4Upload.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/extractors/Mp4Upload.kt @@ -15,6 +15,7 @@ class Mp4Upload : ExtractorApi() { override suspend fun getUrl(url: String, referer: String?): List? { with(app.get(url)) { getAndUnpack(this.text).let { unpackedText -> + val quality = unpackedText.lowercase().substringAfter(" height=").substringBefore(" ").toIntOrNull() srcRegex.find(unpackedText)?.groupValues?.get(1)?.let { link -> return listOf( ExtractorLink( @@ -22,7 +23,7 @@ class Mp4Upload : ExtractorApi() { name, link, url, - Qualities.Unknown.value, + quality ?: Qualities.Unknown.value, ) ) } diff --git a/app/src/main/java/com/lagradost/cloudstream3/extractors/StreamSB.kt b/app/src/main/java/com/lagradost/cloudstream3/extractors/StreamSB.kt index c0567bb1..93466305 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/extractors/StreamSB.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/extractors/StreamSB.kt @@ -7,6 +7,9 @@ import com.lagradost.cloudstream3.utils.ExtractorApi import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.M3u8Helper +class SBfull : StreamSB() { + override var mainUrl = "https://sbfull.com" +} class StreamSB1 : StreamSB() { override var mainUrl = "https://sbplay1.com" @@ -68,12 +71,16 @@ open class StreamSB : ExtractorApi() { return String(hexChars) } + data class Subs ( + @JsonProperty("file") val file: String, + @JsonProperty("label") val label: String, + ) data class StreamData ( @JsonProperty("file") val file: String, @JsonProperty("cdn_img") val cdnImg: String, @JsonProperty("hash") val hash: String, - @JsonProperty("subs") val subs: List, + @JsonProperty("subs") val subs: List?, @JsonProperty("length") val length: String, @JsonProperty("id") val id: String, @JsonProperty("title") val title: String, diff --git a/app/src/main/java/com/lagradost/cloudstream3/extractors/XStreamCdn.kt b/app/src/main/java/com/lagradost/cloudstream3/extractors/XStreamCdn.kt index 833eab15..7b7e63a9 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/extractors/XStreamCdn.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/extractors/XStreamCdn.kt @@ -8,6 +8,16 @@ import com.lagradost.cloudstream3.utils.ExtractorApi import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.getQualityFromName +class LayarKaca: XStreamCdn() { + override val name: String = "LayarKaca-xxi" + override val mainUrl: String = "https://layarkacaxxi.icu" +} + +class DBfilm: XStreamCdn() { + override val name: String = "DBfilm" + override val mainUrl: String = "https://dbfilm.bar" +} + class FEmbed: XStreamCdn() { override val name: String = "FEmbed" override val mainUrl: String = "https://www.fembed.com" diff --git a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/DramaidProvider.kt b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/DramaidProvider.kt index dc4bc9e6..5b601e28 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/DramaidProvider.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/DramaidProvider.kt @@ -2,7 +2,6 @@ package com.lagradost.cloudstream3.movieproviders import com.fasterxml.jackson.annotation.JsonProperty import com.lagradost.cloudstream3.* -import com.lagradost.cloudstream3.animeproviders.invokeBloggerSource import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.getQualityFromName @@ -198,11 +197,11 @@ class DramaidProvider : MainAPI() { callback: (ExtractorLink) -> Unit ): Boolean { val document = app.get(data).document - val iframeLink = document.select(".mobius > .mirror > option").mapNotNull { + val sources = document.select(".mobius > .mirror > option").mapNotNull { fixUrl(Jsoup.parse(base64Decode(it.attr("value"))).select("iframe").attr("src")) } - iframeLink.map { + sources.map { it.replace("https://ndrama.xyz", "https://www.fembed.com") }.apmap { when { diff --git a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/LayarKaca21Provider.kt b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/LayarKaca21Provider.kt new file mode 100644 index 00000000..eb98eee8 --- /dev/null +++ b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/LayarKaca21Provider.kt @@ -0,0 +1,226 @@ +package com.lagradost.cloudstream3.movieproviders + +import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.mvvm.logError +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.httpsify +import com.lagradost.cloudstream3.utils.loadExtractor +import org.jsoup.Jsoup +import org.jsoup.nodes.Element +import java.util.* + +class LayarKaca21Provider : MainAPI() { + override var mainUrl = "https://149.56.24.226/" + override var name = "LayarKaca21" + override val hasMainPage = true + override val lang = "id" + override val hasDownloadSupport = true + override val supportedTypes = setOf( + TvType.Movie, + TvType.TvSeries, + ) + + override suspend fun getMainPage(): HomePageResponse { + val document = app.get(mainUrl).document + + val homePageList = ArrayList() + + document.select("section.hot-block,section#newseries").forEach { block -> + val header = block.select("footer.load-more > a").text().trim() + val items = block.select("div.slider-item").mapNotNull { + it.toTopSearchResult() + } + if (items.isNotEmpty()) homePageList.add(HomePageList(header, items)) + } + + document.select("div#newest").forEach { block -> + val header = block.select(".header > h2 > a").text() + val items = block.select("div.item").mapNotNull { + it.toMainSearchResult() + } + if (items.isNotEmpty()) homePageList.add(HomePageList(header, items)) + } + + document.select("section#recomendation,section#populer,section#seriespopuler") + .forEach { block -> + val header = block.select(".header > h2 > a").text() + val items = block.select("div.item").mapNotNull { + it.toBottomSearchResult() + } + if (items.isNotEmpty()) homePageList.add(HomePageList(header, items)) + } + + return HomePageResponse(homePageList) + } + + private fun Element.toTopSearchResult(): SearchResponse { + val title = this.selectFirst("h3.caption")!!.text().trim() + val href = this.selectFirst("a")!!.attr("href") + val posterUrl = fixUrl(this.selectFirst("a > img")?.attr("src").toString()) + val type = + if (this.select("div.quality-top").isNotEmpty()) TvType.Movie else TvType.TvSeries + return if (type == TvType.Movie) { + val quality = getQualityFromString(this.select("div.quality-top").text().trim()) + return newMovieSearchResponse(title, href, TvType.Movie) { + this.posterUrl = posterUrl + this.quality = quality + } + } else { + val episode = this.select("div.last-episode > span").text().toIntOrNull() + newAnimeSearchResponse(title, href, TvType.TvSeries) { + this.posterUrl = posterUrl + addDubStatus(dubExist = false, subExist = true, subEpisodes = episode) + } + } + + } + + private fun Element.toMainSearchResult(): SearchResponse { + val title = this.selectFirst("h3.caption")!!.text().trim() + val href = this.selectFirst("a")!!.attr("href") + val posterUrl = fixUrl(this.select("a > img").attr("src").toString()) + val quality = getQualityFromString(this.select("div.quality-top").text().trim()) + return newMovieSearchResponse(title, href, TvType.Movie) { + this.posterUrl = posterUrl + this.quality = quality + } + + } + + private fun Element.toBottomSearchResult(): SearchResponse { + val title = this.selectFirst("h1.grid-title > a")!!.ownText().trim() + val href = this.selectFirst("h1.grid-title > a")!!.attr("href") + val posterUrl = fixUrl(this.selectFirst(".grid-poster > a > img")?.attr("src").toString()) + val type = if (this.select("div.quality").isNotEmpty()) TvType.Movie else TvType.TvSeries + return if (type == TvType.Movie) { + val quality = getQualityFromString(this.select("div.quality").text().trim()) + return newMovieSearchResponse(title, href, TvType.Movie) { + this.posterUrl = posterUrl + this.quality = quality + } + } else { + newTvSeriesSearchResponse(title, href, TvType.TvSeries) { + this.posterUrl = posterUrl + } + } + + } + + 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 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 { + ActorData( + Actor( + 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 + this.actors = actors + this.recommendations = recommendations + } + } + else { + newMovieLoadResponse(title, url, TvType.Movie, url) { + this.posterUrl = poster + this.year = year + this.plot = description + this.tags = tags + this.rating = rating + this.actors = actors + 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 = 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")) + } + } + + sources.apmap { + loadExtractor(it, data, callback) + } + + return true + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/RebahinProvider.kt b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/RebahinProvider.kt new file mode 100644 index 00000000..52927a94 --- /dev/null +++ b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/RebahinProvider.kt @@ -0,0 +1,326 @@ +package com.lagradost.cloudstream3.movieproviders + +import com.fasterxml.jackson.annotation.JsonProperty +import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.mvvm.logError +import com.lagradost.cloudstream3.mvvm.safeApiCall +import com.lagradost.cloudstream3.network.WebViewResolver +import com.lagradost.cloudstream3.utils.* +import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson +import org.jsoup.nodes.Element +import java.net.URI +import java.util.ArrayList + +class RebahinProvider : MainAPI() { + override var mainUrl = "http://167.88.14.149" + override var name = "Rebahin" + override val hasMainPage = true + override val lang = "id" + override val hasDownloadSupport = true + override val supportedTypes = setOf( + TvType.Movie, + TvType.TvSeries, + ) + + override suspend fun getMainPage(): 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 + addDubStatus(dubExist = false, subExist = true, subEpisodes = 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 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 { + ActorData( + Actor( + it.select("span").text() + ) + ) + } + + return if (tvType == TvType.TvSeries) { + val baseLink = document.select("div#mv-info > a").attr("href") + val episodes = app.get(baseLink).document.select("div#list-eps > a").map { + val name = it.text().replace(Regex("Server\\s?\\d"), "").trim() + name + }.distinct().map { + val name = it +// val epNum = Regex("[^r|R]\\s(\\d+)").find(it)?.groupValues?.get(1)?.toIntOrNull() + val epNum = it.replace(Regex("[^0-9]"), "").toIntOrNull() + val link = "$baseLink?ep=$epNum" + newEpisode(link) { + this.name = name + this.episode = epNum + } + } + newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodes) { + this.posterUrl = poster + this.year = year + this.plot = description + this.tags = tags + this.rating = rating + this.duration = duration + this.actors = actors + } + } else { + val episodes = document.select("div#mv-info > a").attr("href") + newMovieLoadResponse(title, url, TvType.Movie, episodes) { + this.posterUrl = poster + this.year = year + this.plot = description + this.tags = tags + this.rating = rating + this.duration = duration + this.actors = actors + } + } + } + + 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 suspend fun invokeLokalSource( + url: String, + name: 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("],")) + M3u8Helper.generateM3u8( + name, + source!!.file, + "http://172.96.161.72", + ).forEach(sourceCallback) + + val trackJson = script.data().substringAfter("tracks: [").substringBefore("],") + val track = tryParseJson>("[$trackJson]") + track?.map { + subCallback( + SubtitleFile( + "Indonesian", + (if (it.file.contains(".srt")) it.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 ResponseKotakAjair( + @JsonProperty("success") val success: Boolean, + @JsonProperty("player") val player: Player, + @JsonProperty("data") val data: List?, + @JsonProperty("captions") val captions: List? + ) + + 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( + 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 { + + val sources = if (data.contains("/play")) { + app.get(data).document.select(".server-wrapper").mapNotNull { + val iframeLink = + "${mainUrl}/iembed/?source=${it.selectFirst("div.server")?.attr("data-iframe")}" + app.get(iframeLink).document.select("iframe").attr("src") + } + } else { + val fixData = Regex("(.*?)\\?ep").find(data)?.groupValues?.get(1).toString() + val document = app.get(fixData).document + val ep = Regex("\\?ep=([0-9]+)").find(data)?.groupValues?.get(1).toString() + val title = document.selectFirst("div#list-eps > a")?.text()?.replace(Regex("[\\d]"), "") + ?.trim()?.replace("Server", "")?.trim() + document.select("div#list-eps > a:matches(${title}\\s?${ep}$)").mapNotNull { + val iframeLink = "${mainUrl}/iembed/?source=${it.attr("data-iframe")}" + app.get(iframeLink).document.select("iframe") + .attr("src") + } + } + + sources.apmap { + safeApiCall { + when { + it.startsWith("http://172.96.161.72") -> invokeLokalSource( + it, + this.name, + subtitleCallback, + callback + ) + it.startsWith("https://kotakajair.xyz") -> invokeKotakAjairSource( + it, + subtitleCallback, + callback + ) + else -> { + loadExtractor(it, data, callback) + if (it.startsWith("https://sbfull.com")) { + val response = app.get( + it, interceptor = WebViewResolver( + Regex("""\.srt""") + ) + ) + subtitleCallback.invoke( + SubtitleFile( + "Indonesian", + response.url + ) + ) + } + } + } + } + } + + return true + } + +} + diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt index a8db8562..3f851ff1 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt @@ -139,12 +139,15 @@ val extractorApis: Array = arrayOf( StreamSB8(), StreamSB9(), StreamSB10(), + SBfull(), // Streamhub(), cause Streamhub2() works Streamhub2(), FEmbed(), FeHD(), Fplayer(), + DBfilm(), + LayarKaca(), // WatchSB(), 'cause StreamSB.kt works Uqload(), Uqload1(), @@ -183,7 +186,14 @@ val extractorApis: Array = arrayOf( PlayerVoxzer(), BullStream(), - GMPlayer() + GMPlayer(), + + Blogger(), + + Hxfile(), + KotakAnimeid(), + Neonime8n(), + Neonime7n(), ) fun getExtractorApiFromName(name: String): ExtractorApi {