mirror of
https://github.com/recloudstream/cloudstream-extensions-multilingual.git
synced 2024-08-15 03:15:14 +00:00
skill(share) issue: add fallback
This commit is contained in:
parent
23f0ee0c8d
commit
a4bdb2caba
2 changed files with 3 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
||||||
// use an integer for version numbers
|
// use an integer for version numbers
|
||||||
version = 4
|
version = 5
|
||||||
|
|
||||||
|
|
||||||
cloudstream {
|
cloudstream {
|
||||||
|
|
|
@ -19,6 +19,7 @@ class SkillShareProvider : MainAPI() { // all providers must be an instance of M
|
||||||
|
|
||||||
private val apiUrl = "https://www.skillshare.com/api/graphql"
|
private val apiUrl = "https://www.skillshare.com/api/graphql"
|
||||||
private val bypassApiUrl = "https://skillshare.techtanic.xyz/id"
|
private val bypassApiUrl = "https://skillshare.techtanic.xyz/id"
|
||||||
|
private val bypassApiUrlFallback = "https://skillshare-api.heckernohecking.repl.co"
|
||||||
|
|
||||||
override val supportedTypes = setOf(TvType.Others)
|
override val supportedTypes = setOf(TvType.Others)
|
||||||
override val hasChromecastSupport = true
|
override val hasChromecastSupport = true
|
||||||
|
@ -144,6 +145,7 @@ 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}")
|
||||||
|
.parsedSafe<BypassApiData>() ?: app.get(bypassApiUrlFallback + "/${data.courseId}/0")
|
||||||
.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…
Reference in a new issue