Update FrenchStream

This commit is contained in:
Eddy 2022-09-12 18:40:18 +02:00
parent c0e242d263
commit 4fdfe68311
3 changed files with 113 additions and 94 deletions

View file

@ -6,8 +6,8 @@ cloudstream {
language = "fr" language = "fr"
// All of these properties are optional, you can safely remove them // All of these properties are optional, you can safely remove them
// description = "Lorem Ipsum" description = "FRENCH STREAM en plus d'être un site efficace et plaisant dispose d'un contenu visuel diversifié"
// authors = listOf("Cloudburst") authors = listOf("Sarlay feat Eddy")
/** /**
* Status int as the following: * Status int as the following:
@ -23,5 +23,5 @@ cloudstream {
"Movie", "Movie",
) )
iconUrl = "https://www.google.com/s2/favicons?domain=french-stream.re&sz=%size%" iconUrl = "https://www.google.com/s2/favicons?domain=french-stream.ac&sz=%size%"
} }

View file

@ -1,54 +1,32 @@
package com.lagradost package com.lagradost
import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addRating
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 org.jsoup.nodes.Element
class FrenchStreamProvider : MainAPI() { class FrenchStreamProvider : MainAPI() {
override var mainUrl = "https://french-stream.re" override var mainUrl = "https://french-stream.ac" //re ou ac
override var name = "French Stream" override var name = "FrenchStream"
override val hasQuickSearch = false override val hasQuickSearch = false
override val hasMainPage = true override val hasMainPage = true
override var lang = "fr" override var lang = "fr"
override val supportedTypes = setOf(TvType.AnimeMovie, TvType.TvSeries, TvType.Movie) override val supportedTypes = setOf(TvType.Movie, TvType.TvSeries)
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" val link = "$mainUrl/?do=search&subaction=search&story=$query" // search'
val soup = app.post(link).document var mediaType = TvType.Anime
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")
return soup.select("div.short-in.nl").map { li -> val Allresultshome =
val href = fixUrl(li.selectFirst("a.short-poster")!!.attr("href")) results.apmap { article -> // avec mapnotnull si un élément est null, il sera automatiquement enlevé de la liste
val poster = li.selectFirst("img")?.attr("src") article.toSearchResponse()
val title = li.selectFirst("> a.short-poster")!!.text().toString().replace(". ", "")
val year = li.selectFirst(".date")?.text()?.split("-")?.get(0)?.toIntOrNull()
if (title.contains(
"saison",
ignoreCase = true
)
) { // if saison in title ==> it's a TV serie
TvSeriesSearchResponse(
title,
href,
this.name,
TvType.TvSeries,
poster,
year,
(title.split("Eps ", " ")[1]).split(" ")[0].toIntOrNull()
)
} else { // it's a movie
MovieSearchResponse(
title,
href,
this.name,
TvType.Movie,
poster,
year,
)
}
} }
return Allresultshome
} }
override suspend fun load(url: String): LoadResponse { override suspend fun load(url: String): LoadResponse {
@ -58,45 +36,45 @@ class FrenchStreamProvider : MainAPI() {
val isMovie = !title.contains("saison", ignoreCase = true) val isMovie = !title.contains("saison", ignoreCase = true)
val description = val description =
soup.selectFirst("div.fdesc")!!.text().toString() soup.selectFirst("div.fdesc")!!.text().toString()
.split("streaming", ignoreCase = true)[1].replace(" : ", "") .split("streaming", ignoreCase = true)[1].replace(":", "")
var poster = fixUrlNull(soup.selectFirst("div.fposter > img")?.attr("src")) var poster = soup.selectFirst("div.fposter > img")?.attr("src")
val listEpisode = soup.select("div.elink") val listEpisode = soup.select("div.elink")
val tags = soup.select("ul.flist-col > li").getOrNull(1)
//val rating = soup.select("span[id^=vote-num-id]")?.getOrNull(1)?.text()?.toInt()
if (isMovie) { if (isMovie) {
val tags = soup.select("ul.flist-col > li").getOrNull(1) val yearRegex = Regex("""ate de sortie\: (\d*)""")
val year = yearRegex.find(soup.text())?.groupValues?.get(1)
val tagsList = tags?.select("a") val tagsList = tags?.select("a")
?.mapNotNull { // all the tags like action, thriller ...; unused variable ?.mapNotNull { // all the tags like action, thriller ...; unused variable
it?.text() it?.text()
} }
return newMovieLoadResponse(title, url, TvType.Movie, url) { return newMovieLoadResponse(title, url, TvType.Movie, url) {
this.posterUrl = poster this.posterUrl = poster
addRating(soup.select("div.fr-count > div").text()) this.year = year?.toInt()
this.year = soup.select("ul.flist-col > li").getOrNull(2)?.text()?.toIntOrNull()
this.tags = tagsList this.tags = tagsList
this.plot = description this.plot = description
addTrailer(soup.selectFirst("div.fleft > span > a")?.attr("href")) //this.rating = rating
addTrailer(soup.selectFirst("button#myBtn > a")?.attr("href"))
} }
} else // a tv serie } else // a tv serie
{ {
//println(listEpisode)
//println("listeEpisode:")
val episodeList = if ("<a" !in (listEpisode[0]).toString()) { // check if VF is empty val episodeList = if ("<a" !in (listEpisode[0]).toString()) { // check if VF is empty
listEpisode[1] // no vf, return vostfr listEpisode[1] // no vf, return vostfr
} else { } else {
listEpisode[0] // no vostfr, return vf listEpisode[0] // no vostfr, return vf
} }
//println(url)
val episodes = episodeList.select("a").map { a -> val episodes = episodeList.select("a").map { a ->
val epNum = a.text().split("Episode")[1].trim().toIntOrNull() val epNum = a.text().split("Episode")[1].trim().toIntOrNull()
val epTitle = if (a.text().contains("Episode")) { val epTitle = if (a.text().contains("Episode")) {
val type = if ("honey" in a.attr("id")) { val type = if ("honey" in a.attr("id")) {
"VF" "VF"
} else { } else {
"VOSTFR" "Vostfr"
} }
"Episode " + epNum?.toString() + " en " + type "Episode " + type
} else { } else {
a.text() a.text()
} }
@ -112,17 +90,23 @@ class FrenchStreamProvider : MainAPI() {
null // episode date null // episode date
) )
} }
return TvSeriesLoadResponse(
// val tagsList = tags?.text()?.replace("Genre :","")
val yearRegex = Regex("""Titre .* \/ (\d*)""")
val year = yearRegex.find(soup.text())?.groupValues?.get(1)
return newTvSeriesLoadResponse(
title, title,
url, url,
this.name,
TvType.TvSeries, TvType.TvSeries,
episodes, episodes,
poster, ){this.posterUrl = poster
null, this.plot = description
description, this.year = year?.toInt()
ShowStatus.Ongoing, //this.rating = rating
) //this.showStatus = ShowStatus.Ongoing
//this.tags = tagsList
addTrailer(soup.selectFirst("button#myBtn > a")?.attr("href"))
}
} }
} }
@ -232,42 +216,77 @@ class FrenchStreamProvider : MainAPI() {
} }
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse? {
val document = app.get(mainUrl).document private fun Element.toSearchResponse(): SearchResponse {
val docs = document.select("div.sect")
val returnList = docs.mapNotNull { val posterUrl = fixUrl(select("a.short-poster > img").attr("src"))
val epList = it.selectFirst("> div.sect-c.floats.clearfix") ?: return@mapNotNull null val qualityExtracted = select("span.film-ripz > a").text()
val title = val type = select("span.mli-eps").text()
it.selectFirst("> div.sect-t.fx-row.icon-r > div.st-left > a.st-capt")!!.text() val title = select("div.short-title").text()
val list = epList.select("> div.short") val link = select("a.short-poster").attr("href").replace("wvw.","") //wvw is an issue
val isMovieType = title.contains("Films") // if truen type is Movie var quality = getQualityFromString("")
val currentList = list.map { head -> if (qualityExtracted.contains("HDLight")) {
val hrefItem = head.selectFirst("> div.short-in.nl > a") quality = getQualityFromString("HD")
val href = fixUrl(hrefItem!!.attr("href")) } else if (qualityExtracted.contains("Bdrip")) {
val img = hrefItem.selectFirst("> img") quality = getQualityFromString("BlueRay")
val posterUrl = img!!.attr("src") } else if (qualityExtracted.contains("DVD")) {
val name = img.attr("> div.short-title").toString() quality = getQualityFromString("DVD")
return@map if (isMovieType) MovieSearchResponse( } else if (qualityExtracted.contains("CAM")) {
name, quality = getQualityFromString("Cam")
href, } else {
this.name, quality = null
TvType.Movie, }
posterUrl, if (type.contains("Eps",false)) {
null return MovieSearchResponse(
) else TvSeriesSearchResponse( name = title,
name, url = link,
href, apiName = title,
this.name, type = TvType.Movie,
TvType.TvSeries, posterUrl = posterUrl,
posterUrl, quality = quality
null, null
) )
} else // an Serie
{
return TvSeriesSearchResponse(
name = title,
url = link,
apiName = title,
type = TvType.TvSeries,
posterUrl = posterUrl,
quality = quality,
//
)
} }
if (currentList.isNotEmpty()) {
HomePageList(title, currentList)
} else null
} }
if (returnList.isEmpty()) return null
return HomePageResponse(returnList) override val mainPage = mainPageOf(
Pair("$mainUrl/xfsearch/version-film/page/", "Derniers films"),
Pair("$mainUrl/xfsearch/version-serie/page/", "Derniers séries"),
Pair("$mainUrl/film/arts-martiaux/page/", "Films za m'ringué (Arts martiaux)"),
Pair("$mainUrl/film/action/page/", "Films Actions"),
Pair("$mainUrl/film/romance/page/", "Films za malomo (Romance)"),
Pair("$mainUrl/serie/aventure-serie/page/", "Série aventure"),
Pair("$mainUrl/film/documentaire/page/", "Documentaire")
)
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
val url = request.data + page
val document = app.get(url).document
val movies = document.select("div#dle-content > div.short")
val home =
movies.apmap { article -> // avec mapnotnull si un élément est null, il sera automatiquement enlevé de la liste
article.toSearchResponse()
} }
return newHomePageResponse(request.name, home)
}
} }

View file

@ -286,7 +286,7 @@ class WiflixProvider : MainAPI() {
name = title, name = title,
url = link, url = link,
apiName = title, apiName = title,
type = TvType.Movie, type = TvType.TvSeries,
posterUrl = posterUrl, posterUrl = posterUrl,
quality = quality, quality = quality,
// //