fix layarkaca

This commit is contained in:
alex 2023-12-31 12:07:11 +07:00
parent efaa9db40b
commit 1e2f746676
4 changed files with 117 additions and 57 deletions

View file

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 18 version = 19
cloudstream { cloudstream {

View file

@ -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"
}

View file

@ -8,29 +8,29 @@ import com.lagradost.cloudstream3.utils.*
import org.jsoup.nodes.Element import org.jsoup.nodes.Element
class LayarKacaProvider : MainAPI() { class LayarKacaProvider : MainAPI() {
override var mainUrl = "https://tv6.lk21official.wiki" override var mainUrl = "https://tv7.lk21official.wiki"
private var seriesUrl = "https://tv8.nontondrama.click" private var seriesUrl = "https://tv9.nontondrama.click"
override var name = "LayarKaca" override var name = "LayarKaca"
override val hasMainPage = true override val hasMainPage = true
override var lang = "id" override var lang = "id"
override val supportedTypes = setOf( override val supportedTypes = setOf(
TvType.Movie, TvType.Movie,
TvType.TvSeries, TvType.TvSeries,
TvType.AsianDrama TvType.AsianDrama
) )
override val mainPage = mainPageOf( override val mainPage = mainPageOf(
"$mainUrl/populer/page/" to "Film Terplopuler", "$mainUrl/populer/page/" to "Film Terplopuler",
"$mainUrl/rating/page/" to "Film Berdasarkan IMDb Rating", "$mainUrl/rating/page/" to "Film Berdasarkan IMDb Rating",
"$mainUrl/most-commented/page/" to "Film Dengan Komentar Terbanyak", "$mainUrl/most-commented/page/" to "Film Dengan Komentar Terbanyak",
"$seriesUrl/latest/page/" to "Series Terbaru", "$seriesUrl/latest-series/page/" to "Series Terbaru",
"$seriesUrl/series/asian/page/" to "Film Asian Terbaru", "$seriesUrl/series/asian/page/" to "Film Asian Terbaru",
"$mainUrl/latest/page/" to "Film Upload Terbaru", "$mainUrl/latest/page/" to "Film Upload Terbaru",
) )
override suspend fun getMainPage( override suspend fun getMainPage(
page: Int, page: Int,
request: MainPageRequest request: MainPageRequest
): HomePageResponse { ): HomePageResponse {
val document = app.get(request.data + page).document val document = app.get(request.data + page).document
val home = document.select("article.mega-item").mapNotNull { val home = document.select("article.mega-item").mapNotNull {
@ -54,10 +54,10 @@ class LayarKacaProvider : MainAPI() {
val href = fixUrl(this.selectFirst("a")!!.attr("href")) val href = fixUrl(this.selectFirst("a")!!.attr("href"))
val posterUrl = fixUrlNull(this.selectFirst("img")?.attr("src")) val posterUrl = fixUrlNull(this.selectFirst("img")?.attr("src"))
val type = 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) { return if (type == TvType.TvSeries) {
val episode = this.selectFirst("div.last-episode span")?.text()?.filter { it.isDigit() } val episode = this.selectFirst("div.last-episode span")?.text()?.filter { it.isDigit() }
?.toIntOrNull() ?.toIntOrNull()
newAnimeSearchResponse(title, href, TvType.TvSeries) { newAnimeSearchResponse(title, href, TvType.TvSeries) {
this.posterUrl = posterUrl this.posterUrl = posterUrl
addSub(episode) 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 tags = document.select("div.content > div:nth-child(5) > h3 > a").map { it.text() }
val year = Regex("\\d, (\\d+)").find( 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() )?.groupValues?.get(1).toString().toIntOrNull()
val tvType = if (document.select("div.serial-wrapper") val tvType = if (document.select("div.serial-wrapper")
.isNotEmpty() .isNotEmpty()
) TvType.TvSeries else TvType.Movie ) TvType.TvSeries else TvType.Movie
val description = document.select("div.content > blockquote").text().trim() val description = document.select("div.content > blockquote").text().trim()
val trailer = document.selectFirst("div.action-player li > a.fancybox")?.attr("href") val trailer = document.selectFirst("div.action-player li > a.fancybox")?.attr("href")
val rating = 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 = 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 recommendations = document.select("div.row.item-media").map {
val recName = it.selectFirst("h3")?.text()?.trim().toString() val recName = it.selectFirst("h3")?.text()?.trim().toString()
val recHref = it.selectFirst(".content-media > a")!!.attr("href") val recHref = it.selectFirst(".content-media > a")!!.attr("href")
val recPosterUrl = 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) { newTvSeriesSearchResponse(recName, recHref, TvType.TvSeries) {
this.posterUrl = recPosterUrl this.posterUrl = recPosterUrl
} }
@ -119,12 +119,12 @@ class LayarKacaProvider : MainAPI() {
val href = fixUrl(it.attr("href")) val href = fixUrl(it.attr("href"))
val episode = it.text().toIntOrNull() val episode = it.text().toIntOrNull()
val season = val season =
it.attr("href").substringAfter("season-").substringBefore("-").toIntOrNull() it.attr("href").substringAfter("season-").substringBefore("-").toIntOrNull()
Episode( Episode(
href, href,
"Episode $episode", "Episode $episode",
season, season,
episode, episode,
) )
}.reversed() }.reversed()
newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodes) { newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodes) {
@ -152,10 +152,10 @@ class LayarKacaProvider : MainAPI() {
} }
override suspend fun loadLinks( override suspend fun loadLinks(
data: String, data: String,
isCasting: Boolean, isCasting: Boolean,
subtitleCallback: (SubtitleFile) -> Unit, subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit callback: (ExtractorLink) -> Unit
): Boolean { ): Boolean {
val document = app.get(data).document 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"
}

View file

@ -12,5 +12,6 @@ class LayarKacaProviderPlugin: Plugin() {
registerMainAPI(LayarKacaProvider()) registerMainAPI(LayarKacaProvider())
registerExtractorAPI(Emturbovid()) registerExtractorAPI(Emturbovid())
registerExtractorAPI(Furher()) registerExtractorAPI(Furher())
registerExtractorAPI(Hownetwork())
} }
} }