From 1e2f7466768d5f21fec91441efebb11b7b16a514 Mon Sep 17 00:00:00 2001 From: alex Date: Sun, 31 Dec 2023 12:07:11 +0700 Subject: [PATCH] fix layarkaca --- LayarKacaProvider/build.gradle.kts | 2 +- .../src/main/kotlin/com/hexated/Extractors.kt | 86 +++++++++++++++++++ .../kotlin/com/hexated/LayarKacaProvider.kt | 85 +++++++----------- .../com/hexated/LayarKacaProviderPlugin.kt | 1 + 4 files changed, 117 insertions(+), 57 deletions(-) create mode 100644 LayarKacaProvider/src/main/kotlin/com/hexated/Extractors.kt diff --git a/LayarKacaProvider/build.gradle.kts b/LayarKacaProvider/build.gradle.kts index 85bf1cb99..7003fef23 100644 --- a/LayarKacaProvider/build.gradle.kts +++ b/LayarKacaProvider/build.gradle.kts @@ -1,5 +1,5 @@ // use an integer for version numbers -version = 18 +version = 19 cloudstream { diff --git a/LayarKacaProvider/src/main/kotlin/com/hexated/Extractors.kt b/LayarKacaProvider/src/main/kotlin/com/hexated/Extractors.kt new file mode 100644 index 000000000..8aa99fd9d --- /dev/null +++ b/LayarKacaProvider/src/main/kotlin/com/hexated/Extractors.kt @@ -0,0 +1,86 @@ +package com.hexated + +import com.lagradost.cloudstream3.SubtitleFile +import com.lagradost.cloudstream3.app +import com.lagradost.cloudstream3.extractors.Filesim +import com.lagradost.cloudstream3.utils.ExtractorApi +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.INFER_TYPE +import com.lagradost.cloudstream3.utils.M3u8Helper +import com.lagradost.cloudstream3.utils.getQualityFromName + +open class Emturbovid : ExtractorApi() { + override val name = "Emturbovid" + override val mainUrl = "https://emturbovid.com" + override val requiresReferer = true + + override suspend fun getUrl( + url: String, + referer: String?, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ) { + val response = app.get(url, referer = referer) + val m3u8 = Regex("[\"'](.*?master\\.m3u8.*?)[\"']").find(response.text)?.groupValues?.getOrNull(1) + M3u8Helper.generateM3u8( + name, + m3u8 ?: return, + mainUrl + ).forEach(callback) + } + +} + +open class Hownetwork : ExtractorApi() { + override val name = "Hownetwork" + override val mainUrl = "https://stream.hownetwork.xyz" + override val requiresReferer = true + + override suspend fun getUrl( + url: String, + referer: String?, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ) { + val id = url.substringAfter("id=") + val res = app.post( + "$mainUrl/api.php?id=$id", + data = mapOf( + "r" to "https://playeriframe.shop/", + "d" to "stream.hownetwork.xyz", + ), + referer = url, + headers = mapOf( + "X-Requested-With" to "XMLHttpRequest" + ) + ).parsedSafe() + + res?.data?.map { + callback.invoke( + ExtractorLink( + this.name, + this.name, + it.file, + url, + getQualityFromName(it.label), + INFER_TYPE + ) + ) + } + + } + + data class Sources( + val data: ArrayList + ) { + data class Data( + val file: String, + val label: String?, + ) + } +} + +class Furher : Filesim() { + override val name = "Furher" + override var mainUrl = "https://furher.in" +} \ 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 index 552e412e9..05b9dcd09 100644 --- a/LayarKacaProvider/src/main/kotlin/com/hexated/LayarKacaProvider.kt +++ b/LayarKacaProvider/src/main/kotlin/com/hexated/LayarKacaProvider.kt @@ -8,29 +8,29 @@ import com.lagradost.cloudstream3.utils.* import org.jsoup.nodes.Element class LayarKacaProvider : MainAPI() { - override var mainUrl = "https://tv6.lk21official.wiki" - private var seriesUrl = "https://tv8.nontondrama.click" + override var mainUrl = "https://tv7.lk21official.wiki" + private var seriesUrl = "https://tv9.nontondrama.click" override var name = "LayarKaca" override val hasMainPage = true override var lang = "id" override val supportedTypes = setOf( - TvType.Movie, - TvType.TvSeries, - TvType.AsianDrama + TvType.Movie, + TvType.TvSeries, + TvType.AsianDrama ) override val mainPage = mainPageOf( - "$mainUrl/populer/page/" to "Film Terplopuler", - "$mainUrl/rating/page/" to "Film Berdasarkan IMDb Rating", - "$mainUrl/most-commented/page/" to "Film Dengan Komentar Terbanyak", - "$seriesUrl/latest/page/" to "Series Terbaru", - "$seriesUrl/series/asian/page/" to "Film Asian Terbaru", - "$mainUrl/latest/page/" to "Film Upload Terbaru", + "$mainUrl/populer/page/" to "Film Terplopuler", + "$mainUrl/rating/page/" to "Film Berdasarkan IMDb Rating", + "$mainUrl/most-commented/page/" to "Film Dengan Komentar Terbanyak", + "$seriesUrl/latest-series/page/" to "Series Terbaru", + "$seriesUrl/series/asian/page/" to "Film Asian Terbaru", + "$mainUrl/latest/page/" to "Film Upload Terbaru", ) override suspend fun getMainPage( - page: Int, - request: MainPageRequest + page: Int, + request: MainPageRequest ): HomePageResponse { val document = app.get(request.data + page).document val home = document.select("article.mega-item").mapNotNull { @@ -54,10 +54,10 @@ class LayarKacaProvider : MainAPI() { val href = fixUrl(this.selectFirst("a")!!.attr("href")) val posterUrl = fixUrlNull(this.selectFirst("img")?.attr("src")) val type = - if (this.selectFirst("div.last-episode") == null) TvType.Movie else TvType.TvSeries + if (this.selectFirst("div.last-episode") == null) TvType.Movie else TvType.TvSeries return if (type == TvType.TvSeries) { val episode = this.selectFirst("div.last-episode span")?.text()?.filter { it.isDigit() } - ?.toIntOrNull() + ?.toIntOrNull() newAnimeSearchResponse(title, href, TvType.TvSeries) { this.posterUrl = posterUrl addSub(episode) @@ -92,23 +92,23 @@ class LayarKacaProvider : MainAPI() { 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() + 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() + .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() + 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() } + 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()) + fixUrl(it.selectFirst(".poster-media > a > img")?.attr("src").toString()) newTvSeriesSearchResponse(recName, recHref, TvType.TvSeries) { this.posterUrl = recPosterUrl } @@ -119,12 +119,12 @@ class LayarKacaProvider : MainAPI() { val href = fixUrl(it.attr("href")) val episode = it.text().toIntOrNull() val season = - it.attr("href").substringAfter("season-").substringBefore("-").toIntOrNull() + it.attr("href").substringAfter("season-").substringBefore("-").toIntOrNull() Episode( - href, - "Episode $episode", - season, - episode, + href, + "Episode $episode", + season, + episode, ) }.reversed() newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodes) { @@ -152,10 +152,10 @@ class LayarKacaProvider : MainAPI() { } override suspend fun loadLinks( - data: String, - isCasting: Boolean, - subtitleCallback: (SubtitleFile) -> Unit, - callback: (ExtractorLink) -> Unit + data: String, + isCasting: Boolean, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit ): Boolean { val document = app.get(data).document @@ -173,30 +173,3 @@ class LayarKacaProvider : MainAPI() { } } - -open class Emturbovid : ExtractorApi() { - override val name = "Emturbovid" - override val mainUrl = "https://emturbovid.com" - override val requiresReferer = true - - override suspend fun getUrl( - url: String, - referer: String?, - subtitleCallback: (SubtitleFile) -> Unit, - callback: (ExtractorLink) -> Unit - ) { - val response = app.get(url, referer = referer) - val m3u8 = Regex("[\"'](.*?master\\.m3u8.*?)[\"']").find(response.text)?.groupValues?.getOrNull(1) - M3u8Helper.generateM3u8( - name, - m3u8 ?: return, - mainUrl - ).forEach(callback) - } - -} - -class Furher : Filesim() { - override val name = "Furher" - override var mainUrl = "https://furher.in" -} diff --git a/LayarKacaProvider/src/main/kotlin/com/hexated/LayarKacaProviderPlugin.kt b/LayarKacaProvider/src/main/kotlin/com/hexated/LayarKacaProviderPlugin.kt index 9a73cdc16..d3a57242f 100644 --- a/LayarKacaProvider/src/main/kotlin/com/hexated/LayarKacaProviderPlugin.kt +++ b/LayarKacaProvider/src/main/kotlin/com/hexated/LayarKacaProviderPlugin.kt @@ -12,5 +12,6 @@ class LayarKacaProviderPlugin: Plugin() { registerMainAPI(LayarKacaProvider()) registerExtractorAPI(Emturbovid()) registerExtractorAPI(Furher()) + registerExtractorAPI(Hownetwork()) } } \ No newline at end of file