mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
moar fixes
This commit is contained in:
parent
5ba3b1f685
commit
08c3350666
3 changed files with 31 additions and 11 deletions
|
@ -36,7 +36,6 @@ object APIHolder {
|
||||||
AllAnimeProvider(),
|
AllAnimeProvider(),
|
||||||
AnimekisaProvider(),
|
AnimekisaProvider(),
|
||||||
//ShiroProvider(), // v2 fucked me
|
//ShiroProvider(), // v2 fucked me
|
||||||
//AnimePaheProvider(), //ddos guard
|
|
||||||
AnimeFlickProvider(),
|
AnimeFlickProvider(),
|
||||||
AnimeflvnetProvider(),
|
AnimeflvnetProvider(),
|
||||||
|
|
||||||
|
|
|
@ -308,7 +308,7 @@ class SflixProvider(providerUrl: String, providerName: String) : MainAPI() {
|
||||||
|
|
||||||
// Some smarter ws11 or w10 selection might be required in the future.
|
// Some smarter ws11 or w10 selection might be required in the future.
|
||||||
val extractorData =
|
val extractorData =
|
||||||
"https://ws10.rabbitstream.net/socket.io/?EIO=4&transport=polling"
|
"https://ws11.rabbitstream.net/socket.io/?EIO=4&transport=polling"
|
||||||
|
|
||||||
val sources = resolved.first?.let { app.baseClient.newCall(it).execute().text }
|
val sources = resolved.first?.let { app.baseClient.newCall(it).execute().text }
|
||||||
?: return@suspendSafeApiCall
|
?: return@suspendSafeApiCall
|
||||||
|
@ -384,19 +384,25 @@ class SflixProvider(providerUrl: String, providerName: String) : MainAPI() {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates a new session if the request fails
|
* Generates a new session if the request fails
|
||||||
|
* @return the data and if it is new.
|
||||||
* */
|
* */
|
||||||
private suspend fun getUpdatedData(response: AppResponse, data: PollingData, baseUrl: String) : PollingData {
|
private suspend fun getUpdatedData(
|
||||||
if (!response.response.isSuccessful){
|
response: AppResponse,
|
||||||
return negotiateNewSid(baseUrl) ?: data
|
data: PollingData,
|
||||||
|
baseUrl: String
|
||||||
|
): Pair<PollingData, Boolean> {
|
||||||
|
if (!response.response.isSuccessful) {
|
||||||
|
return negotiateNewSid(baseUrl)?.let {
|
||||||
|
it to true
|
||||||
|
} ?: data to false
|
||||||
}
|
}
|
||||||
return data
|
return data to false
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun extractorVerifierJob(extractorData: String?) {
|
override suspend fun extractorVerifierJob(extractorData: String?) {
|
||||||
if (extractorData == null) return
|
if (extractorData == null) return
|
||||||
|
|
||||||
val headers = mapOf(
|
val headers = mapOf(
|
||||||
"User-Agent" to USER_AGENT,
|
|
||||||
"Referer" to "https://rabbitstream.net/"
|
"Referer" to "https://rabbitstream.net/"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -431,13 +437,26 @@ class SflixProvider(providerUrl: String, providerName: String) : MainAPI() {
|
||||||
// Prevents them from fucking us over with doing a while(true){} loop
|
// Prevents them from fucking us over with doing a while(true){} loop
|
||||||
val interval = maxOf(data.pingInterval?.toLong()?.plus(2000) ?: return, 10000L)
|
val interval = maxOf(data.pingInterval?.toLong()?.plus(2000) ?: return, 10000L)
|
||||||
var reconnect = false
|
var reconnect = false
|
||||||
|
var newAuth = false
|
||||||
while (true) {
|
while (true) {
|
||||||
val authData = if (reconnect) """
|
val authData =
|
||||||
42["_reconnect", "$reconnectSid"]
|
when {
|
||||||
""".trimIndent() else authInt
|
newAuth -> "40"
|
||||||
|
reconnect -> """42["_reconnect", "$reconnectSid"]"""
|
||||||
|
else -> authInt
|
||||||
|
}
|
||||||
|
|
||||||
val url = "${extractorData}&t=${generateTimeStamp()}&sid=${data.sid}"
|
val url = "${extractorData}&t=${generateTimeStamp()}&sid=${data.sid}"
|
||||||
data = getUpdatedData(app.post(url, data = authData, headers = headers), data, extractorData)
|
|
||||||
|
getUpdatedData(
|
||||||
|
app.post(url, data = authData, headers = headers),
|
||||||
|
data,
|
||||||
|
extractorData
|
||||||
|
).also {
|
||||||
|
newAuth = it.second
|
||||||
|
data = it.first
|
||||||
|
}
|
||||||
|
|
||||||
//.also { println("Sflix post job ${it.text}") }
|
//.also { println("Sflix post job ${it.text}") }
|
||||||
Log.d(this.name, "Running Sflix job $url")
|
Log.d(this.name, "Running Sflix job $url")
|
||||||
|
|
||||||
|
|
|
@ -125,6 +125,8 @@ class WebViewResolver(val interceptUrl: Regex, val additionalUrls: List<Regex> =
|
||||||
".srt",
|
".srt",
|
||||||
".ts",
|
".ts",
|
||||||
".gif",
|
".gif",
|
||||||
|
// Warning, this might fuck some future sites, but it's used to make Sflix work.
|
||||||
|
"wss://"
|
||||||
)
|
)
|
||||||
|
|
||||||
/** NOTE! request.requestHeaders is not perfect!
|
/** NOTE! request.requestHeaders is not perfect!
|
||||||
|
|
Loading…
Reference in a new issue