Add vido extractor for frenchStream

This commit is contained in:
Eddy 2022-09-14 01:30:09 +02:00
parent fbc3585980
commit d57065a931
3 changed files with 63 additions and 13 deletions

View file

@ -1,10 +1,13 @@
package com.lagradost package com.lagradost
import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.extractorApis import com.lagradost.cloudstream3.utils.extractorApis
import okhttp3.Interceptor
import org.jsoup.nodes.Element import org.jsoup.nodes.Element
import com.lagradost.cloudstream3.network.CloudflareKiller
class FrenchStreamProvider : MainAPI() { class FrenchStreamProvider : MainAPI() {
@ -14,10 +17,9 @@ class FrenchStreamProvider : MainAPI() {
override val hasMainPage = true override val hasMainPage = true
override var lang = "fr" override var lang = "fr"
override val supportedTypes = setOf(TvType.Movie, TvType.TvSeries) override val supportedTypes = setOf(TvType.Movie, TvType.TvSeries)
private val interceptor = CloudflareKiller()
override suspend fun search(query: String): List<SearchResponse> { override suspend fun search(query: String): List<SearchResponse> {
val link = "$mainUrl/?do=search&subaction=search&story=$query" // search' val link = "$mainUrl/?do=search&subaction=search&story=$query" // search'
val document = val document =
app.post(link).document // app.get() permet de télécharger la page html avec une requete HTTP (get) app.post(link).document // app.get() permet de télécharger la page html avec une requete HTTP (get)
val results = document.select("div#dle-content > > div.short") val results = document.select("div#dle-content > > div.short")
@ -99,7 +101,8 @@ class FrenchStreamProvider : MainAPI() {
url, url,
TvType.TvSeries, TvType.TvSeries,
episodes, episodes,
){this.posterUrl = poster ) {
this.posterUrl = poster
this.plot = description this.plot = description
this.year = year?.toInt() this.year = year?.toInt()
//this.rating = rating //this.rating = rating
@ -200,14 +203,25 @@ class FrenchStreamProvider : MainAPI() {
} }
movieServers movieServers
} }
val regeUpstream = Regex("""https:\\\/\\\/uptostream.com\\\/([^&]*)""")
val regeVido = Regex("""href\=\"https:\/\/vido\.lol\/(.*)\" target="_blank"><img""")
servers.apmap { servers.apmap {
for (extractor in extractorApis) { for (extractor in extractorApis) {
if (it.first.contains(extractor.name, ignoreCase = true)) { if (it.first.contains(extractor.name, ignoreCase = true)) {
// val name = it.first val playerName = it.first
// print("true for $name") var playerUrl = when (!playerName.isNullOrEmpty()) {
extractor.getSafeUrl(it.second, it.second, subtitleCallback, callback) playerName.contains("Uqload"), playerName.contains("UQLOAD") -> it.second
break playerName.contains("Uptostream"), playerName.contains("UPTOSTREAM") -> "https://uptostream.com/iframe/" + (regeUpstream.find(
app.get("https" + it.second.split("https").get(1)).text // need to do the extractor
)?.groupValues?.get(1)
?: "")
playerName.contains("ViDO"), playerName.contains("VIDO") -> "https://vido.lol/embed-" + (regeVido.find(
app.get("https" + it.second.split("https").get(1)).text
)?.groupValues?.get(1)) + ".html"
else -> ""
}
extractor.getSafeUrl(playerUrl, playerUrl, subtitleCallback, callback)
} }
} }
} }
@ -216,14 +230,13 @@ class FrenchStreamProvider : MainAPI() {
} }
private fun Element.toSearchResponse(): SearchResponse { private fun Element.toSearchResponse(): SearchResponse {
val posterUrl = fixUrl(select("a.short-poster > img").attr("src")) val posterUrl = fixUrl(select("a.short-poster > img").attr("src"))
val qualityExtracted = select("span.film-ripz > a").text() val qualityExtracted = select("span.film-ripz > a").text()
val type = select("span.mli-eps").text() val type = select("span.mli-eps").text()
val title = select("div.short-title").text() val title = select("div.short-title").text()
val link = select("a.short-poster").attr("href").replace("wvw.","") //wvw is an issue val link = select("a.short-poster").attr("href").replace("wvw.", "") //wvw is an issue
var quality: SearchQuality? var quality: SearchQuality?
if (qualityExtracted.contains("HDLight")) { if (qualityExtracted.contains("HDLight")) {
quality = getQualityFromString("HD") quality = getQualityFromString("HD")
@ -236,7 +249,7 @@ class FrenchStreamProvider : MainAPI() {
} else { } else {
quality = null quality = null
} }
if (type.contains("Eps",false)) { if (type.contains("Eps", false)) {
return MovieSearchResponse( return MovieSearchResponse(
name = title, name = title,
url = link, url = link,
@ -290,3 +303,4 @@ class FrenchStreamProvider : MainAPI() {
} }

View file

@ -10,5 +10,6 @@ class FrenchStreamProviderPlugin: Plugin() {
override fun load(context: Context) { override fun load(context: Context) {
// All providers should be added in this manner. Please don't edit the providers list directly. // All providers should be added in this manner. Please don't edit the providers list directly.
registerMainAPI(FrenchStreamProvider()) registerMainAPI(FrenchStreamProvider())
registerExtractorAPI(VidoExtractor())
} }
} }

View file

@ -0,0 +1,35 @@
package com.lagradost.cloudstream3.extractors
import com.lagradost.cloudstream3.app
import com.lagradost.cloudstream3.utils.ExtractorApi
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.Qualities
import com.lagradost.cloudstream3.utils.getAndUnpack
class VidoExtractor : ExtractorApi() {
override var name = "Vido"
override var mainUrl = "https://vido.lol"
private val srcRegex = Regex("""layer\(\{sources\:\["(.*)"\]""")
override val requiresReferer = true
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
with(app.get(url)) {
getAndUnpack(this.text).let { unpackedText ->
//val quality = unpackedText.lowercase().substringAfter(" height=").substringBefore(" ").toIntOrNull()
srcRegex.find(unpackedText)?.groupValues?.get(1)?.let { link ->
return listOf(
ExtractorLink(
name,
name,
link,
url,
Qualities.Unknown.value,
true,
)
)
}
}
}
return null
}
}