Skip to content

Commit 5c0f715

Browse files
authored
feat(extractors): add gupload.xyz extractor (#2391)
1 parent 368ee2a commit 5c0f715

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-1
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package com.lagradost.cloudstream3.extractors
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty
4+
import com.lagradost.cloudstream3.SubtitleFile
5+
import com.lagradost.cloudstream3.app
6+
import com.lagradost.cloudstream3.base64Decode
7+
import com.lagradost.cloudstream3.utils.AppUtils
8+
import com.lagradost.cloudstream3.utils.ExtractorApi
9+
import com.lagradost.cloudstream3.utils.ExtractorLink
10+
import com.lagradost.cloudstream3.utils.getQualityFromName
11+
import com.lagradost.cloudstream3.utils.newExtractorLink
12+
13+
open class GUpload: ExtractorApi() {
14+
override val name: String = "GUpload"
15+
override val mainUrl: String = "https://gupload.xyz"
16+
override val requiresReferer: Boolean = false
17+
18+
override suspend fun getUrl(
19+
url: String,
20+
referer: String?,
21+
subtitleCallback: (SubtitleFile) -> Unit,
22+
callback: (ExtractorLink) -> Unit
23+
) {
24+
val response = app.get(url, referer = referer).text
25+
26+
val playerConfigEncoded = response.substringAfter("decodePayload('").substringBefore("');")
27+
val playerConfigString = base64Decode(playerConfigEncoded).substringAfter("|")
28+
29+
val playerConfig = AppUtils.parseJson<VideoInfo>(playerConfigString)
30+
31+
callback.invoke(
32+
newExtractorLink(
33+
source = name,
34+
name = name,
35+
url = playerConfig.videoUrl.replace("\\", ""),
36+
) {
37+
Regex("/(\\d+p)\\.").find(playerConfig.videoUrl)?.groupValues?.get(1)?.let {
38+
quality = getQualityFromName(it)
39+
}
40+
}
41+
)
42+
}
43+
44+
private data class VideoInfo(
45+
@JsonProperty("videoUrl") val videoUrl: String,
46+
@JsonProperty("posterUrl") val posterUrl: String? = null,
47+
@JsonProperty("videoId") val videoId: String? = null,
48+
@JsonProperty("primaryColor") val primaryColor: String? = null,
49+
@JsonProperty("audioTracks") val audioTracks: List<Any?> = emptyList(),
50+
@JsonProperty("subtitleTracks") val subtitleTracks: List<Any?> = emptyList(),
51+
@JsonProperty("vastFallbackList") val vastFallbackList: List<String> = emptyList(),
52+
@JsonProperty("videoOwnerId") val videoOwnerId: Long = 0,
53+
)
54+
}

library/src/commonMain/kotlin/com/lagradost/cloudstream3/utils/ExtractorApi.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ import com.lagradost.cloudstream3.extractors.Fplayer
8686
import com.lagradost.cloudstream3.extractors.FsstOnline
8787
import com.lagradost.cloudstream3.extractors.GDMirrorbot
8888
import com.lagradost.cloudstream3.extractors.GMPlayer
89+
import com.lagradost.cloudstream3.extractors.GUpload
8990
import com.lagradost.cloudstream3.extractors.GamoVideo
9091
import com.lagradost.cloudstream3.extractors.Gdriveplayer
9192
import com.lagradost.cloudstream3.extractors.Gdriveplayerapi
@@ -1234,7 +1235,8 @@ val extractorApis: MutableList<ExtractorApi> = arrayListOf(
12341235
ByseBuho(),
12351236
MyVidPlay(),
12361237
Up4Stream(),
1237-
Up4FunTop()
1238+
Up4FunTop(),
1239+
GUpload(),
12381240
)
12391241

12401242

0 commit comments

Comments
 (0)