diff --git a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/SflixProvider.kt b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/SflixProvider.kt index b6338358..1c4cf979 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/SflixProvider.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/SflixProvider.kt @@ -364,19 +364,39 @@ open class SflixProvider : MainAPI() { } private fun Element.toSearchResult(): SearchResponse { - val img = this.select("img") + val inner = this.selectFirst("div.film-poster") + val img = inner.select("img") val title = img.attr("title") - val posterUrl = img.attr("data-src") - val href = fixUrl(this.select("a").attr("href")) + val posterUrl = img.attr("data-src") ?: img.attr("src") + val href = fixUrl(inner.select("a").attr("href")) val isMovie = href.contains("/movie/") + val otherInfo = this.selectFirst("div.film-detail > div.fd-infor")?.select("span")?.toList() ?: listOf() + //var rating: Int? = null + var year: Int? = null + var quality: SearchQuality? = null + when (otherInfo.size) { + 1 -> { + year = otherInfo[0]?.text()?.trim()?.toIntOrNull() + } + 2 -> { + year = otherInfo[0]?.text()?.trim()?.toIntOrNull() + } + 3 -> { + //rating = otherInfo[0]?.text()?.toRatingInt() + quality = getQualityFromString(otherInfo[1]?.text()) + year = otherInfo[2]?.text()?.trim()?.toIntOrNull() + } + } + return if (isMovie) { MovieSearchResponse( title, href, this@SflixProvider.name, TvType.Movie, - posterUrl, - null + posterUrl = posterUrl, + year = year, + quality = quality, ) } else { TvSeriesSearchResponse( @@ -385,8 +405,9 @@ open class SflixProvider : MainAPI() { this@SflixProvider.name, TvType.Movie, posterUrl, - null, - null + year = year, + episodes = null, + quality = quality, ) } } diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchResultBuilder.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchResultBuilder.kt index a2a74b54..3546ba8c 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchResultBuilder.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchResultBuilder.kt @@ -64,7 +64,7 @@ object SearchResultBuilder { SearchQuality.SDR -> R.string.quality_sdr SearchQuality.HDR -> R.string.quality_hdr SearchQuality.WebRip -> R.string.quality_webrip - else -> null + null -> null }?.let { textRes -> textQuality?.setText(textRes) textQuality?.isVisible = true