mirror of
https://github.com/recloudstream/cloudstream-extensions.git
synced 2024-08-15 03:03:54 +00:00
disable superembed
This commit is contained in:
parent
50209d137f
commit
ac7da297e4
2 changed files with 36 additions and 7 deletions
|
@ -16,7 +16,7 @@ cloudstream {
|
|||
* 2: Slow
|
||||
* 3: Beta only
|
||||
* */
|
||||
status = 3 // will be 3 if unspecified
|
||||
status = 0 // will be 3 if unspecified
|
||||
tvTypes = listOf(
|
||||
"TvSeries",
|
||||
"Movie",
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
package com.lagradost
|
||||
|
||||
import android.util.Log
|
||||
import com.lagradost.cloudstream3.SubtitleFile
|
||||
import com.lagradost.cloudstream3.TvType
|
||||
import com.lagradost.cloudstream3.app
|
||||
import com.lagradost.cloudstream3.base64Decode
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.metaproviders.TmdbLink
|
||||
import com.lagradost.cloudstream3.metaproviders.TmdbProvider
|
||||
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.loadExtractor
|
||||
import kotlinx.coroutines.delay
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
|
||||
class SuperembedProvider : TmdbProvider() {
|
||||
override var mainUrl = "https://seapi.link"
|
||||
|
@ -53,10 +53,39 @@ class SuperembedProvider : TmdbProvider() {
|
|||
val url: String
|
||||
) {
|
||||
suspend fun getIframeContents(): String? {
|
||||
val document = app.get(url).text
|
||||
val document = app.get(url)
|
||||
val regex = "<iframe[^+]+\\+(?:window\\.)?atob\\(['\"]([-A-Za-z0-9+/=]+)".toRegex()
|
||||
val encoded = regex.find(document)?.groupValues?.get(1) ?: return null
|
||||
val encoded = regex.find(document.text)?.groupValues?.get(1) ?: return null
|
||||
return base64Decode(encoded)
|
||||
}
|
||||
}
|
||||
|
||||
private object CaptchaSolver {
|
||||
private enum class Gender { Female, Male }
|
||||
private suspend fun predictFace(url: String): Gender? {
|
||||
val img = "data:image/jpeg;base64," + base64Encode(app.get(url).body.bytes())
|
||||
val res = app.post("https://hf.space/embed/njgroene/age-gender-profilepic/api/queue/push/ HTTP/1.1", json = HFRequest(
|
||||
listOf(img))).text
|
||||
val request = tryParseJson<JSONObject>(res)
|
||||
for (i in 1..5) {
|
||||
delay(500L)
|
||||
val document = app.post("https://hf.space/embed/njgroene/age-gender-profilepic/api/queue/status/", json=request).text
|
||||
val status = tryParseJson<JSONObject>(document)
|
||||
if (status?.get("status") != "COMPLETE") continue
|
||||
val pred = (((status.get("data") as? JSONObject?)
|
||||
?.get("data") as? JSONArray?)
|
||||
?.get(0) as? String?) ?: return null
|
||||
return if ("Male" in pred) Gender.Male
|
||||
else if ("Female" in pred) Gender.Female
|
||||
else null
|
||||
}
|
||||
}
|
||||
|
||||
private data class HFRequest(
|
||||
val data: List<String>,
|
||||
val action: String = "predict",
|
||||
val fn_index: Int = 0,
|
||||
val session_hash: String = "aaaaaaaaaaa"
|
||||
)
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue