diff --git a/library/src/commonMain/kotlin/com/lagradost/cloudstream3/extractors/BuzzServer.kt b/library/src/commonMain/kotlin/com/lagradost/cloudstream3/extractors/BuzzServer.kt new file mode 100644 index 00000000000..9e0eb7f6098 --- /dev/null +++ b/library/src/commonMain/kotlin/com/lagradost/cloudstream3/extractors/BuzzServer.kt @@ -0,0 +1,47 @@ +package com.lagradost.cloudstream3.extractors + +import com.lagradost.api.Log +import com.lagradost.cloudstream3.Prerelease +import com.lagradost.cloudstream3.SubtitleFile +import com.lagradost.cloudstream3.app +import com.lagradost.cloudstream3.utils.ExtractorApi +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.getQualityFromName +import com.lagradost.cloudstream3.utils.newExtractorLink + +@Prerelease +class BuzzServer : ExtractorApi() { + override val name = "BuzzServer" + override val mainUrl = "https://buzzheavier.com" + override val requiresReferer = true + + override suspend fun getUrl( + url: String, + referer: String?, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ) { + try { + val qualityText = app.get(url).documentLarge.selectFirst("div.max-w-2xl > span")?.text() + val quality = getQualityFromName(qualityText) + val response = app.get("$url/download", referer = url, allowRedirects = false) + val redirectUrl = response.headers["hx-redirect"] ?: "" + + if (redirectUrl.isNotEmpty()) { + callback.invoke( + newExtractorLink( + "BuzzServer", + "BuzzServer", + redirectUrl, + ) { + this.quality = quality + } + ) + } else { + Log.w("BuzzServer", "No redirect URL found in headers.") + } + } catch (e: Exception) { + Log.e("BuzzServer", "Exception occurred: ${e.message}") + } + } +} \ No newline at end of file diff --git a/library/src/commonMain/kotlin/com/lagradost/cloudstream3/extractors/Krakenfiles.kt b/library/src/commonMain/kotlin/com/lagradost/cloudstream3/extractors/Krakenfiles.kt index b605a39c6b4..53eb92259dc 100644 --- a/library/src/commonMain/kotlin/com/lagradost/cloudstream3/extractors/Krakenfiles.kt +++ b/library/src/commonMain/kotlin/com/lagradost/cloudstream3/extractors/Krakenfiles.kt @@ -5,6 +5,7 @@ import com.lagradost.cloudstream3.app import com.lagradost.cloudstream3.utils.ExtractorApi import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.Qualities +import com.lagradost.cloudstream3.utils.getQualityFromName import com.lagradost.cloudstream3.utils.httpsify import com.lagradost.cloudstream3.utils.newExtractorLink @@ -19,18 +20,27 @@ open class Krakenfiles : ExtractorApi() { subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit ) { - val id = Regex("/(?:view|embed-video)/([\\da-zA-Z]+)").find(url)?.groupValues?.get(1) + val id = Regex("/(?:view|embed-video)/([\\da-zA-Z]+)") + .find(url) + ?.groupValues + ?.get(1) + ?: return + val doc = app.get("$mainUrl/embed-video/$id").document - val link = doc.selectFirst("source")?.attr("src") + val title = doc.select("span.coin-name").text() + val link = doc.selectFirst("source")?.attr("src") ?: return + val quality = getQualityFromName(title) callback.invoke( newExtractorLink( - this.name, - this.name, - httpsify(link ?: return), - ) + name, + name, + httpsify(link) + ) { + this.quality = quality + } ) - } -} \ No newline at end of file +} + diff --git a/library/src/commonMain/kotlin/com/lagradost/cloudstream3/utils/ExtractorApi.kt b/library/src/commonMain/kotlin/com/lagradost/cloudstream3/utils/ExtractorApi.kt index 641c913195e..ec74e1a918c 100644 --- a/library/src/commonMain/kotlin/com/lagradost/cloudstream3/utils/ExtractorApi.kt +++ b/library/src/commonMain/kotlin/com/lagradost/cloudstream3/utils/ExtractorApi.kt @@ -18,6 +18,7 @@ import com.lagradost.cloudstream3.extractors.BigwarpArt import com.lagradost.cloudstream3.extractors.BigwarpIO import com.lagradost.cloudstream3.extractors.Blogger import com.lagradost.cloudstream3.extractors.BullStream +import com.lagradost.cloudstream3.extractors.BuzzServer import com.lagradost.cloudstream3.extractors.ByseSX import com.lagradost.cloudstream3.extractors.Bysezejataos import com.lagradost.cloudstream3.extractors.ByteShare @@ -792,14 +793,15 @@ enum class Qualities(var value: Int, val defaultPriority: Int) { } fun getQualityFromName(qualityName: String?): Int { - if (qualityName == null) - return Qualities.Unknown.value - - val match = qualityName.lowercase().replace("p", "").trim() - return when (match) { - "4k" -> Qualities.P2160 - else -> null - }?.value ?: match.toIntOrNull() ?: Qualities.Unknown.value + return when (qualityName?.lowercase()) { + "4k", "2160", "2160p" -> Qualities.P2160.value + "1440", "1440p" -> Qualities.P1440.value + "1080", "1080p" -> Qualities.P1080.value + "720", "720p" -> Qualities.P720.value + "480", "480p" -> Qualities.P480.value + "360", "360p" -> Qualities.P360.value + else -> Qualities.Unknown.value + } } private val packedRegex = Regex("""eval\(function\(p,a,c,k,e,.*\)\)""") @@ -1077,6 +1079,7 @@ val extractorApis: MutableList = arrayListOf( Fembed9hd(), StreamM4u(), Krakenfiles(), + BuzzServer(), Gofile(), Vicloud(), Uservideo(),