diff --git a/library/src/commonMain/kotlin/com/lagradost/cloudstream3/extractors/GUpload.kt b/library/src/commonMain/kotlin/com/lagradost/cloudstream3/extractors/GUpload.kt new file mode 100644 index 0000000000..7daaa55cc9 --- /dev/null +++ b/library/src/commonMain/kotlin/com/lagradost/cloudstream3/extractors/GUpload.kt @@ -0,0 +1,54 @@ +package com.lagradost.cloudstream3.extractors + +import com.fasterxml.jackson.annotation.JsonProperty +import com.lagradost.cloudstream3.SubtitleFile +import com.lagradost.cloudstream3.app +import com.lagradost.cloudstream3.base64Decode +import com.lagradost.cloudstream3.utils.AppUtils +import com.lagradost.cloudstream3.utils.ExtractorApi +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.getQualityFromName +import com.lagradost.cloudstream3.utils.newExtractorLink + +open class GUpload: ExtractorApi() { + override val name: String = "GUpload" + override val mainUrl: String = "https://gupload.xyz" + override val requiresReferer: Boolean = false + + override suspend fun getUrl( + url: String, + referer: String?, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ) { + val response = app.get(url, referer = referer).text + + val playerConfigEncoded = response.substringAfter("decodePayload('").substringBefore("');") + val playerConfigString = base64Decode(playerConfigEncoded).substringAfter("|") + + val playerConfig = AppUtils.parseJson(playerConfigString) + + callback.invoke( + newExtractorLink( + source = name, + name = name, + url = playerConfig.videoUrl.replace("\\", ""), + ) { + Regex("/(\\d+p)\\.").find(playerConfig.videoUrl)?.groupValues?.get(1)?.let { + quality = getQualityFromName(it) + } + } + ) + } + + private data class VideoInfo( + @JsonProperty("videoUrl") val videoUrl: String, + @JsonProperty("posterUrl") val posterUrl: String? = null, + @JsonProperty("videoId") val videoId: String? = null, + @JsonProperty("primaryColor") val primaryColor: String? = null, + @JsonProperty("audioTracks") val audioTracks: List = emptyList(), + @JsonProperty("subtitleTracks") val subtitleTracks: List = emptyList(), + @JsonProperty("vastFallbackList") val vastFallbackList: List = emptyList(), + @JsonProperty("videoOwnerId") val videoOwnerId: Long = 0, + ) +} \ 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 c0d5c5da70..81e3405429 100644 --- a/library/src/commonMain/kotlin/com/lagradost/cloudstream3/utils/ExtractorApi.kt +++ b/library/src/commonMain/kotlin/com/lagradost/cloudstream3/utils/ExtractorApi.kt @@ -84,6 +84,7 @@ import com.lagradost.cloudstream3.extractors.Fplayer import com.lagradost.cloudstream3.extractors.FsstOnline import com.lagradost.cloudstream3.extractors.GDMirrorbot import com.lagradost.cloudstream3.extractors.GMPlayer +import com.lagradost.cloudstream3.extractors.GUpload import com.lagradost.cloudstream3.extractors.GamoVideo import com.lagradost.cloudstream3.extractors.Gdriveplayer import com.lagradost.cloudstream3.extractors.Gdriveplayerapi @@ -1226,7 +1227,8 @@ val extractorApis: MutableList = arrayListOf( Bysezejataos(), ByseSX(), Up4Stream(), - Up4FunTop() + Up4FunTop(), + GUpload(), )