Skip to content

Commit e6923f5

Browse files
errorcodeQQerrorcodeQQ
authored andcommitted
fix: resolve sports streams not loading by integrating CloudflareKiller bypass
1 parent 8ede70d commit e6923f5

6 files changed

Lines changed: 43 additions & 12 deletions

File tree

BinTV/src/main/kotlin/com/bintv/BinTVProvider.kt

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import com.lagradost.cloudstream3.*
44
import com.lagradost.cloudstream3.utils.*
55
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
66
import com.lagradost.cloudstream3.utils.AppUtils.toJson
7+
import com.lagradost.cloudstream3.network.CloudflareKiller
78
import com.fasterxml.jackson.annotation.JsonProperty
89
import java.net.ServerSocket
910
import java.net.Socket
@@ -204,9 +205,9 @@ class BinTVProvider : MainAPI() {
204205
// Fetch PPV matches
205206
val ppvMatches = mutableListOf<EventLoadData>()
206207
val ppvUrls = listOf(
208+
"https://api.ppv.cx/api/streams",
207209
"https://old.ppv.to/api/streams",
208-
"https://api.ppv.to/api/streams",
209-
"https://api.ppv.cx/api/streams"
210+
"https://api.ppv.to/api/streams"
210211
)
211212
val ppvHeaders = mapOf(
212213
"User-Agent" to "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Mobile Safari/537.36",
@@ -217,7 +218,15 @@ class BinTVProvider : MainAPI() {
217218
var ppvText = ""
218219
for (url in ppvUrls) {
219220
try {
220-
val res = app.get(url, headers = ppvHeaders, timeout = 15L)
221+
val res = if (url.contains("api.ppv.cx")) {
222+
app.get(url, headers = ppvHeaders, interceptor = cfInterceptor, timeout = 20L)
223+
} else {
224+
try {
225+
app.get(url, headers = ppvHeaders, timeout = 15L)
226+
} catch (e: Exception) {
227+
app.get(url, headers = ppvHeaders, interceptor = cfInterceptor, timeout = 20L)
228+
}
229+
}
221230
if (res.code == 200 && res.text.isNotBlank()) {
222231
ppvText = res.text
223232
break
@@ -548,11 +557,20 @@ class BinTVProvider : MainAPI() {
548557
"Origin" to (embedHost ?: "https://bintv.net")
549558
)
550559

551-
val embedHtml = try {
552-
app.get(embedUrl, headers = fetchHeaders, timeout = 20L).text
560+
var embedHtml = ""
561+
try {
562+
val res = app.get(embedUrl, headers = fetchHeaders, timeout = 20L)
563+
embedHtml = res.text
564+
if (embedHtml.contains("Just a moment") || res.code == 403) {
565+
embedHtml = app.get(embedUrl, headers = fetchHeaders, interceptor = cfInterceptor, timeout = 20L).text
566+
}
553567
} catch (fetchErr: Exception) {
554568
println("BinTV: Failed to fetch embed page $embedUrl - ${fetchErr.message}")
555-
""
569+
try {
570+
embedHtml = app.get(embedUrl, headers = fetchHeaders, interceptor = cfInterceptor, timeout = 20L).text
571+
} catch (cfErr: Exception) {
572+
println("BinTV: Failed to fetch embed page with CloudflareKiller - ${cfErr.message}")
573+
}
556574
}
557575

558576
// Search for m3u8 links
@@ -608,6 +626,7 @@ class BinTVProvider : MainAPI() {
608626
}
609627

610628
companion object {
629+
private val cfInterceptor = CloudflareKiller()
611630
private var serverSocket: ServerSocket? = null
612631
private var port: Int = 0
613632

DiviCast/src/main/kotlin/com/divicast/DiviCastProvider.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,7 @@ class DiviCastProvider : MainAPI() {
493493
return "DiviCast [$hostLabel]"
494494
}
495495

496+
@android.annotation.SuppressLint("NewApi")
496497
private fun base64Decode(str: String): ByteArray {
497498
return try {
498499
Base64.decode(str, Base64.DEFAULT)

ExampleProvider/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ cloudstream {
2626
}
2727

2828
android {
29-
namespace = "com.example"
29+
namespace = "com.errorcode26"
3030
buildFeatures {
3131
buildConfig = true
3232
viewBinding = false

build.gradle.kts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ buildscript {
1414

1515
dependencies {
1616
classpath("com.android.tools.build:gradle:9.1.1")
17-
classpath("com.github.recloudstream.gradle:gradle:81b1d424d")
17+
classpath("com.github.recloudstream.gradle:gradle:69fdb8fc")
1818
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:2.4.0")
1919
}
2020
}
@@ -47,10 +47,11 @@ subprojects {
4747
cloudstream {
4848
// when running through github workflow, GITHUB_REPOSITORY should contain current repository name
4949
setRepo(System.getenv("GITHUB_REPOSITORY") ?: "errorcode26/errorcodeQQ")
50+
authors = listOf("errorcode26")
5051
}
5152

5253
android {
53-
namespace = "com.example"
54+
namespace = "com.errorcode26"
5455
compileSdk = 36
5556

5657
defaultConfig {

gradle.properties

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,4 @@ android.buildFeatures.buildConfig=true
1313
org.gradle.caching=true
1414
org.gradle.configuration-cache=true
1515
android.javaCompile.suppressSourceTargetDeprecationWarning=true
16-
# Local JDK installation paths for toolchain resolution
17-
org.gradle.java.installations.paths=C:/Users/user/Desktop/plugin/cs3 plugin errorcode github/jdk17/jdk-17.0.2
18-
org.gradle.java.installations.auto-detect=false
16+

settings.gradle.kts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
pluginManagement {
2+
repositories {
3+
gradlePluginPortal()
4+
google()
5+
mavenCentral()
6+
}
7+
}
8+
9+
plugins {
10+
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
11+
}
12+
113
rootProject.name = "CloudstreamPlugins"
214

315
// This file dynamically includes all plugin projects in the repository.

0 commit comments

Comments
 (0)