Other Fixes

This commit is contained in:
contusionglory 2022-12-14 22:18:37 +00:00 committed by GitHub
parent 44664a60d2
commit c50d20330a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -62,13 +62,7 @@ class CasaCinemaProvider : MainAPI() { // all providers must be an instance of M
} }
private fun Element.toSearchResult(): SearchResponse { private fun Element.toSearchResult(): SearchResponse {
val title = val title = fixTitle(this.selectFirst(".title"))
this.selectFirst(".title")
?.text()
?.trim()
?.replace("[HD]", "")
?.replace("\\(\\d{4}\\)".toRegex(), "")
?: "No title"
val isMovie = this.selectFirst(".title").isMovie() val isMovie = this.selectFirst(".title").isMovie()
val link = val link =
this.selectFirst("a")?.attr("href") ?: throw ErrorLoadingException("No Link found") this.selectFirst("a")?.attr("href") ?: throw ErrorLoadingException("No Link found")
@ -94,8 +88,7 @@ class CasaCinemaProvider : MainAPI() { // all providers must be an instance of M
val type = val type =
if (document.select("div.seasons-wraper").isNotEmpty()) TvType.TvSeries if (document.select("div.seasons-wraper").isNotEmpty()) TvType.TvSeries
else TvType.Movie else TvType.Movie
val title = val title = fixTitle(document.selectFirst("div.row > h1"))
fixTitle(document.selectFirst("div.row > h1"))
val description = document.select("div.element").last()?.text() val description = document.select("div.element").last()?.text()
val year = document.selectFirst("div.element>a.tag") val year = document.selectFirst("div.element>a.tag")
?.text() ?.text()
@ -149,14 +142,8 @@ class CasaCinemaProvider : MainAPI() { // all providers must be an instance of M
private fun Element.toRecommendResult(): SearchResponse { private fun Element.toRecommendResult(): SearchResponse {
val title = val title =
this.selectFirst("span.crp_title") fixTitle(this.selectFirst("span.crp_title"))
?.text() val isMovie = this.selectFirst("span.crp_title").isMovie()
?.trim()
?.replace("[HD]", "")
?.replace("\\(\\d{4}\\)".toRegex(), "")
?: "No title"
val isMovie =
(this.selectFirst("span.crp_title")?.text() ?: "").contains("\\(\\d{4}\\)".toRegex())
val link = val link =
this.selectFirst("a")?.attr("href") ?: throw ErrorLoadingException("No Link found") this.selectFirst("a")?.attr("href") ?: throw ErrorLoadingException("No Link found")