mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
fix #254
This commit is contained in:
parent
62d9783705
commit
f511569c34
8 changed files with 137 additions and 33 deletions
|
@ -1,5 +1,5 @@
|
|||
// use an integer for version numbers
|
||||
version = 8
|
||||
version = 9
|
||||
|
||||
|
||||
cloudstream {
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package com.hexated
|
||||
|
||||
import com.lagradost.cloudstream3.extractors.Filesim
|
||||
import com.lagradost.cloudstream3.extractors.Gdriveplayer
|
||||
import com.lagradost.cloudstream3.extractors.StreamSB
|
||||
import com.lagradost.cloudstream3.extractors.*
|
||||
|
||||
class Doods : DoodLaExtractor() {
|
||||
override var name = "Doods"
|
||||
override var mainUrl = "https://doods.pro"
|
||||
}
|
||||
|
||||
class Dutamovie21 : StreamSB() {
|
||||
override var name = "Dutamovie21"
|
||||
|
|
|
@ -18,6 +18,7 @@ class GomovPlugin: Plugin() {
|
|||
registerExtractorAPI(DbGdriveplayer())
|
||||
registerExtractorAPI(Dutamovie21())
|
||||
registerExtractorAPI(Embedwish())
|
||||
registerExtractorAPI(Doods())
|
||||
registerExtractorAPI(Lylxan())
|
||||
}
|
||||
}
|
|
@ -26,16 +26,30 @@ class Nodrakorid : DutaMovie() {
|
|||
is TvSeriesLoadResponse -> {
|
||||
val doc = app.get(url).document
|
||||
this.comingSoon = false
|
||||
this.episodes = doc.select("div.entry-content p:contains(Episode)").distinctBy {
|
||||
this.episodes = when {
|
||||
doc.select("div.vid-episodes a, div.gmr-listseries a").isNotEmpty() -> this.episodes
|
||||
doc.select("div#download").isEmpty() -> {
|
||||
doc.select("div.entry-content p:contains(Episode)").distinctBy {
|
||||
it.text()
|
||||
}.map { eps ->
|
||||
val num = eps.text()
|
||||
}.mapNotNull { eps ->
|
||||
val endSibling = eps.nextElementSiblings().select("p:contains(Episode)").firstOrNull() ?: eps.nextElementSiblings().select("div.content-moviedata").firstOrNull()
|
||||
val siblings = eps.nextElementSiblingsUntil(endSibling).map { ele ->
|
||||
ele.ownText().filter { it.isDigit() }.toIntOrNull() to ele.select("a")
|
||||
.map { it.attr("href") to it.text() }
|
||||
}.filter { it.first != null }
|
||||
Episode(siblings.toJson(), episode = Regex("Episode\\s?([0-9]+)").find(num)?.groupValues?.getOrNull(1)?.toIntOrNull())
|
||||
Episode(siblings.toJson(), episode = eps.text().toEpisode())
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
doc.select("div#download h3.title-download").mapNotNull { eps ->
|
||||
val siblings = eps.nextElementSibling()?.select("li")?.map { ele ->
|
||||
ele.text().filter { it.isDigit() }.toIntOrNull() to ele.select("a").map {
|
||||
it.attr("href") to it.text().split(" ").first()
|
||||
}
|
||||
}?.filter { it.first != null }
|
||||
Episode(siblings?.toJson() ?: return@mapNotNull null, episode = eps.text().toEpisode())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -83,6 +97,10 @@ class Nodrakorid : DutaMovie() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun String.toEpisode() : Int? {
|
||||
return Regex("(?i)Episode\\s?([0-9]+)").find(this)?.groupValues?.getOrNull(1)?.toIntOrNull()
|
||||
}
|
||||
|
||||
private fun getBaseUrl(url: String): String {
|
||||
return URI(url).let {
|
||||
"${it.scheme}://${it.host}"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// use an integer for version numbers
|
||||
version = 14
|
||||
version = 15
|
||||
|
||||
|
||||
cloudstream {
|
||||
|
|
|
@ -5,8 +5,12 @@ 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.network.CloudflareKiller
|
||||
import com.lagradost.cloudstream3.utils.*
|
||||
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
||||
import okhttp3.Interceptor
|
||||
import okhttp3.Response
|
||||
import org.jsoup.Jsoup
|
||||
import org.jsoup.nodes.Element
|
||||
import java.net.URI
|
||||
|
||||
|
@ -17,6 +21,8 @@ class IdlixProvider : MainAPI() {
|
|||
override val hasMainPage = true
|
||||
override var lang = "id"
|
||||
override val hasDownloadSupport = true
|
||||
private val cloudflareKiller by lazy { CloudflareKiller() }
|
||||
private val interceptor by lazy { CloudflareInterceptor(cloudflareKiller) }
|
||||
override val supportedTypes = setOf(
|
||||
TvType.Movie,
|
||||
TvType.TvSeries,
|
||||
|
@ -50,9 +56,9 @@ class IdlixProvider : MainAPI() {
|
|||
val url = request.data.split("?")
|
||||
val nonPaged = request.name == "Featured" && page <= 1
|
||||
val req = if (nonPaged) {
|
||||
app.get(request.data)
|
||||
app.get(request.data, interceptor = interceptor)
|
||||
} else {
|
||||
app.get("${url.first()}$page/?${url.lastOrNull()}")
|
||||
app.get("${url.first()}$page/?${url.lastOrNull()}", interceptor = interceptor)
|
||||
}
|
||||
mainUrl = getBaseUrl(req.url)
|
||||
val document = req.document
|
||||
|
@ -92,12 +98,13 @@ class IdlixProvider : MainAPI() {
|
|||
return newMovieSearchResponse(title, href, TvType.Movie) {
|
||||
this.posterUrl = posterUrl
|
||||
this.quality = quality
|
||||
posterHeaders = cloudflareKiller.getCookieHeaders(mainUrl).toMap()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override suspend fun search(query: String): List<SearchResponse> {
|
||||
val req = app.get("$mainUrl/search/$query")
|
||||
val req = app.get("$mainUrl/search/$query", interceptor = interceptor)
|
||||
mainUrl = getBaseUrl(req.url)
|
||||
val document = req.document
|
||||
return document.select("div.result-item").map {
|
||||
|
@ -107,12 +114,13 @@ class IdlixProvider : MainAPI() {
|
|||
val posterUrl = it.selectFirst("img")!!.attr("src").toString()
|
||||
newMovieSearchResponse(title, href, TvType.TvSeries) {
|
||||
this.posterUrl = posterUrl
|
||||
posterHeaders = cloudflareKiller.getCookieHeaders(mainUrl).toMap()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun load(url: String): LoadResponse {
|
||||
val request = app.get(url)
|
||||
val request = app.get(url, interceptor = interceptor, referer = "$directUrl/")
|
||||
directUrl = getBaseUrl(request.url)
|
||||
val document = request.document
|
||||
val title =
|
||||
|
@ -141,6 +149,7 @@ class IdlixProvider : MainAPI() {
|
|||
val recPosterUrl = it.selectFirst("img")?.attr("src").toString()
|
||||
newTvSeriesSearchResponse(recName, recHref, TvType.TvSeries) {
|
||||
this.posterUrl = recPosterUrl
|
||||
posterHeaders = cloudflareKiller.getCookieHeaders(mainUrl).toMap()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -170,6 +179,7 @@ class IdlixProvider : MainAPI() {
|
|||
addActors(actors)
|
||||
this.recommendations = recommendations
|
||||
addTrailer(trailer)
|
||||
posterHeaders = cloudflareKiller.getCookieHeaders(mainUrl).toMap()
|
||||
}
|
||||
} else {
|
||||
newMovieLoadResponse(title, url, TvType.Movie, url) {
|
||||
|
@ -181,6 +191,7 @@ class IdlixProvider : MainAPI() {
|
|||
addActors(actors)
|
||||
this.recommendations = recommendations
|
||||
addTrailer(trailer)
|
||||
posterHeaders = cloudflareKiller.getCookieHeaders(mainUrl).toMap()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -192,7 +203,7 @@ class IdlixProvider : MainAPI() {
|
|||
callback: (ExtractorLink) -> Unit
|
||||
): Boolean {
|
||||
|
||||
val document = app.get(data).document
|
||||
val document = app.get(data, interceptor = interceptor, referer = "$directUrl/").document
|
||||
val id = document.select("meta#dooplay-ajax-counter").attr("data-postid")
|
||||
val type = if (data.contains("/movie/")) "movie" else "tv"
|
||||
|
||||
|
@ -203,15 +214,17 @@ class IdlixProvider : MainAPI() {
|
|||
val source = app.post(
|
||||
url = "$directUrl/wp-admin/admin-ajax.php", data = mapOf(
|
||||
"action" to "doo_player_ajax", "post" to id, "nume" to nume, "type" to type
|
||||
), headers = mapOf("X-Requested-With" to "XMLHttpRequest"), referer = data
|
||||
), headers = mapOf("X-Requested-With" to "XMLHttpRequest"), referer = data, interceptor = interceptor
|
||||
).let { tryParseJson<ResponseHash>(it.text) } ?: return@safeApiCall
|
||||
|
||||
var decrypted = AesHelper.cryptoAESHandler(source.embed_url,key.toByteArray(), false)?.fixBloat() ?: return@safeApiCall
|
||||
val password = if(source.key?.startsWith("\\x") == true) source.key else key
|
||||
var decrypted = AesHelper.cryptoAESHandler(source.embed_url, password.toByteArray(), false)?.fixBloat() ?: return@safeApiCall
|
||||
|
||||
if (decrypted.startsWith("https://uservideo.xyz")) {
|
||||
decrypted = app.get(decrypted).document.select("iframe").attr("src")
|
||||
}
|
||||
loadExtractor(decrypted, "$directUrl/", subtitleCallback, callback)
|
||||
|
||||
getUrl(decrypted, "$directUrl/", subtitleCallback, callback)
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -219,13 +232,84 @@ class IdlixProvider : MainAPI() {
|
|||
return true
|
||||
}
|
||||
|
||||
class CloudflareInterceptor(private val cloudflareKiller: CloudflareKiller): Interceptor {
|
||||
override fun intercept(chain: Interceptor.Chain): Response {
|
||||
val request = chain.request()
|
||||
val response = chain.proceed(request)
|
||||
val doc = Jsoup.parse(response.peekBody(1024 * 1024).string())
|
||||
if (doc.select("title").text() == "Just a moment...") {
|
||||
return cloudflareKiller.intercept(chain)
|
||||
}
|
||||
return response
|
||||
}
|
||||
}
|
||||
|
||||
private fun String.fixBloat() : String {
|
||||
return this.replace("\"", "").replace("\\", "")
|
||||
}
|
||||
|
||||
private suspend fun getUrl(
|
||||
url: String,
|
||||
referer: String?,
|
||||
subtitleCallback: (SubtitleFile) -> Unit,
|
||||
callback: (ExtractorLink) -> Unit
|
||||
) {
|
||||
val document = app.get(url, referer = "$mainUrl/").document
|
||||
val hash = url.split("/").last().substringAfter("data=")
|
||||
|
||||
val m3uLink = app.post(
|
||||
url = "$mainUrl/player/index.php?data=$hash&do=getVideo",
|
||||
data = mapOf("hash" to hash, "r" to "$referer"),
|
||||
referer = referer,
|
||||
headers = mapOf("X-Requested-With" to "XMLHttpRequest")
|
||||
).parsed<ResponseSource>().videoSource
|
||||
|
||||
M3u8Helper.generateM3u8(
|
||||
this.name,
|
||||
m3uLink,
|
||||
"$referer",
|
||||
).forEach(callback)
|
||||
|
||||
|
||||
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<List<Tracks>>("[$subData]")?.map { subtitle ->
|
||||
subtitleCallback.invoke(
|
||||
SubtitleFile(
|
||||
getLanguage(subtitle.label ?: ""),
|
||||
subtitle.file
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getLanguage(str: String): String {
|
||||
return when {
|
||||
str.contains("indonesia", true) || str
|
||||
.contains("bahasa", true) -> "Indonesian"
|
||||
else -> str
|
||||
}
|
||||
}
|
||||
|
||||
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?,
|
||||
)
|
||||
|
||||
data class ResponseHash(
|
||||
@JsonProperty("embed_url") val embed_url: String,
|
||||
@JsonProperty("key") val key: String,
|
||||
@JsonProperty("key") val key: String?,
|
||||
@JsonProperty("type") val type: String?,
|
||||
)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// use an integer for version numbers
|
||||
version = 15
|
||||
version = 16
|
||||
|
||||
|
||||
cloudstream {
|
||||
|
|
|
@ -9,7 +9,7 @@ import org.jsoup.nodes.Element
|
|||
import java.net.URLDecoder
|
||||
|
||||
class LayarKacaProvider : MainAPI() {
|
||||
override var mainUrl = "https://tv1.lk21official.pro"
|
||||
override var mainUrl = "https://tv3.lk21official.pro"
|
||||
private var seriesUrl = "https://tv1.nontondrama.click"
|
||||
override var name = "LayarKaca"
|
||||
override val hasMainPage = true
|
||||
|
@ -72,11 +72,11 @@ class LayarKacaProvider : MainAPI() {
|
|||
}
|
||||
|
||||
override suspend fun search(query: String): List<SearchResponse> {
|
||||
val document = app.get("$mainUrl/?s=$query").document
|
||||
return document.select("div.search-item").map {
|
||||
val title = it.selectFirst("h2 > a")!!.text().trim()
|
||||
val href = fixUrl(it.selectFirst("a")!!.attr("href"))
|
||||
val posterUrl = fixUrl(it.selectFirst("img.img-thumbnail")?.attr("src").toString())
|
||||
val document = app.get("$mainUrl/search.php?s=$query").document
|
||||
return document.select("div.search-item").mapNotNull {
|
||||
val title = it.selectFirst("a")?.attr("title") ?: ""
|
||||
val href = fixUrl(it.selectFirst("a")?.attr("href") ?: return@mapNotNull null)
|
||||
val posterUrl = fixUrlNull(it.selectFirst("img.img-thumbnail")?.attr("src"))
|
||||
newTvSeriesSearchResponse(title, href, TvType.TvSeries) {
|
||||
this.posterUrl = posterUrl
|
||||
}
|
||||
|
@ -172,8 +172,6 @@ class LayarKacaProvider : MainAPI() {
|
|||
return app.get(this, referer = "$seriesUrl/").document.select("div.embed iframe").attr("src")
|
||||
}
|
||||
|
||||
private fun decode(input: String): String = URLDecoder.decode(input, "utf-8").replace(" ", "%20")
|
||||
|
||||
}
|
||||
|
||||
open class Emturbovid : ExtractorApi() {
|
||||
|
|
Loading…
Reference in a new issue