Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 9547cc9

Browse files
Merge pull request #233 from usdogu/add-golgetv
Add GolgeTV
2 parents a99fb48 + 4e1befd commit 9547cc9

File tree

10 files changed

+523
-0
lines changed

10 files changed

+523
-0
lines changed

GolgeTV/build.gradle.kts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version = 1
2+
3+
cloudstream {
4+
authors = listOf("usdogu", "keyiflerolsun")
5+
language = "tr"
6+
description = "GolgeTV cloudstream eklentisidir. Sevdiğiniz yayın platformlarını ve canlı maçları burada bulabilirsiniz."
7+
8+
/**
9+
* Status int as the following:
10+
* 0: Down
11+
* 1: Ok
12+
* 2: Slow
13+
* 3: Beta only
14+
**/
15+
status = 3 // will be 3 if unspecified
16+
tvTypes = listOf("Live")
17+
iconUrl = "https://www.apkdelisi.net/wp-content/uploads/2022/03/golge-tv-reklamsiz-mod-apk-canli-tv-apkdelisi-0.jpg"
18+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest />
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
package com.keyiflerolsun
2+
3+
import com.lagradost.api.Log
4+
import com.lagradost.cloudstream3.ErrorLoadingException
5+
import com.lagradost.cloudstream3.SubtitleFile
6+
import com.lagradost.cloudstream3.app
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.Qualities
11+
12+
open class Golge16 : ExtractorApi() {
13+
override val name = "Golge16"
14+
override val mainUrl = "golge16://"
15+
override val requiresReferer = false
16+
17+
override suspend fun getUrl(
18+
url: String,
19+
referer: String?,
20+
subtitleCallback: (SubtitleFile) -> Unit,
21+
callback: (ExtractorLink) -> Unit
22+
) {
23+
val data = url.split("||")[1]
24+
val content = AppUtils.tryParseJson<OrmoxChnlx>(data)
25+
?: throw ErrorLoadingException("can't parse json")
26+
val link = content.link.split(this.mainUrl)[1].split("%7C")[0]
27+
val firstResp = app.get(link).parsedSafe<Golge16FirstResponse>()
28+
?: throw ErrorLoadingException("can't reach url")
29+
30+
val headers = mapOf(
31+
"User-Agent" to firstResp.headers.userAgent,
32+
"Referer" to firstResp.headers.referer,
33+
"Origin" to firstResp.headers.origin,
34+
"X-Requested-With" to firstResp.headers.xRequestedWith,
35+
"X-Forwarded-For" to firstResp.headers.xForwardedFor,
36+
"Content-Type" to firstResp.headers.contentType,
37+
)
38+
val secondResp = app.post(firstResp.apiUrl, headers = headers, json = firstResp.jsonData)
39+
.parsedSafe<Golge16SecondResponse>() ?: throw ErrorLoadingException("can't reach url")
40+
41+
val secondHeaders = mapOf(
42+
"watched-sig" to secondResp.addonSig,
43+
"mediahubmx-signature" to secondResp.addonSig,
44+
"user-agent" to firstResp.headers.userAgent,
45+
"X-Requested-With" to "com.golge.golgetv",
46+
"Content-Type" to "application/json"
47+
)
48+
val body = mapOf(
49+
"language" to "tr",
50+
"region" to "TR",
51+
"url" to firstResp.medyaurl
52+
)
53+
val thirdResp = app.post(firstResp.proxyurl, headers = secondHeaders, json = body).text
54+
val (streamLink) = Regex(""""url":"(.*?)"""").find(thirdResp)!!.destructured
55+
Log.d("GOLGE16", "streamLink: $streamLink")
56+
callback.invoke(
57+
ExtractorLink(
58+
source = this.name,
59+
name = content.isim,
60+
url = streamLink,
61+
referer = "",
62+
quality = Qualities.Unknown.value,
63+
isM3u8 = true,
64+
)
65+
)
66+
}
67+
}
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
package com.keyiflerolsun
2+
3+
import android.util.Base64
4+
import com.lagradost.api.Log
5+
import com.lagradost.cloudstream3.ErrorLoadingException
6+
import com.lagradost.cloudstream3.SubtitleFile
7+
import com.lagradost.cloudstream3.app
8+
import com.lagradost.cloudstream3.utils.AppUtils
9+
import com.lagradost.cloudstream3.utils.ExtractorApi
10+
import com.lagradost.cloudstream3.utils.ExtractorLink
11+
import com.lagradost.cloudstream3.utils.Qualities
12+
import java.util.regex.Matcher
13+
import java.util.regex.Pattern
14+
15+
open class Golge17 : ExtractorApi() {
16+
override val name = "Golge17"
17+
override val mainUrl = "golge17://"
18+
override val requiresReferer = false
19+
20+
override suspend fun getUrl(
21+
url: String,
22+
referer: String?,
23+
subtitleCallback: (SubtitleFile) -> Unit,
24+
callback: (ExtractorLink) -> Unit
25+
) {
26+
val data = url.split("||")[1]
27+
val content = AppUtils.tryParseJson<OrmoxChnlx>(data)
28+
?: throw ErrorLoadingException("can't parse json")
29+
val (link, originAndReferer) = content.link.split(this.mainUrl)[1].split("%7C")
30+
val headers = mapOf(
31+
"Connection" to "keep-alive",
32+
"Cache-Control" to "max-age=0",
33+
"sec-ch-ua" to """"Chromium";v="130", "Google Chrome";v="130", "Not?A_Brand";v="99"""",
34+
"sec-ch-ua-mobile" to "?0",
35+
"sec-ch-ua-platform" to """"Windows"""",
36+
"Upgrade-Insecure-Requests" to "1",
37+
"User-Agent" to "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36",
38+
"Accept" to "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
39+
"Sec-Fetch-Site" to "none",
40+
"Sec-Fetch-Mode" to "navigate",
41+
"Sec-Fetch-User" to "?1",
42+
"Sec-Fetch-Dest" to "document",
43+
"Accept-Language" to "tr-TR,tr;q=0.9,en-US;q=0.8,en;q=0.7",
44+
"Cookie" to "reklamgosterimx=ok",
45+
"Origin" to originAndReferer,
46+
"Referer" to originAndReferer
47+
)
48+
val resp = app.get(link, headers = headers).text
49+
val streamLink = parseHtml(resp)
50+
Log.d("GOLGE17", "streamLink: $streamLink")
51+
callback.invoke(
52+
ExtractorLink(
53+
source = this.name,
54+
name = content.isim,
55+
url = streamLink,
56+
referer = link,
57+
quality = Qualities.Unknown.value,
58+
isM3u8 = true,
59+
headers = mapOf(
60+
"origin" to link,
61+
"Accept" to "*/*",
62+
"Cache-Control" to "max-age=0",
63+
"sec-ch-ua-platform" to """"Windows"""",
64+
"User-Agent" to "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
65+
)
66+
)
67+
)
68+
}
69+
70+
private fun parseHtml(str: String): String {
71+
val trim = str.replace("\\s+".toRegex(), "").trim { it <= ' ' }
72+
try {
73+
val str2 = String(
74+
Base64.decode(
75+
extractDataWithRegex("=window\\['atob'\\]\\(\"(.*?)\"", trim),
76+
Base64.DEFAULT
77+
)
78+
)
79+
val extractMultipleDataWithRegex = extractMultipleDataWithRegex(
80+
extractDataWithRegex("window.stnbnb=\\[(.*?)\\]", trim)!!
81+
)
82+
val str3: String? = if (extractMultipleDataWithRegex.isNotEmpty()) String(
83+
Base64.decode(
84+
extractMultipleDataWithRegex[(Math.random() * extractMultipleDataWithRegex.size).toInt()],
85+
Base64.DEFAULT
86+
)
87+
) else null
88+
val str4 = buildString {
89+
append("https://$str3")
90+
append(
91+
String(
92+
Base64.decode(
93+
extractDataWithRegex(
94+
"window.streamradardomil=\\[atob\\(\"(.*?)\"\\)",
95+
trim
96+
), Base64.DEFAULT
97+
),
98+
Charsets.UTF_8
99+
)
100+
)
101+
append("/i/1.1.1.1/")
102+
append(str2)
103+
append("/playlist.m3u8")
104+
}
105+
return str4
106+
} catch (e: Exception) {
107+
throw ErrorLoadingException(e.message)
108+
}
109+
}
110+
111+
private fun extractDataWithRegex(str: String, str2: String): String? {
112+
val matcher: Matcher = Pattern.compile(str).matcher(str2)
113+
return if (matcher.find()) matcher.group(1) else ""
114+
}
115+
116+
private fun extractMultipleDataWithRegex(str: String): Array<String> {
117+
val matcher: Matcher = Pattern.compile("atob\\(\"(.*?)\"\\)").matcher(str)
118+
val arrayList = mutableListOf<String>()
119+
while (matcher.find()) {
120+
arrayList.add(matcher.group(1)!!)
121+
}
122+
return arrayList.toTypedArray()
123+
}
124+
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
package com.keyiflerolsun
2+
3+
import android.util.Base64
4+
import com.lagradost.api.Log
5+
import com.lagradost.cloudstream3.ErrorLoadingException
6+
import com.lagradost.cloudstream3.SubtitleFile
7+
import com.lagradost.cloudstream3.app
8+
import com.lagradost.cloudstream3.utils.AppUtils
9+
import com.lagradost.cloudstream3.utils.ExtractorApi
10+
import com.lagradost.cloudstream3.utils.ExtractorLink
11+
import com.lagradost.cloudstream3.utils.Qualities
12+
import java.nio.charset.StandardCharsets
13+
import javax.crypto.Cipher
14+
import javax.crypto.spec.IvParameterSpec
15+
import javax.crypto.spec.SecretKeySpec
16+
17+
open class Golge19 : ExtractorApi() {
18+
override val name = "Golge19"
19+
override val mainUrl = "golge19://"
20+
override val requiresReferer = false
21+
22+
override suspend fun getUrl(
23+
url: String,
24+
referer: String?,
25+
subtitleCallback: (SubtitleFile) -> Unit,
26+
callback: (ExtractorLink) -> Unit
27+
) {
28+
val data = url.split("||")[1]
29+
val content = AppUtils.tryParseJson<OrmoxChnlx>(data) ?: throw ErrorLoadingException("can't parse json")
30+
val headers = mapOf(
31+
"origin" to "https://google.com",
32+
"Referer" to "https://google.com/",
33+
"x-requested-with" to "XMLHttpRequest",
34+
"x-forwarded-for" to "1.1.1.1",
35+
"User-Agent" to "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
36+
)
37+
val link = content.link.split(this.mainUrl)[1].split("%7C%7C")[0]
38+
val resp = app.get(link, headers = headers).text
39+
val chUrl = getChUrl(resp)
40+
Log.d("GOLGE19", "chUrl: $chUrl")
41+
callback.invoke(ExtractorLink(
42+
source = this.name,
43+
name = content.isim,
44+
url = chUrl,
45+
referer = "https://google.com",
46+
quality = Qualities.Unknown.value,
47+
isM3u8 = true,
48+
headers = mapOf("origin" to "https://google.com")
49+
))
50+
}
51+
52+
private fun getChUrl(data: String): String {
53+
val split = data.split(":")
54+
val content1 = split[0]
55+
val key1 = Base64.decode(split[1], Base64.DEFAULT)
56+
val decrypt1 = decryptAES(content1, key1).split(":")
57+
val content2 = decrypt1[0]
58+
val key2 = Base64.decode(decrypt1[1], Base64.DEFAULT)
59+
val decrypt2 = decryptAES(content2, key2)
60+
val (chUrl) = Regex(""""chUrl": "(.*?)"""").find(decrypt2)!!.destructured
61+
return chUrl
62+
}
63+
64+
private fun decryptAES(data: String, key: ByteArray): String {
65+
val charset = StandardCharsets.UTF_8
66+
val secretKeySpec = SecretKeySpec(key, "AES")
67+
val cipher = Cipher.getInstance("AES/CBC/PKCS5Padding")
68+
cipher.init(2, secretKeySpec, IvParameterSpec(key))
69+
return String(cipher.doFinal(Base64.decode(data, 0)), charset)
70+
}
71+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.keyiflerolsun
2+
3+
import com.lagradost.cloudstream3.ErrorLoadingException
4+
import com.lagradost.cloudstream3.SubtitleFile
5+
import com.lagradost.cloudstream3.utils.AppUtils
6+
import com.lagradost.cloudstream3.utils.ExtractorApi
7+
import com.lagradost.cloudstream3.utils.ExtractorLink
8+
9+
open class Golge7 : ExtractorApi() {
10+
override val name = "Golge7"
11+
override val mainUrl = "golge7://"
12+
override val requiresReferer = false
13+
14+
override suspend fun getUrl(
15+
url: String,
16+
referer: String?,
17+
subtitleCallback: (SubtitleFile) -> Unit,
18+
callback: (ExtractorLink) -> Unit
19+
) {
20+
val data = url.split("||")[1]
21+
val content = AppUtils.tryParseJson<OrmoxChnlx>(data)
22+
?: throw ErrorLoadingException("can't parse json")
23+
val link = content.link.split(this.mainUrl)[1]
24+
}
25+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.keyiflerolsun
2+
3+
import com.lagradost.cloudstream3.ErrorLoadingException
4+
import com.lagradost.cloudstream3.SubtitleFile
5+
import com.lagradost.cloudstream3.utils.AppUtils
6+
import com.lagradost.cloudstream3.utils.ExtractorApi
7+
import com.lagradost.cloudstream3.utils.ExtractorLink
8+
9+
open class Golge8 : ExtractorApi() {
10+
override val name = "Golge8"
11+
override val mainUrl = "golge8://"
12+
override val requiresReferer = false
13+
14+
override suspend fun getUrl(
15+
url: String,
16+
referer: String?,
17+
subtitleCallback: (SubtitleFile) -> Unit,
18+
callback: (ExtractorLink) -> Unit
19+
) {
20+
val data = url.split("||")[1]
21+
val content = AppUtils.tryParseJson<OrmoxChnlx>(data)
22+
?: throw ErrorLoadingException("can't parse json")
23+
val (link, drmUrl) = content.link.split(this.mainUrl)[1].split("%7C")
24+
}
25+
}

0 commit comments

Comments
 (0)