fixo sflixo, removo dopeboxo

This commit is contained in:
LagradOst 2022-02-28 22:51:44 +01:00
parent 3a42ca2f6b
commit 8c7312e492
2 changed files with 49 additions and 40 deletions

View file

@ -66,10 +66,6 @@ object APIHolder {
AsianLoadProvider(), AsianLoadProvider(),
SflixProvider("https://sflix.to", "Sflix"),
SflixProvider("https://dopebox.to", "Dopebox"),
SflixProvider("https://solarmovie.pe", "Solarmovie"),
BflixProvider("https://bflix.ru","Bflix"), BflixProvider("https://bflix.ru","Bflix"),
BflixProvider("https://fmovies.to","Fmovies.to"), BflixProvider("https://fmovies.to","Fmovies.to"),
BflixProvider("https://sflix.pro","Sflix.pro"), BflixProvider("https://sflix.pro","Sflix.pro"),
@ -102,6 +98,10 @@ object APIHolder {
private val backwardsCompatibleProviders = arrayListOf( private val backwardsCompatibleProviders = arrayListOf(
KawaiifuProvider(), // removed due to cloudflare KawaiifuProvider(), // removed due to cloudflare
HDMProvider(),// removed due to cloudflare HDMProvider(),// removed due to cloudflare
SflixProvider("https://sflix.to", "Sflix"),
SflixProvider("https://dopebox.to", "Dopebox"),
SflixProvider("https://solarmovie.pe", "Solarmovie"),
) )
fun getApiFromName(apiName: String?): MainAPI { fun getApiFromName(apiName: String?): MainAPI {

View file

@ -2,11 +2,10 @@ package com.lagradost.cloudstream3.movieproviders
import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addActors
import com.lagradost.cloudstream3.utils.*
import com.lagradost.cloudstream3.utils.AppUtils.parseJson import com.lagradost.cloudstream3.utils.AppUtils.parseJson
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.loadExtractor
import org.jsoup.Jsoup import org.jsoup.Jsoup
import kotlin.collections.ArrayList
class BflixProvider(providerUrl: String, providerName: String) : MainAPI() { class BflixProvider(providerUrl: String, providerName: String) : MainAPI() {
override val mainUrl = providerUrl override val mainUrl = providerUrl
@ -18,6 +17,7 @@ class BflixProvider(providerUrl: String, providerName: String) : MainAPI() {
TvType.Movie, TvType.Movie,
TvType.TvSeries, TvType.TvSeries,
) )
override suspend fun getMainPage(): HomePageResponse { override suspend fun getMainPage(): HomePageResponse {
val items = ArrayList<HomePageList>() val items = ArrayList<HomePageList>()
val urls = listOf( val urls = listOf(
@ -52,12 +52,13 @@ class BflixProvider(providerUrl: String, providerName: String) : MainAPI() {
if (items.size <= 0) throw ErrorLoadingException() if (items.size <= 0) throw ErrorLoadingException()
return HomePageResponse(items) return HomePageResponse(items)
} }
//Credits to https://github.com/jmir1 //Credits to https://github.com/jmir1
val key = "eST4kCjadnvlAm5b1BOGyLJzrE90Q6oKgRfhV+M8NDYtcxW3IP/qp2i7XHuwZFUs" val key = "eST4kCjadnvlAm5b1BOGyLJzrE90Q6oKgRfhV+M8NDYtcxW3IP/qp2i7XHuwZFUs"
private fun getVrf(id: String): String? { private fun getVrf(id: String): String? {
val reversed = ue(encode(id) + "0000000").slice(0..5).reversed() val reversed = ue(encode(id) + "0000000").slice(0..5).reversed()
return reversed + ue(je(reversed, encode(id)?.replace("+","%20") ?: return null)).replace( return reversed + ue(je(reversed, encode(id)?.replace("+", "%20") ?: return null)).replace(
"""=+$""".toRegex(), """=+$""".toRegex(),
"" ""
) )
@ -191,11 +192,10 @@ class BflixProvider(providerUrl: String, providerName: String) : MainAPI() {
} }
} }
data class Response ( data class Response(
@JsonProperty("html") val html: String @JsonProperty("html") val html: String
) )
override suspend fun load(url: String): LoadResponse? { override suspend fun load(url: String): LoadResponse? {
val soup = app.get(url).document val soup = app.get(url).document
val movieid = soup.selectFirst("div#watch").attr("data-id") val movieid = soup.selectFirst("div#watch").attr("data-id")
@ -206,41 +206,48 @@ class BflixProvider(providerUrl: String, providerName: String) : MainAPI() {
val description = soup.selectFirst(".info .desc")?.text()?.trim() val description = soup.selectFirst(".info .desc")?.text()?.trim()
val poster: String? = try { val poster: String? = try {
soup.selectFirst("img.poster").attr("src") soup.selectFirst("img.poster").attr("src")
} catch (e:Exception) { } catch (e: Exception) {
soup.selectFirst(".info .poster img").attr("src") soup.selectFirst(".info .poster img").attr("src")
} }
val tags = soup.select("div.info .meta div:contains(Genre) a").map { it.text() } val tags = soup.select("div.info .meta div:contains(Genre) a").map { it.text() }
val episodes = if (tvType == TvType.TvSeries) Jsoup.parse( val episodes = if (tvType == TvType.TvSeries) Jsoup.parse(
parseJson<Response>( app.get(
app.get( "$mainUrl/ajax/film/servers?id=$movieid&vrf=$movieidencoded"
"$mainUrl/ajax/film/servers?id=$movieid&vrf=$movieidencoded" ).mapped<Response>().html
).text
).html
).select("div.episode").map { ).select("div.episode").map {
val href = fixUrl(it.selectFirst("a").attr("href")) val a = it.selectFirst("a")
val href = fixUrl(a.attr("href"))
val extraData = a.attr("data-kname")?.let { str ->
str.split("-").mapNotNull { subStr -> subStr.toIntOrNull() }
}
val isValid = extraData?.size == 2
val episode = if (isValid) extraData?.getOrNull(1) else null
val season = if (isValid) extraData?.getOrNull(0) else null
val eptitle = it.selectFirst(".episode a span.name").text() val eptitle = it.selectFirst(".episode a span.name").text()
TvSeriesEpisode( TvSeriesEpisode(
eptitle, eptitle,
null, season,
null, episode,
href, href,
) )
} else null } else null
val recommendations = val recommendations =
soup.select("div.bl-2 section.bl div.content div.filmlist div.item")?.mapNotNull { element -> soup.select("div.bl-2 section.bl div.content div.filmlist div.item")
val recTitle = element.select("h3 a").text() ?: return@mapNotNull null ?.mapNotNull { element ->
val image = element.select("a.poster img")?.attr("src") val recTitle = element.select("h3 a").text() ?: return@mapNotNull null
val recUrl = fixUrl(element.select("a").attr("href")) val image = element.select("a.poster img")?.attr("src")
MovieSearchResponse( val recUrl = fixUrl(element.select("a").attr("href"))
recTitle, MovieSearchResponse(
recUrl, recTitle,
this.name, recUrl,
if (recUrl.contains("/movie/")) TvType.Movie else TvType.TvSeries, this.name,
image, if (recUrl.contains("/movie/")) TvType.Movie else TvType.TvSeries,
year = null image,
) year = null
} )
}
return when (tvType) { return when (tvType) {
TvType.TvSeries -> { TvType.TvSeries -> {
@ -281,17 +288,17 @@ class BflixProvider(providerUrl: String, providerName: String) : MainAPI() {
} }
data class Subtitles ( data class Subtitles(
@JsonProperty("file") val file: String, @JsonProperty("file") val file: String,
@JsonProperty("label") val label: String, @JsonProperty("label") val label: String,
@JsonProperty("kind") val kind: String @JsonProperty("kind") val kind: String
) )
data class Links ( data class Links(
@JsonProperty("url") val url: String @JsonProperty("url") val url: String
) )
data class Servers ( data class Servers(
@JsonProperty("28") val mcloud: String?, @JsonProperty("28") val mcloud: String?,
@JsonProperty("35") val mp4upload: String?, @JsonProperty("35") val mp4upload: String?,
@JsonProperty("40") val streamtape: String?, @JsonProperty("40") val streamtape: String?,
@ -307,7 +314,7 @@ class BflixProvider(providerUrl: String, providerName: String) : MainAPI() {
): Boolean { ): Boolean {
val soup = app.get(data).document val soup = app.get(data).document
val movieid = encode(soup.selectFirst("div#watch").attr("data-id") ?: return false) val movieid = encode(soup.selectFirst("div#watch").attr("data-id") ?: return false)
val movieidencoded = encode(getVrf(movieid!!) ?: return false) val movieidencoded = encode(getVrf(movieid!!) ?: return false)
Jsoup.parse( Jsoup.parse(
parseJson<Response>( parseJson<Response>(
app.get( app.get(
@ -317,11 +324,12 @@ class BflixProvider(providerUrl: String, providerName: String) : MainAPI() {
) )
.select("html body #episodes").map { .select("html body #episodes").map {
val tvType = if (data.contains("movie/")) TvType.Movie else TvType.TvSeries val tvType = if (data.contains("movie/")) TvType.Movie else TvType.TvSeries
val cleandata = data.replace(mainUrl,"") val cleandata = data.replace(mainUrl, "")
val servers = if (tvType == TvType.Movie) it.select(".episode a").attr("data-ep") val servers = if (tvType == TvType.Movie) it.select(".episode a").attr("data-ep")
else else
it.select(".episode a[href=$cleandata]").attr("data-ep") it.select(".episode a[href=$cleandata]").attr("data-ep")
?: it.select(".episode a[href=${cleandata.replace("/1-full","")}]").attr("data-ep") ?: it.select(".episode a[href=${cleandata.replace("/1-full", "")}]")
.attr("data-ep")
val jsonservers = parseJson<Servers?>(servers) ?: return@map val jsonservers = parseJson<Servers?>(servers) ?: return@map
listOfNotNull( listOfNotNull(
jsonservers.vidstream, jsonservers.vidstream,
@ -333,14 +341,15 @@ class BflixProvider(providerUrl: String, providerName: String) : MainAPI() {
(if (epserver.contains("url")) { (if (epserver.contains("url")) {
parseJson<Links>(epserver) parseJson<Links>(epserver)
} else null)?.url?.let { it1 -> getLink(it1.replace("=", "")) } } else null)?.url?.let { it1 -> getLink(it1.replace("=", "")) }
?.replace("/embed/", "/e/")?.replace(Regex("(\\?sub.info.*)"),"") ?.replace("/embed/", "/e/")?.replace(Regex("(\\?sub.info.*)"), "")
}.apmap { url -> }.apmap { url ->
loadExtractor( loadExtractor(
url, data, callback url, data, callback
) )
} }
//Apparently any server works, I haven't found any diference //Apparently any server works, I haven't found any diference
val sublink = app.get("$mainUrl/ajax/episode/subtitles/${jsonservers.vidstream}").text val sublink =
app.get("$mainUrl/ajax/episode/subtitles/${jsonservers.vidstream}").text
val jsonsub = parseJson<List<Subtitles>>(sublink) val jsonsub = parseJson<List<Subtitles>>(sublink)
jsonsub.forEach { subtitle -> jsonsub.forEach { subtitle ->
subtitleCallback( subtitleCallback(