Fixes
This commit is contained in:
parent
ca2f412db2
commit
9e3cb84e84
|
@ -12,7 +12,6 @@ import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.ShortLink.unshorten
|
import com.lagradost.cloudstream3.utils.ShortLink.unshorten
|
||||||
import com.lagradost.cloudstream3.utils.loadExtractor
|
import com.lagradost.cloudstream3.utils.loadExtractor
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
import android.util.Log
|
|
||||||
|
|
||||||
class CasaCinemaProvider : MainAPI() { // all providers must be an instance of MainAPI
|
class CasaCinemaProvider : MainAPI() { // all providers must be an instance of MainAPI
|
||||||
override var mainUrl = "https://casacinema.lol/"
|
override var mainUrl = "https://casacinema.lol/"
|
||||||
|
@ -29,6 +28,21 @@ class CasaCinemaProvider : MainAPI() { // all providers must be an instance of M
|
||||||
"$mainUrl/category/film/page/" to "Ultimi Film",
|
"$mainUrl/category/film/page/" to "Ultimi Film",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
private fun fixTitle(element: Element?): String {
|
||||||
|
return element?.text()
|
||||||
|
?.trim()
|
||||||
|
?.substringBefore("Streaming")
|
||||||
|
?.replace("[HD]", "")
|
||||||
|
?.replace("\\(\\d{4}\\)".toRegex(), "")
|
||||||
|
?: "No Title found"
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun Element?.isMovie(): Boolean {
|
||||||
|
return (this
|
||||||
|
?.text() ?: "")
|
||||||
|
.contains("\\(\\d{4}\\)".toRegex())
|
||||||
|
}
|
||||||
|
|
||||||
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
|
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
|
||||||
|
|
||||||
val url = request.data + page
|
val url = request.data + page
|
||||||
|
@ -55,7 +69,7 @@ class CasaCinemaProvider : MainAPI() { // all providers must be an instance of M
|
||||||
?.replace("[HD]", "")
|
?.replace("[HD]", "")
|
||||||
?.replace("\\(\\d{4}\\)".toRegex(), "")
|
?.replace("\\(\\d{4}\\)".toRegex(), "")
|
||||||
?: "No title"
|
?: "No title"
|
||||||
val isMovie = (this.selectFirst(".title")?.text() ?: "").contains("\\(\\d{4}\\)".toRegex())
|
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")
|
||||||
|
|
||||||
|
@ -81,12 +95,7 @@ class CasaCinemaProvider : MainAPI() { // all providers must be an instance of M
|
||||||
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 =
|
||||||
document.selectFirst("div.row > h1")
|
fixTitle(document.selectFirst("div.row > h1"))
|
||||||
?.text()
|
|
||||||
?.trim()
|
|
||||||
?.replace("[HD]", "")
|
|
||||||
?.replace("\\(\\d{4}\\)".toRegex(), "")
|
|
||||||
?: "No Title found"
|
|
||||||
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()
|
||||||
|
@ -190,7 +199,7 @@ class CasaCinemaProvider : MainAPI() { // all providers must be an instance of M
|
||||||
"Episodio $epNum"
|
"Episodio $epNum"
|
||||||
}
|
}
|
||||||
val posterUrl = this.selectFirst("figure>img")?.attr("src")
|
val posterUrl = this.selectFirst("figure>img")?.attr("src")
|
||||||
return Episode(data, epTitle, season, epNum?.toInt(), posterUrl = posterUrl)
|
return Episode(data, epTitle, season, epNum.toInt(), posterUrl = posterUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue