mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
added sflix mirror https://solarmovie.pe
This commit is contained in:
parent
c191d16b01
commit
d315b557ec
2 changed files with 76 additions and 59 deletions
|
@ -65,6 +65,7 @@ object APIHolder {
|
|||
|
||||
SflixProvider("https://sflix.to", "Sflix"),
|
||||
SflixProvider("https://dopebox.to", "Dopebox"),
|
||||
SflixProvider("https://solarmovie.pe", "Solarmovie"),
|
||||
|
||||
//TmdbProvider(),
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonProperty
|
|||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.LoadResponse.Companion.addActors
|
||||
import com.lagradost.cloudstream3.LoadResponse.Companion.setDuration
|
||||
import com.lagradost.cloudstream3.mvvm.suspendSafeApiCall
|
||||
import com.lagradost.cloudstream3.network.WebViewResolver
|
||||
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
|
||||
import com.lagradost.cloudstream3.utils.AppUtils.toJson
|
||||
|
@ -99,9 +100,9 @@ class SflixProvider(providerUrl: String, providerName: String) : MainAPI() {
|
|||
val document = app.get(url).document
|
||||
|
||||
val details = document.select("div.detail_page-watch")
|
||||
val img = details.select("img.film-poster-img")
|
||||
val posterUrl = img.attr("src")
|
||||
val title = img.attr("title")
|
||||
val img = details?.select("img.film-poster-img")
|
||||
val posterUrl = img?.attr("src")
|
||||
val title = img?.attr("title") ?: throw ErrorLoadingException("No Title")
|
||||
|
||||
/*
|
||||
val year = Regex("""[Rr]eleased:\s*(\d{4})""").find(
|
||||
|
@ -110,7 +111,7 @@ class SflixProvider(providerUrl: String, providerName: String) : MainAPI() {
|
|||
val duration = Regex("""[Dd]uration:\s*(\d*)""").find(
|
||||
document.select("div.elements").text()
|
||||
)?.groupValues?.get(1)?.trim()?.plus(" min")*/
|
||||
var duration = document.selectFirst(".fs-item > .duration").text()?.trim()
|
||||
var duration = document.selectFirst(".fs-item > .duration")?.text()?.trim()
|
||||
var year: Int? = null
|
||||
var tags: List<String>? = null
|
||||
var cast: List<String>? = null
|
||||
|
@ -133,7 +134,7 @@ class SflixProvider(providerUrl: String, providerName: String) : MainAPI() {
|
|||
}
|
||||
}
|
||||
}
|
||||
val plot = details.select("div.description").text().replace("Overview:", "").trim()
|
||||
val plot = details.select("div.description")?.text()?.replace("Overview:", "")?.trim()
|
||||
|
||||
val isMovie = url.contains("/movie/")
|
||||
|
||||
|
@ -169,9 +170,16 @@ class SflixProvider(providerUrl: String, providerName: String) : MainAPI() {
|
|||
|
||||
// Supported streams, they're identical
|
||||
val sourceIds = Jsoup.parse(episodes).select("a").mapNotNull { element ->
|
||||
val sourceId = element.attr("data-id") ?: return@mapNotNull null
|
||||
var sourceId = element.attr("data-id")
|
||||
if (sourceId.isNullOrEmpty())
|
||||
sourceId = element.attr("data-linkid")
|
||||
|
||||
if (element.select("span")?.text()?.trim()?.isValidServer() == true) {
|
||||
if (sourceId.isNullOrEmpty()) {
|
||||
fixUrlNull(element.attr("href"))
|
||||
} else {
|
||||
"$url.$sourceId".replace("/movie/", "/watch-movie/")
|
||||
}
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
@ -189,19 +197,25 @@ class SflixProvider(providerUrl: String, providerName: String) : MainAPI() {
|
|||
} else {
|
||||
val seasonsDocument = app.get("$mainUrl/ajax/v2/tv/seasons/$id").document
|
||||
val episodes = arrayListOf<TvSeriesEpisode>()
|
||||
|
||||
seasonsDocument.select("div.dropdown-menu.dropdown-menu-model > a")
|
||||
.forEachIndexed { season, element ->
|
||||
var seasonItems = seasonsDocument.select("div.dropdown-menu.dropdown-menu-model > a")
|
||||
if (seasonItems.isNullOrEmpty())
|
||||
seasonItems = seasonsDocument.select("div.dropdown-menu > a.dropdown-item")
|
||||
seasonItems?.forEachIndexed { season, element ->
|
||||
val seasonId = element.attr("data-id")
|
||||
if (seasonId.isNullOrBlank()) return@forEachIndexed
|
||||
|
||||
var episode = 0
|
||||
app.get("$mainUrl/ajax/v2/season/episodes/$seasonId").document
|
||||
.select("div.flw-item.film_single-item.episode-item.eps-item")
|
||||
.forEach {
|
||||
val episodeImg = it.select("img") ?: return@forEach
|
||||
val episodeTitle = episodeImg.attr("title") ?: return@forEach
|
||||
val episodePosterUrl = episodeImg.attr("src") ?: return@forEach
|
||||
val seasonEpisodes = app.get("$mainUrl/ajax/v2/season/episodes/$seasonId").document
|
||||
var seasonEpisodesItems =
|
||||
seasonEpisodes.select("div.flw-item.film_single-item.episode-item.eps-item")
|
||||
if (seasonEpisodesItems.isNullOrEmpty()) {
|
||||
seasonEpisodesItems =
|
||||
seasonEpisodes.select("ul > li > a")
|
||||
}
|
||||
seasonEpisodesItems.forEach {
|
||||
val episodeImg = it?.select("img")
|
||||
val episodeTitle = episodeImg?.attr("title") ?: it.ownText()
|
||||
val episodePosterUrl = episodeImg?.attr("src")
|
||||
val episodeData = it.attr("data-id") ?: return@forEach
|
||||
|
||||
episode++
|
||||
|
@ -215,11 +229,11 @@ class SflixProvider(providerUrl: String, providerName: String) : MainAPI() {
|
|||
|
||||
episodes.add(
|
||||
TvSeriesEpisode(
|
||||
episodeTitle.removePrefix("Episode $episodeNum: "),
|
||||
episodeTitle?.removePrefix("Episode $episodeNum: "),
|
||||
season + 1,
|
||||
episodeNum,
|
||||
Pair(url, episodeData).toJson(),
|
||||
fixUrl(episodePosterUrl)
|
||||
fixUrlNull(episodePosterUrl)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -277,6 +291,7 @@ class SflixProvider(providerUrl: String, providerName: String) : MainAPI() {
|
|||
} ?: tryParseJson<List<String>>(data))?.distinct()
|
||||
|
||||
urls?.apmap { url ->
|
||||
suspendSafeApiCall {
|
||||
val sources = app.get(
|
||||
url,
|
||||
interceptor = WebViewResolver(
|
||||
|
@ -303,6 +318,7 @@ class SflixProvider(providerUrl: String, providerName: String) : MainAPI() {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return !urls.isNullOrEmpty()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue