Skip to content

Commit

Permalink
fix layarkaca
Browse files Browse the repository at this point in the history
  • Loading branch information
alex committed Dec 31, 2023
1 parent efaa9db commit 1e2f746
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 57 deletions.
2 changes: 1 addition & 1 deletion LayarKacaProvider/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// use an integer for version numbers
version = 18
version = 19


cloudstream {
Expand Down
86 changes: 86 additions & 0 deletions LayarKacaProvider/src/main/kotlin/com/hexated/Extractors.kt
Original file line number Diff line number Diff line change
@@ -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<Sources>()

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>
) {
data class Data(
val file: String,
val label: String?,
)
}
}

class Furher : Filesim() {
override val name = "Furher"
override var mainUrl = "https://furher.in"
}
85 changes: 29 additions & 56 deletions LayarKacaProvider/src/main/kotlin/com/hexated/LayarKacaProvider.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
Expand Down Expand Up @@ -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
}
Expand All @@ -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) {
Expand Down Expand Up @@ -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
Expand All @@ -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"
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ class LayarKacaProviderPlugin: Plugin() {
registerMainAPI(LayarKacaProvider())
registerExtractorAPI(Emturbovid())
registerExtractorAPI(Furher())
registerExtractorAPI(Hownetwork())
}
}

0 comments on commit 1e2f746

Please sign in to comment.