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 // use an integer for version numbers
version = 2 version = 3
cloudstream { cloudstream {

View file

@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addActors import com.lagradost.cloudstream3.LoadResponse.Companion.addActors
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer 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.toJson
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.ExtractorLink
@ -91,7 +90,7 @@ class HDrezkaProvider : MainAPI() {
?: document.selectFirst("div.b-post__title h1")?.text()?.trim()).toString() ?: document.selectFirst("div.b-post__title h1")?.text()?.trim()).toString()
val poster = fixUrlNull(document.selectFirst("div.b-sidecover img")?.attr("src")) val poster = fixUrlNull(document.selectFirst("div.b-sidecover img")?.attr("src"))
val tags = 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() } .map { it.text() }
val year = document.select("div.film-info > div:nth-child(2) a").text().toIntOrNull() val year = document.select("div.film-info > div:nth-child(2) a").text().toIntOrNull()
val tvType = if (document.select("div#simple-episodes-tabs") val tvType = if (document.select("div#simple-episodes-tabs")
@ -108,12 +107,13 @@ class HDrezkaProvider : MainAPI() {
val rating = val rating =
document.selectFirst("table.b-post__info > tbody > tr:nth-child(1) span.bold")?.text() document.selectFirst("table.b-post__info > tbody > tr:nth-child(1) span.bold")?.text()
.toRatingInt() .toRatingInt()
val actors = document.select("table.b-post__info > tbody > tr:last-child span.item").map { val actors =
Actor( document.select("table.b-post__info > tbody > tr:last-child span.item").mapNotNull {
it.selectFirst("span[itemprop=name]")?.text().toString(), Actor(
it.selectFirst("span[itemprop=actor]")?.attr("data-photo") it.selectFirst("span[itemprop=name]")?.text() ?: return@mapNotNull null,
) it.selectFirst("span[itemprop=actor]")?.attr("data-photo")
} )
}
val recommendations = document.select("div.b-sidelist div.b-content__inline_item").map { val recommendations = document.select("div.b-sidelist div.b-content__inline_item").map {
it.toSearchResult() it.toSearchResult()
@ -273,35 +273,25 @@ class HDrezkaProvider : MainAPI() {
) { ) {
decryptStreamUrl(url).split(",").map { links -> decryptStreamUrl(url).split(",").map { links ->
val quality = val quality =
Regex("\\[([0-9]*p.*?)]").find(links)?.groupValues?.getOrNull(1) Regex("\\[([0-9]{3,4}p\\s?\\w*?)]").find(links)?.groupValues?.getOrNull(1)
.toString().trim() ?.trim() ?: return@map null
links.replace("[$quality]", "").split("or").map { it.trim() } links.replace("[$quality]", "").split(" or ")
.map { link -> .map {
val link = it.trim()
if (link.endsWith(".m3u8")) { val type = if(link.contains(".m3u8")) "(Main)" else "(Backup)"
cleanCallback( cleanCallback(
"$source (Main)", "$source $type",
link, link,
quality, quality,
true, link.contains(".m3u8"),
sourceCallback, sourceCallback,
) )
} else {
cleanCallback(
"$source (Backup)",
link,
quality,
false,
sourceCallback,
)
}
} }
} }
subtitle.split(",").map { sub -> subtitle.split(",").map { sub ->
val language = val language =
Regex("\\[(.*)]").find(sub)?.groupValues?.getOrNull(1) Regex("\\[(.*)]").find(sub)?.groupValues?.getOrNull(1) ?: return@map null
.toString()
val link = sub.replace("[$language]", "").trim() val link = sub.replace("[$language]", "").trim()
subCallback.invoke( subCallback.invoke(
SubtitleFile( SubtitleFile(
@ -339,30 +329,28 @@ class HDrezkaProvider : MainAPI() {
} }
} else { } else {
res.server?.apmap { server -> res.server?.apmap { server ->
suspendSafeApiCall { app.post(
app.post( url = "$mainUrl/ajax/get_cdn_series/?t=${Date().time}",
url = "$mainUrl/ajax/get_cdn_series/?t=${Date().time}", data = mapOf(
data = mapOf( "id" to res.id,
"id" to res.id, "translator_id" to server.translator_id,
"translator_id" to server.translator_id, "favs" to res.favs,
"favs" to res.favs, "is_camrip" to server.camrip,
"is_camrip" to server.camrip, "is_ads" to server.ads,
"is_ads" to server.ads, "is_director" to server.director,
"is_director" to server.director, "season" to res.season,
"season" to res.season, "episode" to res.episode,
"episode" to res.episode, "action" to res.action,
"action" to res.action, ).filterValues { it != null }.mapValues { it.value as String },
).filterValues { it != null }.mapValues { it.value as String }, referer = res.ref
referer = res.ref ).parsedSafe<Sources>()?.let { source ->
).parsedSafe<Sources>()?.let { source -> invokeSources(
invokeSources( server.translator_name.toString(),
server.translator_name.toString(), source.url,
source.url, source.subtitle.toString(),
source.subtitle.toString(), subtitleCallback,
subtitleCallback, callback
callback )
)
}
} }
} }
} }

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( app.get("https://voidboost.net/serial/$token/iframe?s=$season&e=$episode&h=dbgo.fun").document.select(
"script" "script"
).find { it.data().contains("CDNplayerConfig =") }?.data() ).find { it.data().contains("CDNplayerConfig =") }?.data()
} } ?: return
val source = val source =
Regex("['|\"]file['|\"]:\\s['|\"](#\\S+?)['|\"]").find(script.toString())?.groupValues?.get( Regex("['|\"]file['|\"]:\\s['|\"](#\\S+?)['|\"]").find(script)?.groupValues?.get(
1 1
) ?: return ) ?: return
val subtitle = val subtitle =
Regex("['|\"]subtitle['|\"]:\\s['|\"](\\S+?)['|\"]").find(script.toString())?.groupValues?.get( Regex("['|\"]subtitle['|\"]:\\s['|\"](\\S+?)['|\"]").find(script)?.groupValues?.get(
1 1
) )
val ref = getBaseUrl(iframeDbgo) val ref = getBaseUrl(iframeDbgo)
decryptStreamUrl(source).split(",").map { links -> decryptStreamUrl(source).split(",").map { links ->
val quality = 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 -> links.replace("[$quality]", "").split(" or ").map { it.trim() }.map { link ->
val name = if (link.contains(".m3u8")) "Dbgo (Main)" else "Dbgo (Backup)" val name = if (link.contains(".m3u8")) "Dbgo (Main)" else "Dbgo (Backup)"
callback.invoke( callback.invoke(
@ -200,11 +200,11 @@ object SoraExtractor : SoraStream() {
} }
subtitle?.split(",")?.map { sub -> 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() val link = sub.replace("[$language]", "").trim()
subtitleCallback.invoke( subtitleCallback.invoke(
SubtitleFile( 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.gdbot
import com.hexated.SoraStream.Companion.kamyrollAPI import com.hexated.SoraStream.Companion.kamyrollAPI
import com.hexated.SoraStream.Companion.tvMoviesAPI import com.hexated.SoraStream.Companion.tvMoviesAPI
import com.lagradost.cloudstream3.APIHolder
import com.lagradost.cloudstream3.APIHolder.getCaptchaToken import com.lagradost.cloudstream3.APIHolder.getCaptchaToken
import com.lagradost.cloudstream3.app import com.lagradost.cloudstream3.app
import com.lagradost.cloudstream3.base64Decode 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 { fun getBaseUrl(url: String): String {
return URI(url).let { return URI(url).let {
"${it.scheme}://${it.host}" "${it.scheme}://${it.host}"