mirror of
https://github.com/recloudstream/cloudstream-extensions-multilingual.git
synced 2024-08-15 03:15:14 +00:00
Add CF killer to Skillshare
This commit is contained in:
parent
e9247d553f
commit
f9cc2909d8
1 changed files with 5 additions and 3 deletions
|
@ -9,6 +9,7 @@ import com.lagradost.cloudstream3.utils.AppUtils.parseJson
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.toJson
|
import com.lagradost.cloudstream3.utils.AppUtils.toJson
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.Qualities
|
import com.lagradost.cloudstream3.utils.Qualities
|
||||||
|
import com.lagradost.cloudstream3.network.CloudflareKiller
|
||||||
import com.lagradost.nicehttp.RequestBodyTypes
|
import com.lagradost.nicehttp.RequestBodyTypes
|
||||||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||||
import okhttp3.RequestBody.Companion.toRequestBody
|
import okhttp3.RequestBody.Companion.toRequestBody
|
||||||
|
@ -25,6 +26,7 @@ class SkillShareProvider : MainAPI() { // all providers must be an instance of M
|
||||||
override val hasChromecastSupport = true
|
override val hasChromecastSupport = true
|
||||||
override var lang = "en"
|
override var lang = "en"
|
||||||
override val hasMainPage = true
|
override val hasMainPage = true
|
||||||
|
private val interceptor = CloudflareKiller()
|
||||||
private var cursor = mutableMapOf("SIX_MONTHS_ENGAGEMENT" to "", "ML_TRENDINESS" to "")
|
private var cursor = mutableMapOf("SIX_MONTHS_ENGAGEMENT" to "", "ML_TRENDINESS" to "")
|
||||||
|
|
||||||
override val mainPage =
|
override val mainPage =
|
||||||
|
@ -35,7 +37,7 @@ class SkillShareProvider : MainAPI() { // all providers must be an instance of M
|
||||||
|
|
||||||
private suspend fun queryMovieApi(payload: String): String {
|
private suspend fun queryMovieApi(payload: String): String {
|
||||||
val req = payload.toRequestBody(RequestBodyTypes.JSON.toMediaTypeOrNull())
|
val req = payload.toRequestBody(RequestBodyTypes.JSON.toMediaTypeOrNull())
|
||||||
return app.post(apiUrl, requestBody = req, referer = "$mainUrl/", timeout = 30).text
|
return app.post(apiUrl, requestBody = req, referer = "$mainUrl/", interceptor = interceptor, timeout = 30).text
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
|
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
|
||||||
|
@ -144,8 +146,8 @@ class SkillShareProvider : MainAPI() { // all providers must be an instance of M
|
||||||
|
|
||||||
override suspend fun load(url: String): LoadResponse? {
|
override suspend fun load(url: String): LoadResponse? {
|
||||||
val data = parseJson<Data>(url)
|
val data = parseJson<Data>(url)
|
||||||
val document = app.get(bypassApiUrl + "/${data.courseId}")
|
val document = app.get("$bypassApiUrl/${data.courseId}", interceptor = interceptor)
|
||||||
.parsedSafe<BypassApiData>() ?: app.get(bypassApiUrlFallback + "/${data.courseId}/0")
|
.parsedSafe<BypassApiData>() ?: app.get("$bypassApiUrlFallback/${data.courseId}/0", interceptor = interceptor)
|
||||||
.parsedSafe<BypassApiData>() ?: throw ErrorLoadingException("Invalid Json Response")
|
.parsedSafe<BypassApiData>() ?: throw ErrorLoadingException("Invalid Json Response")
|
||||||
val title = data.title ?: ""
|
val title = data.title ?: ""
|
||||||
val poster = data.largeCoverUrl
|
val poster = data.largeCoverUrl
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue