fixed HDrezka

This commit is contained in:
hexated 2023-01-21 05:06:45 +07:00
parent f3b06e2a3b
commit 9d439f417d
4 changed files with 59 additions and 64 deletions

View file

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

View file

@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addActors
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
import com.lagradost.cloudstream3.mvvm.suspendSafeApiCall
import com.lagradost.cloudstream3.utils.AppUtils.toJson
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
import com.lagradost.cloudstream3.utils.ExtractorLink
@ -91,7 +90,7 @@ class HDrezkaProvider : MainAPI() {
?: document.selectFirst("div.b-post__title h1")?.text()?.trim()).toString()
val poster = fixUrlNull(document.selectFirst("div.b-sidecover img")?.attr("src"))
val tags =
document.select("table.b-post__info > tbody > tr:nth-child(5) span[itemprop=genre]")
document.select("table.b-post__info > tbody > tr:contains(Жанр) span[itemprop=genre]")
.map { it.text() }
val year = document.select("div.film-info > div:nth-child(2) a").text().toIntOrNull()
val tvType = if (document.select("div#simple-episodes-tabs")
@ -108,9 +107,10 @@ class HDrezkaProvider : MainAPI() {
val rating =
document.selectFirst("table.b-post__info > tbody > tr:nth-child(1) span.bold")?.text()
.toRatingInt()
val actors = document.select("table.b-post__info > tbody > tr:last-child span.item").map {
val actors =
document.select("table.b-post__info > tbody > tr:last-child span.item").mapNotNull {
Actor(
it.selectFirst("span[itemprop=name]")?.text().toString(),
it.selectFirst("span[itemprop=name]")?.text() ?: return@mapNotNull null,
it.selectFirst("span[itemprop=actor]")?.attr("data-photo")
)
}
@ -273,35 +273,25 @@ class HDrezkaProvider : MainAPI() {
) {
decryptStreamUrl(url).split(",").map { links ->
val quality =
Regex("\\[([0-9]*p.*?)]").find(links)?.groupValues?.getOrNull(1)
.toString().trim()
links.replace("[$quality]", "").split("or").map { it.trim() }
.map { link ->
if (link.endsWith(".m3u8")) {
Regex("\\[([0-9]{3,4}p\\s?\\w*?)]").find(links)?.groupValues?.getOrNull(1)
?.trim() ?: return@map null
links.replace("[$quality]", "").split(" or ")
.map {
val link = it.trim()
val type = if(link.contains(".m3u8")) "(Main)" else "(Backup)"
cleanCallback(
"$source (Main)",
"$source $type",
link,
quality,
true,
link.contains(".m3u8"),
sourceCallback,
)
} else {
cleanCallback(
"$source (Backup)",
link,
quality,
false,
sourceCallback,
)
}
}
}
subtitle.split(",").map { sub ->
val language =
Regex("\\[(.*)]").find(sub)?.groupValues?.getOrNull(1)
.toString()
Regex("\\[(.*)]").find(sub)?.groupValues?.getOrNull(1) ?: return@map null
val link = sub.replace("[$language]", "").trim()
subCallback.invoke(
SubtitleFile(
@ -339,7 +329,6 @@ class HDrezkaProvider : MainAPI() {
}
} else {
res.server?.apmap { server ->
suspendSafeApiCall {
app.post(
url = "$mainUrl/ajax/get_cdn_series/?t=${Date().time}",
data = mapOf(
@ -366,7 +355,6 @@ class HDrezkaProvider : MainAPI() {
}
}
}
}
return true
}

View file

@ -166,21 +166,21 @@ object SoraExtractor : SoraStream() {
app.get("https://voidboost.net/serial/$token/iframe?s=$season&e=$episode&h=dbgo.fun").document.select(
"script"
).find { it.data().contains("CDNplayerConfig =") }?.data()
}
} ?: return
val source =
Regex("['|\"]file['|\"]:\\s['|\"](#\\S+?)['|\"]").find(script.toString())?.groupValues?.get(
Regex("['|\"]file['|\"]:\\s['|\"](#\\S+?)['|\"]").find(script)?.groupValues?.get(
1
) ?: return
val subtitle =
Regex("['|\"]subtitle['|\"]:\\s['|\"](\\S+?)['|\"]").find(script.toString())?.groupValues?.get(
Regex("['|\"]subtitle['|\"]:\\s['|\"](\\S+?)['|\"]").find(script)?.groupValues?.get(
1
)
val ref = getBaseUrl(iframeDbgo)
decryptStreamUrl(source).split(",").map { links ->
val quality =
Regex("\\[([0-9]*p.*?)]").find(links)?.groupValues?.getOrNull(1).toString().trim()
Regex("\\[([0-9]*p.*?)]").find(links)?.groupValues?.getOrNull(1)?.trim() ?: return@map null
links.replace("[$quality]", "").split(" or ").map { it.trim() }.map { link ->
val name = if (link.contains(".m3u8")) "Dbgo (Main)" else "Dbgo (Backup)"
callback.invoke(
@ -200,11 +200,11 @@ object SoraExtractor : SoraStream() {
}
subtitle?.split(",")?.map { sub ->
val language = Regex("\\[(.*)]").find(sub)?.groupValues?.getOrNull(1).toString()
val language = Regex("\\[(.*)]").find(sub)?.groupValues?.getOrNull(1) ?: return@map null
val link = sub.replace("[$language]", "").trim()
subtitleCallback.invoke(
SubtitleFile(
language, link
getDbgoLanguage(language), link
)
)
}

View file

@ -5,7 +5,6 @@ import com.hexated.SoraStream.Companion.filmxyAPI
import com.hexated.SoraStream.Companion.gdbot
import com.hexated.SoraStream.Companion.kamyrollAPI
import com.hexated.SoraStream.Companion.tvMoviesAPI
import com.lagradost.cloudstream3.APIHolder
import com.lagradost.cloudstream3.APIHolder.getCaptchaToken
import com.lagradost.cloudstream3.app
import com.lagradost.cloudstream3.base64Decode
@ -603,6 +602,14 @@ fun getVipLanguage(str: String): String {
}
}
fun getDbgoLanguage(str: String): String {
return when (str) {
"Русский" -> "Russian"
"Українська" -> "Ukrainian"
else -> str
}
}
fun getBaseUrl(url: String): String {
return URI(url).let {
"${it.scheme}://${it.host}"