stremiox: fix duplicate in search

This commit is contained in:
hexated 2023-04-04 14:01:15 +07:00
parent 2227e4520a
commit 0165d0a031
2 changed files with 4 additions and 4 deletions

View file

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 6 version = 7
cloudstream { cloudstream {

View file

@ -43,10 +43,10 @@ class StremioC : MainAPI() {
mainUrl = mainUrl.fixSourceUrl() mainUrl = mainUrl.fixSourceUrl()
val res = tryParseJson<Manifest>(app.get("${mainUrl}/manifest.json").text) ?: return null val res = tryParseJson<Manifest>(app.get("${mainUrl}/manifest.json").text) ?: return null
val list = mutableListOf<SearchResponse>() val list = mutableListOf<SearchResponse>()
res.catalogs.forEach { catalog -> res.catalogs.apmap { catalog ->
list.addAll(catalog.search(query, this)) list.addAll(catalog.search(query, this))
} }
return list return list.distinct()
} }
override suspend fun load(url: String): LoadResponse? { override suspend fun load(url: String): LoadResponse? {
@ -160,7 +160,7 @@ class StremioC : MainAPI() {
entries.add(entry.toSearchResponse(provider)) entries.add(entry.toSearchResponse(provider))
} }
} }
return entries.distinctBy { it.id } return entries
} }
suspend fun toHomePageList(provider: StremioC): HomePageList? { suspend fun toHomePageList(provider: StremioC): HomePageList? {