From d57065a9315f82751d0cd4bb03f18c60806e89a5 Mon Sep 17 00:00:00 2001 From: Eddy Date: Wed, 14 Sep 2022 01:30:09 +0200 Subject: [PATCH] Add vido extractor for frenchStream --- .../com/lagradost/FrenchStreamProvider.kt | 40 +++++++++++++------ .../lagradost/FrenchStreamProviderPlugin.kt | 1 + .../kotlin/com/lagradost/VidoExtractor.kt | 35 ++++++++++++++++ 3 files changed, 63 insertions(+), 13 deletions(-) create mode 100644 FrenchStreamProvider/src/main/kotlin/com/lagradost/VidoExtractor.kt diff --git a/FrenchStreamProvider/src/main/kotlin/com/lagradost/FrenchStreamProvider.kt b/FrenchStreamProvider/src/main/kotlin/com/lagradost/FrenchStreamProvider.kt index 5831da5..9757b95 100644 --- a/FrenchStreamProvider/src/main/kotlin/com/lagradost/FrenchStreamProvider.kt +++ b/FrenchStreamProvider/src/main/kotlin/com/lagradost/FrenchStreamProvider.kt @@ -1,10 +1,13 @@ package com.lagradost + import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.extractorApis +import okhttp3.Interceptor import org.jsoup.nodes.Element +import com.lagradost.cloudstream3.network.CloudflareKiller class FrenchStreamProvider : MainAPI() { @@ -14,10 +17,9 @@ class FrenchStreamProvider : MainAPI() { override val hasMainPage = true override var lang = "fr" override val supportedTypes = setOf(TvType.Movie, TvType.TvSeries) - + private val interceptor = CloudflareKiller() override suspend fun search(query: String): List { - val link = "$mainUrl/?do=search&subaction=search&story=$query" // search' - + val link = "$mainUrl/?do=search&subaction=search&story=$query" // search' val document = 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") @@ -91,7 +93,7 @@ class FrenchStreamProvider : MainAPI() { ) } - // val tagsList = tags?.text()?.replace("Genre :","") + // val tagsList = tags?.text()?.replace("Genre :","") val yearRegex = Regex("""Titre .* \/ (\d*)""") val year = yearRegex.find(soup.text())?.groupValues?.get(1) return newTvSeriesLoadResponse( @@ -99,7 +101,8 @@ class FrenchStreamProvider : MainAPI() { url, TvType.TvSeries, episodes, - ){this.posterUrl = poster + ) { + this.posterUrl = poster this.plot = description this.year = year?.toInt() //this.rating = rating @@ -200,14 +203,25 @@ class FrenchStreamProvider : MainAPI() { } movieServers } - + val regeUpstream = Regex("""https:\\\/\\\/uptostream.com\\\/([^&]*)""") + val regeVido = Regex("""href\=\"https:\/\/vido\.lol\/(.*)\" target="_blank"> it.second + 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 { val posterUrl = fixUrl(select("a.short-poster > img").attr("src")) val qualityExtracted = select("span.film-ripz > a").text() val type = select("span.mli-eps").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? if (qualityExtracted.contains("HDLight")) { quality = getQualityFromString("HD") @@ -236,7 +249,7 @@ class FrenchStreamProvider : MainAPI() { } else { quality = null } - if (type.contains("Eps",false)) { + if (type.contains("Eps", false)) { return MovieSearchResponse( name = title, url = link, @@ -290,3 +303,4 @@ class FrenchStreamProvider : MainAPI() { } + diff --git a/FrenchStreamProvider/src/main/kotlin/com/lagradost/FrenchStreamProviderPlugin.kt b/FrenchStreamProvider/src/main/kotlin/com/lagradost/FrenchStreamProviderPlugin.kt index f111fc9..ac71bb4 100644 --- a/FrenchStreamProvider/src/main/kotlin/com/lagradost/FrenchStreamProviderPlugin.kt +++ b/FrenchStreamProvider/src/main/kotlin/com/lagradost/FrenchStreamProviderPlugin.kt @@ -10,5 +10,6 @@ class FrenchStreamProviderPlugin: Plugin() { override fun load(context: Context) { // All providers should be added in this manner. Please don't edit the providers list directly. registerMainAPI(FrenchStreamProvider()) + registerExtractorAPI(VidoExtractor()) } } \ No newline at end of file diff --git a/FrenchStreamProvider/src/main/kotlin/com/lagradost/VidoExtractor.kt b/FrenchStreamProvider/src/main/kotlin/com/lagradost/VidoExtractor.kt new file mode 100644 index 0000000..54f03e2 --- /dev/null +++ b/FrenchStreamProvider/src/main/kotlin/com/lagradost/VidoExtractor.kt @@ -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? { + 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 + } +} \ No newline at end of file