mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
stremiox: fix id
This commit is contained in:
parent
a2a52ac174
commit
7e356b61b8
1 changed files with 7 additions and 0 deletions
|
@ -18,6 +18,7 @@ class Stremio : MainAPI() {
|
||||||
override val supportedTypes = setOf(TvType.Others)
|
override val supportedTypes = setOf(TvType.Others)
|
||||||
override val hasMainPage = true
|
override val hasMainPage = true
|
||||||
private var fixedUrl = mainUrl
|
private var fixedUrl = mainUrl
|
||||||
|
private val cinemataUrl = "https://v3-cinemeta.strem.io"
|
||||||
|
|
||||||
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse? {
|
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse? {
|
||||||
fixedUrl = mainUrl.fixSourceUrl()
|
fixedUrl = mainUrl.fixSourceUrl()
|
||||||
|
@ -46,6 +47,7 @@ class Stremio : MainAPI() {
|
||||||
|
|
||||||
override suspend fun load(url: String): LoadResponse? {
|
override suspend fun load(url: String): LoadResponse? {
|
||||||
val res = parseJson<CatalogEntry>(url)
|
val res = parseJson<CatalogEntry>(url)
|
||||||
|
fixedUrl = if((res.type == "movie" || res.type == "series") && isImdborTmdb(res.id)) cinemataUrl else mainUrl.fixSourceUrl()
|
||||||
val json = app.get("${fixedUrl}/meta/${res.type}/${res.id}.json")
|
val json = app.get("${fixedUrl}/meta/${res.type}/${res.id}.json")
|
||||||
.parsedSafe<CatalogResponse>()?.meta ?: throw RuntimeException(url)
|
.parsedSafe<CatalogResponse>()?.meta ?: throw RuntimeException(url)
|
||||||
return json.toLoadResponse(this)
|
return json.toLoadResponse(this)
|
||||||
|
@ -65,6 +67,11 @@ class Stremio : MainAPI() {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check if id is imdb/tmdb cause stremio addons like torrentio works base on imdbId
|
||||||
|
private fun isImdborTmdb(url: String?): Boolean {
|
||||||
|
return imdbUrlToIdNullable(url) != null || url?.startsWith("tmdb:") == true
|
||||||
|
}
|
||||||
|
|
||||||
private data class Manifest(val catalogs: List<Catalog>)
|
private data class Manifest(val catalogs: List<Catalog>)
|
||||||
private data class Catalog(
|
private data class Catalog(
|
||||||
var name: String?,
|
var name: String?,
|
||||||
|
|
Loading…
Reference in a new issue