Requested changes are done
This commit is contained in:
parent
3b8b76d74f
commit
b96461bc37
|
@ -5,7 +5,6 @@ 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
|
||||
|
||||
|
@ -24,11 +23,11 @@ class FrenchStreamProvider : MainAPI() {
|
|||
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 Allresultshome =
|
||||
val allresultshome =
|
||||
results.apmap { article -> // avec mapnotnull si un élément est null, il sera automatiquement enlevé de la liste
|
||||
article.toSearchResponse()
|
||||
}
|
||||
return Allresultshome
|
||||
return allresultshome
|
||||
}
|
||||
|
||||
override suspend fun load(url: String): LoadResponse {
|
||||
|
@ -53,7 +52,7 @@ class FrenchStreamProvider : MainAPI() {
|
|||
}
|
||||
return newMovieLoadResponse(title, url, TvType.Movie, url) {
|
||||
this.posterUrl = poster
|
||||
this.year = year?.toInt()
|
||||
this.year = year?.toIntOrNull()
|
||||
this.tags = tagsList
|
||||
this.plot = description
|
||||
//this.rating = rating
|
||||
|
@ -244,18 +243,15 @@ class FrenchStreamProvider : MainAPI() {
|
|||
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
|
||||
var quality: SearchQuality?
|
||||
if (qualityExtracted.contains("HDLight")) {
|
||||
quality = getQualityFromString("HD")
|
||||
} else if (qualityExtracted.contains("Bdrip")) {
|
||||
quality = getQualityFromString("BlueRay")
|
||||
} else if (qualityExtracted.contains("DVD")) {
|
||||
quality = getQualityFromString("DVD")
|
||||
} else if (qualityExtracted.contains("CAM")) {
|
||||
quality = getQualityFromString("Cam")
|
||||
} else {
|
||||
quality = null
|
||||
var quality = when (!qualityExtracted.isNullOrBlank()) {
|
||||
qualityExtracted.contains("HDLight") -> getQualityFromString("HD")
|
||||
qualityExtracted.contains("Bdrip") -> getQualityFromString("BlueRay")
|
||||
qualityExtracted.contains("DVD") -> getQualityFromString("DVD")
|
||||
qualityExtracted.contains("CAM") -> getQualityFromString("Cam")
|
||||
|
||||
else -> null
|
||||
}
|
||||
|
||||
if (type.contains("Eps", false)) {
|
||||
return MovieSearchResponse(
|
||||
name = title,
|
||||
|
@ -301,7 +297,7 @@ class FrenchStreamProvider : MainAPI() {
|
|||
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
|
||||
movies.map { article -> // avec mapnotnull si un élément est null, il sera automatiquement enlevé de la liste
|
||||
article.toSearchResponse()
|
||||
}
|
||||
return newHomePageResponse(request.name, home)
|
||||
|
@ -309,4 +305,3 @@ class FrenchStreamProvider : MainAPI() {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ class NekosamaProvider : MainAPI() {
|
|||
)
|
||||
|
||||
// Looking for the best title matching from parsed Episode data
|
||||
private fun EpisodeData.TitleObtainedBysortByQuery(query: String?): String? {
|
||||
private fun EpisodeData.titleObtainedBysortByQuery(query: String?): String? {
|
||||
|
||||
if (query == null) {
|
||||
// No shorting so return the first title
|
||||
|
@ -62,29 +62,11 @@ class NekosamaProvider : MainAPI() {
|
|||
} else {
|
||||
|
||||
|
||||
var title = this.title
|
||||
var title1 = this.title_french
|
||||
var title2 = this.title_english
|
||||
var title3 = this.title_romanji
|
||||
|
||||
|
||||
val titles = ArrayList<String>()
|
||||
if (title != null) {
|
||||
titles.add(title)
|
||||
}
|
||||
if (title1 != null) {
|
||||
titles.add(title1)
|
||||
}
|
||||
if (title2 != null) {
|
||||
titles.add(title2)
|
||||
}
|
||||
if (title3 != null) {
|
||||
titles.add(title3)
|
||||
}
|
||||
val titles = listOf(title, title_french, title_english, title_romanji).filterNotNull()
|
||||
// Sorted by the best title matching
|
||||
val titlesSorted = titles.sortedBy { it ->
|
||||
-FuzzySearch.ratio(
|
||||
it?.take(query.length + nCharQuery) ?: it,
|
||||
it?.take(query.length + nCharQuery),
|
||||
query
|
||||
)
|
||||
}
|
||||
|
@ -101,7 +83,7 @@ class NekosamaProvider : MainAPI() {
|
|||
} else {
|
||||
|
||||
this.sortedBy {
|
||||
val bestTitleMatching = it.TitleObtainedBysortByQuery(query)
|
||||
val bestTitleMatching = it.titleObtainedBysortByQuery(query)
|
||||
-FuzzySearch.ratio(
|
||||
bestTitleMatching?.take(query.length + nCharQuery) ?: bestTitleMatching,
|
||||
query
|
||||
|
@ -131,60 +113,57 @@ class NekosamaProvider : MainAPI() {
|
|||
Chaque classes nécessite des données différentes, mais a en commun le nom, le poster et l'url
|
||||
**/
|
||||
override suspend fun search(query: String): List<SearchResponse> {
|
||||
val link2 = Pair("$mainUrl/animes-search-vf.json", "(VF) ")
|
||||
val link = Pair("$mainUrl/animes-search-vostfr.json", "(Vostfr) ")
|
||||
val links = ArrayList<Pair<String, String>>()
|
||||
links.add(link2)
|
||||
links.add(link)
|
||||
var ListResults = ArrayList<SearchResponse>()
|
||||
if (links != null) {
|
||||
links.apmap {
|
||||
val url = it.first
|
||||
val version = it.second
|
||||
val reponse = app.get(url).text
|
||||
val ParsedData = tryParseJson<ArrayList<EpisodeData>>(reponse)
|
||||
|
||||
ParsedData?.sortByQuery(query)?.take(resultsSearchNbr)?.apmap { it ->
|
||||
val type = it.type
|
||||
val mediaPoster = it.url_image
|
||||
val href = mainUrl + it.url
|
||||
val bestTitleMatching = it.TitleObtainedBysortByQuery(query)
|
||||
val title = version + bestTitleMatching
|
||||
var listofResults = ArrayList<SearchResponse>()
|
||||
|
||||
when (type) {
|
||||
"m0v1e", "special" -> (
|
||||
ListResults.add(newMovieSearchResponse( // réponse du film qui sera ajoutée à la liste apmap qui sera ensuite return
|
||||
title,
|
||||
href,
|
||||
TvType.AnimeMovie,
|
||||
false
|
||||
) {
|
||||
this.posterUrl = mediaPoster
|
||||
}
|
||||
))
|
||||
null, "tv", "ova", "" -> (
|
||||
ListResults.add(newAnimeSearchResponse(
|
||||
title,
|
||||
href,
|
||||
TvType.Anime,
|
||||
false
|
||||
) {
|
||||
this.posterUrl = mediaPoster
|
||||
}
|
||||
listOf(
|
||||
"$mainUrl/animes-search-vf.json" to "(VF) ",
|
||||
"$mainUrl/animes-search-vostfr.json" to "(Vostfr) "
|
||||
).apmap { it ->
|
||||
val url = it.first
|
||||
val version = it.second
|
||||
val reponse = app.get(url).text
|
||||
val ParsedData = tryParseJson<ArrayList<EpisodeData>>(reponse)
|
||||
|
||||
ParsedData?.sortByQuery(query)?.take(resultsSearchNbr)?.forEach { it ->
|
||||
val type = it.type
|
||||
val mediaPoster = it.url_image
|
||||
val href = fixUrl(it.url)
|
||||
val bestTitleMatching = it.titleObtainedBysortByQuery(query)
|
||||
val title = version + bestTitleMatching
|
||||
|
||||
))
|
||||
else -> {
|
||||
when (type) {
|
||||
"m0v1e", "special" -> (
|
||||
listofResults.add(newMovieSearchResponse( // réponse du film qui sera ajoutée à la liste apmap qui sera ensuite return
|
||||
title,
|
||||
href,
|
||||
TvType.AnimeMovie,
|
||||
false
|
||||
) {
|
||||
this.posterUrl = mediaPoster
|
||||
}
|
||||
))
|
||||
null, "tv", "ova", "" -> (
|
||||
listofResults.add(newAnimeSearchResponse(
|
||||
title,
|
||||
href,
|
||||
TvType.Anime,
|
||||
false
|
||||
) {
|
||||
this.posterUrl = mediaPoster
|
||||
}
|
||||
|
||||
throw ErrorLoadingException("invalid media type") // le type n'est pas reconnu ==> affiche une erreur
|
||||
}
|
||||
))
|
||||
else -> {
|
||||
|
||||
throw ErrorLoadingException("invalid media type") // le type n'est pas reconnu ==> affiche une erreur
|
||||
}
|
||||
} ?: throw ErrorLoadingException("ParsedData failed")
|
||||
}
|
||||
return ListResults.sortByname(query)
|
||||
.take(resultsSearchNbr) // Do that to short the vf and vostfr anime together
|
||||
}
|
||||
} ?: throw ErrorLoadingException("ParsedData failed")
|
||||
}
|
||||
return ListResults
|
||||
return listofResults.sortByname(query)
|
||||
.take(resultsSearchNbr) // Do that to short the vf and vostfr anime together
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -208,11 +187,11 @@ class NekosamaProvider : MainAPI() {
|
|||
var title = "" //document.select("div.offset-md-4 >:not(small)").text()
|
||||
var dataUrl = ""
|
||||
/////////////////////////////////////
|
||||
results.forEach { InfoEpisode ->
|
||||
val episodeScript = InfoEpisode.groupValues[1]
|
||||
results.forEach { infoEpisode ->
|
||||
val episodeScript = infoEpisode.groupValues[1]
|
||||
val srcScriptEpisode =
|
||||
Regex("""episode\"\:\"Ep\. ([0-9]*)\"""")
|
||||
val EpisodeNum = srcScriptEpisode.find(episodeScript)?.groupValues?.get(1)?.toInt()
|
||||
val episodeNum = srcScriptEpisode.find(episodeScript)?.groupValues?.get(1)?.toInt()
|
||||
val srcScriptTitle = Regex("""title\"\:\"([^\"]*)\"\,\"url\"\:\"\\\/anime""")
|
||||
var titleE = srcScriptTitle.find(episodeScript)?.groupValues?.get(1)
|
||||
if (titleE != null) title = titleE
|
||||
|
@ -233,7 +212,7 @@ class NekosamaProvider : MainAPI() {
|
|||
episodes.add(
|
||||
Episode(
|
||||
link_video,
|
||||
episode = EpisodeNum,
|
||||
episode = episodeNum,
|
||||
name = title,
|
||||
posterUrl = link_poster
|
||||
|
||||
|
@ -292,11 +271,11 @@ class NekosamaProvider : MainAPI() {
|
|||
|
||||
val results = srcAllvideolinks.findAll(script.toString())
|
||||
|
||||
results.forEach { InfoEpisode ->
|
||||
results.forEach { infoEpisode ->
|
||||
|
||||
var playerUrl = InfoEpisode.groupValues[1]
|
||||
var playerUrl = infoEpisode.groupValues[1]
|
||||
|
||||
if (playerUrl != "")
|
||||
if (!playerUrl.isNullOrBlank())
|
||||
loadExtractor(
|
||||
httpsify(playerUrl),
|
||||
playerUrl,
|
||||
|
@ -324,10 +303,9 @@ class NekosamaProvider : MainAPI() {
|
|||
val poster = select("div.cover > a > div.ma-lazy-wrapper")
|
||||
var posterUrl = poster.select("img:last-child").attr("src")
|
||||
if (posterUrl == "#") posterUrl = poster.select("img:last-child").attr("data-src")
|
||||
//val subdub = select("div.quality").text()
|
||||
val type = select("div.info > p.year").text()
|
||||
val title = select("div.info > a.title > div.limit").text()
|
||||
val link = mainUrl + select("div.cover > a").attr("href")
|
||||
val link = fixUrl(select("div.cover > a").attr("href"))
|
||||
if (type.contains("Film")) {
|
||||
return newMovieSearchResponse(
|
||||
title,
|
||||
|
@ -367,7 +345,7 @@ class NekosamaProvider : MainAPI() {
|
|||
val movies = document.select("div#regular-list-animes > div.anime")
|
||||
|
||||
val home =
|
||||
movies.apmap { article -> // avec mapnotnull si un élément est null, il sera automatiquement enlevé de la liste
|
||||
movies.mapNotNull { article -> // avec mapnotnull si un élément est null, il sera automatiquement enlevé de la liste
|
||||
article.toSearchResponse()
|
||||
}
|
||||
return newHomePageResponse(request.name, home)
|
||||
|
|
|
@ -9,9 +9,6 @@ import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
|||
import org.jsoup.nodes.Element
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class VostfreeProvider : MainAPI() {
|
||||
// VostFreeProvider() est ajouté à la liste allProviders dans MainAPI.kt
|
||||
override var mainUrl = "https://vostfree.cx"
|
||||
|
@ -31,24 +28,25 @@ class VostfreeProvider : MainAPI() {
|
|||
**/
|
||||
override suspend fun search(query: String): List<SearchResponse> {
|
||||
val link =
|
||||
"$mainUrl/index.php?do=search&subaction=search&story=$query&submit=Submit+Query" // L'url pour chercher un anime de dragon sera donc: 'https://vostfree.cx/index.php?story=dragon&do=search&subaction=search'
|
||||
fixUrl("/index.php?do=search&subaction=search&story=$query&submit=Submit+Query") // L'url pour chercher un anime de dragon sera donc: 'https://vostfree.cx/index.php?story=dragon&do=search&subaction=search'
|
||||
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)
|
||||
return document.select("div.search-result") // on séléctione tous les éléments 'enfant' du type articles
|
||||
.apmap { div -> // apmap crée une liste des éléments (ici newMovieSearchResponse et newAnimeSearchResponse)
|
||||
.mapNotNull { div -> // map crée une liste des éléments (ici newMovieSearchResponse et newAnimeSearchResponse)
|
||||
val type =
|
||||
div?.selectFirst("div.genre")
|
||||
?.text() // replace enlève tous les '\t' et '\n' du titre
|
||||
val mediaPoster = mainUrl + div?.selectFirst("span.image > img")
|
||||
?.attr("src") // récupère le texte de l'attribut src de l'élément
|
||||
val mediaPoster =
|
||||
div?.selectFirst("span.image > img")?.attr("src")
|
||||
?.let { fixUrl(it) } // récupère le texte de l'attribut src de l'élément
|
||||
val href = div?.selectFirst("div.info > div.title > a")?.attr("href")
|
||||
?: throw ErrorLoadingException("invalid link") // renvoie une erreur si il n'y a pas de lien vers le média
|
||||
val title = div.selectFirst("> div.info > div.title > a")?.text().toString()
|
||||
if (type == "OAV") mediaType = TvType.OVA
|
||||
when (type) {
|
||||
"FILM" -> (
|
||||
newMovieSearchResponse( // réponse du film qui sera ajoutée à la liste apmap qui sera ensuite return
|
||||
newMovieSearchResponse( // réponse du film qui sera ajoutée à la liste map qui sera ensuite return
|
||||
title,
|
||||
href,
|
||||
TvType.AnimeMovie,
|
||||
|
@ -99,23 +97,24 @@ class VostfreeProvider : MainAPI() {
|
|||
val description = meta?.select("div.slide-middle > div.slide-desc")?.first()
|
||||
?.text() // first() selectione le premier élément de la liste
|
||||
var title = meta?.select("div.slide-middle > h1")?.text()
|
||||
?: throw ErrorLoadingException("Invalid title")
|
||||
?: "Invalid title"
|
||||
title = title.replace("Saison", "").replace("saison", "").replace("SAISON", "")
|
||||
.replace("Season", "").replace("season", "").replace("SEASON", "")
|
||||
val poster = mainUrl + meta?.select(" div.slide-poster > img")
|
||||
?.attr("src") // récupere le texte de l'attribut 'data-src'
|
||||
val poster = fixUrl(
|
||||
meta?.select(" div.slide-poster > img")
|
||||
?.attr("src")!!
|
||||
)// récupere le texte de l'attribut 'data-src'
|
||||
|
||||
urlSaison.add(url)
|
||||
|
||||
|
||||
var seasonNumber: Int?
|
||||
seasonNumber = null
|
||||
var seasonNumber: Int? = null
|
||||
val otherSaisonFound = document.select("div.new_player_series_count > a")
|
||||
otherSaisonFound.apmap {
|
||||
otherSaisonFound.forEach {
|
||||
urlSaison.add(it.attr("href"))
|
||||
}
|
||||
|
||||
urlSaison.forEach {
|
||||
urlSaison.apmap {it ->
|
||||
val urlseason = it
|
||||
val document =
|
||||
app.get(urlseason).document // récupere le texte sur la page (requète http)
|
||||
|
@ -127,7 +126,7 @@ class VostfreeProvider : MainAPI() {
|
|||
val seasontext = meta?.select("ul.slide-top > li:last-child > b:last-child")?.text()
|
||||
var indication: String? = null
|
||||
|
||||
if (seasontext != null && !seasontext.contains("""([a-zA-Z])""".toRegex())) {
|
||||
if (!seasontext.isNullOrBlank() && !seasontext.contains("""([a-zA-Z])""".toRegex())) {
|
||||
seasonNumber = seasontext.toInt()
|
||||
|
||||
if (seasonNumber!! < 1) { // seem a an OVA has 0 as season number
|
||||
|
@ -136,7 +135,7 @@ class VostfreeProvider : MainAPI() {
|
|||
}
|
||||
}
|
||||
|
||||
document.select(" select.new_player_selector > option").apmap {
|
||||
document.select(" select.new_player_selector > option").forEach {
|
||||
val typeOftheAnime = it.text()
|
||||
|
||||
if (typeOftheAnime != "Film") {
|
||||
|
@ -199,23 +198,16 @@ class VostfreeProvider : MainAPI() {
|
|||
subtitleCallback: (SubtitleFile) -> Unit,
|
||||
callback: (ExtractorLink) -> Unit,
|
||||
): Boolean {
|
||||
val parsedInfo =
|
||||
tryParseJson<EpisodeData>(data)//?:throw ErrorLoadingException("Invalid url")
|
||||
val url = if (parsedInfo?.url != null) {
|
||||
parsedInfo.url
|
||||
} else {
|
||||
data
|
||||
}
|
||||
val parsedInfo = tryParseJson<EpisodeData>(data)
|
||||
val url = parsedInfo?.url ?: data
|
||||
|
||||
val noMovie = "1"
|
||||
val numeroEpisode = if (parsedInfo?.episodeNumber != null) {
|
||||
parsedInfo.episodeNumber
|
||||
} else {
|
||||
noMovie
|
||||
} // if is not a movie then take the episode number else for movie it is 1
|
||||
val numeroEpisode = parsedInfo?.episodeNumber
|
||||
?: noMovie // if is not a movie then take the episode number else for movie it is 1
|
||||
|
||||
val document = app.get(url).document
|
||||
document.select("div.new_player_bottom")
|
||||
.apmap { player_bottom -> // séléctione tous les players
|
||||
.forEach { player_bottom -> // séléctione tous les players
|
||||
|
||||
// supprimer les zéro de 0015 pour obtenir l'episode 15
|
||||
var index = numeroEpisode.indexOf('0')
|
||||
|
@ -237,33 +229,33 @@ class VostfreeProvider : MainAPI() {
|
|||
document.selectFirst("div#content_$player")?.text()
|
||||
.toString() // result : "325544" ou "https:..."
|
||||
var playerUrl = when (playerName) {
|
||||
"VIP", "Upvid", "Dstream", "Streamsb", "Vudeo", "NinjaS" -> codePlayload // case https
|
||||
"VIP", "Upvid", "Dstream", "Streamsb", "Vudeo", "NinjaS", "Upstream" -> codePlayload // case https
|
||||
"Uqload" -> "https://uqload.com/embed-$codePlayload.html"
|
||||
"Mytv" -> "https://www.myvi.tv/embed/$codePlayload"
|
||||
"Sibnet" -> "https://video.sibnet.ru/shell.php?videoid=$codePlayload"
|
||||
"Stream" -> "https://myvi.ru/player/embed/html/$codePlayload"
|
||||
else -> ""
|
||||
else -> return@apmap
|
||||
}
|
||||
|
||||
if (playerUrl != "")
|
||||
loadExtractor(
|
||||
httpsify(playerUrl),
|
||||
playerUrl,
|
||||
subtitleCallback
|
||||
) { link -> // charge un extracteur d'extraire le lien direct .mp4
|
||||
callback.invoke(
|
||||
ExtractorLink( // ici je modifie le callback pour ajouter des informations, normalement ce n'est pas nécessaire
|
||||
link.source,
|
||||
link.name + "",
|
||||
link.url,
|
||||
link.referer,
|
||||
getQualityFromName("HD"),
|
||||
link.isM3u8,
|
||||
link.headers,
|
||||
link.extractorData
|
||||
)
|
||||
|
||||
loadExtractor(
|
||||
httpsify(playerUrl),
|
||||
playerUrl,
|
||||
subtitleCallback
|
||||
) { link -> // charge un extracteur d'extraire le lien direct .mp4
|
||||
callback.invoke(
|
||||
ExtractorLink( // ici je modifie le callback pour ajouter des informations, normalement ce n'est pas nécessaire
|
||||
link.source,
|
||||
link.name + "",
|
||||
link.url,
|
||||
link.referer,
|
||||
getQualityFromName("HD"),
|
||||
link.isM3u8,
|
||||
link.headers,
|
||||
link.extractorData
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
// }
|
||||
|
||||
}
|
||||
|
@ -274,7 +266,7 @@ class VostfreeProvider : MainAPI() {
|
|||
|
||||
private fun Element.toSearchResponse(): SearchResponse {
|
||||
val poster = select("span.image")
|
||||
val posterUrl = mainUrl + poster.select("> img").attr("src")
|
||||
val posterUrl = fixUrl(poster.select("> img").attr("src"))
|
||||
val subdub = select("div.quality").text()
|
||||
val genre = select("div.genre").text()
|
||||
val title = select("div.info > div.title").text()
|
||||
|
@ -316,7 +308,7 @@ class VostfreeProvider : MainAPI() {
|
|||
val movies = document.select("div#content > div#dle-content > div.movie-poster")
|
||||
|
||||
val home =
|
||||
movies.apmap { article -> // avec mapnotnull si un élément est null, il sera automatiquement enlevé de la liste
|
||||
movies.mapNotNull { article -> // avec mapnotnull si un élément est null, il sera automatiquement enlevé de la liste
|
||||
article.toSearchResponse()
|
||||
}
|
||||
return newHomePageResponse(request.name, home)
|
||||
|
|
|
@ -30,16 +30,15 @@ class WiflixProvider : MainAPI() {
|
|||
override suspend fun search(query: String): List<SearchResponse> {
|
||||
val link =
|
||||
"$mainUrl/index.php?do=search&subaction=search&story=$query&submit=Submit+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.clearfix")
|
||||
|
||||
val Allresultshome =
|
||||
results.apmap { article -> // avec mapnotnull si un élément est null, il sera automatiquement enlevé de la liste
|
||||
val allresultshome =
|
||||
results.mapNotNull { article -> // avec mapnotnull si un élément est null, il sera automatiquement enlevé de la liste
|
||||
article.toSearchResponse()
|
||||
}
|
||||
return Allresultshome
|
||||
return allresultshome
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,7 +50,7 @@ class WiflixProvider : MainAPI() {
|
|||
@JsonProperty("episodeNumber") val episodeNumber: String,
|
||||
)
|
||||
|
||||
private fun Elements.takeEpisode(url: String, DuborSub: String?): ArrayList<Episode> {
|
||||
private fun Elements.takeEpisode(url: String, duborSub: String?): ArrayList<Episode> {
|
||||
|
||||
val episodes = ArrayList<Episode>()
|
||||
this.select("ul.eplist > li").forEach {
|
||||
|
@ -68,7 +67,7 @@ class WiflixProvider : MainAPI() {
|
|||
episodes.add(
|
||||
Episode(
|
||||
link,
|
||||
name = DuborSub,
|
||||
name = duborSub,
|
||||
episode = strEpisodeN.toInt(),
|
||||
)
|
||||
)
|
||||
|
@ -94,20 +93,19 @@ class WiflixProvider : MainAPI() {
|
|||
document.select("img#posterimg").attr("src")
|
||||
val yearRegex = Regex("""ate de sortie\: (\d*)""")
|
||||
val year = yearRegex.find(document.text())?.groupValues?.get(1)
|
||||
val DuborSub: String?
|
||||
|
||||
|
||||
val tags = document.select("[itemprop=genre] > a")
|
||||
.apmap { it.text() } // séléctione tous les tags et les ajoutes à une liste
|
||||
.map { it.text() } // séléctione tous les tags et les ajoutes à une liste
|
||||
|
||||
if (episodeFrfound.text().contains("Episode")) {
|
||||
mediaType = TvType.TvSeries
|
||||
DuborSub = "Episode en VF"
|
||||
episodes = episodeFrfound.takeEpisode(url, DuborSub)
|
||||
val duborSub = "Episode en VF"
|
||||
episodes = episodeFrfound.takeEpisode(url, duborSub)
|
||||
} else if (episodeVostfrfound.text().contains("Episode")) {
|
||||
mediaType = TvType.TvSeries
|
||||
DuborSub = "Episode sous-titré"
|
||||
episodes = episodeVostfrfound.takeEpisode(url, DuborSub)
|
||||
val duborSub = "Episode sous-titré"
|
||||
episodes = episodeVostfrfound.takeEpisode(url, duborSub)
|
||||
} else {
|
||||
|
||||
mediaType = TvType.Movie
|
||||
|
@ -161,7 +159,7 @@ class WiflixProvider : MainAPI() {
|
|||
this.posterUrl = fixUrl(posterUrl)
|
||||
this.plot = description
|
||||
this.recommendations = recommendations
|
||||
this.year = year?.toInt()
|
||||
this.year = year?.toIntOrNull()
|
||||
this.comingSoon = comingSoon
|
||||
this.tags = tags
|
||||
}
|
||||
|
@ -176,7 +174,7 @@ class WiflixProvider : MainAPI() {
|
|||
this.posterUrl = fixUrl(posterUrl)
|
||||
this.plot = description
|
||||
this.recommendations = recommendations
|
||||
this.year = year?.toInt()
|
||||
this.year = year?.toIntOrNull()
|
||||
this.comingSoon = comingSoon
|
||||
this.tags = tags
|
||||
|
||||
|
@ -194,18 +192,9 @@ class WiflixProvider : MainAPI() {
|
|||
): Boolean {
|
||||
val parsedInfo =
|
||||
tryParseJson<EpisodeData>(data)
|
||||
val url = if (parsedInfo?.url != null) {
|
||||
parsedInfo.url
|
||||
} else {
|
||||
data
|
||||
}
|
||||
val numeroEpisode = if (parsedInfo?.episodeNumber != null) {
|
||||
parsedInfo.episodeNumber
|
||||
} else {
|
||||
null
|
||||
}
|
||||
val url = parsedInfo?.url ?: data
|
||||
|
||||
var cssCodeForPlayer = ""
|
||||
val numeroEpisode = parsedInfo?.episodeNumber ?: null
|
||||
|
||||
val document = app.get(url).document
|
||||
val episodeFrfound =
|
||||
|
@ -213,18 +202,18 @@ class WiflixProvider : MainAPI() {
|
|||
val episodeVostfrfound =
|
||||
document.select("div.blocvostfr")
|
||||
|
||||
if (episodeFrfound.text().contains("Episode")) {
|
||||
cssCodeForPlayer = "div.ep$numeroEpisode" + "vf > a"
|
||||
val cssCodeForPlayer = if (episodeFrfound.text().contains("Episode")) {
|
||||
"div.ep$numeroEpisode" + "vf > a"
|
||||
} else if (episodeVostfrfound.text().contains("Episode")) {
|
||||
cssCodeForPlayer = "div.ep$numeroEpisode" + "vs > a"
|
||||
"div.ep$numeroEpisode" + "vs > a"
|
||||
} else {
|
||||
cssCodeForPlayer = "div.linkstab > a"
|
||||
"div.linkstab > a"
|
||||
}
|
||||
|
||||
|
||||
document.select("$cssCodeForPlayer").apmap { player -> // séléctione tous les players
|
||||
var playerUrl = "https" + player.attr("href").replace("(.*)https".toRegex(), "")
|
||||
if (playerUrl != "" || playerUrl != null)
|
||||
var playerUrl = "https"+player.attr("href").replace("(.*)https".toRegex(), "")
|
||||
if (!playerUrl.isNullOrBlank())
|
||||
if (playerUrl.contains("dood")) {
|
||||
playerUrl = playerUrl.replace("doodstream.com", "dood.wf")
|
||||
}
|
||||
|
@ -255,21 +244,17 @@ class WiflixProvider : MainAPI() {
|
|||
private fun Element.toSearchResponse(): SearchResponse {
|
||||
|
||||
val posterUrl = fixUrl(select("div.img-box > img").attr("src"))
|
||||
val subOrdub = select("div.nbloc1-2 >span").text()
|
||||
val qualityExtracted = select("div.nbloc1-2 >span").text()
|
||||
val type = select("div.nbloc3").text()
|
||||
val title = select("a.nowrap").text()
|
||||
val link = select("a.nowrap").attr("href")
|
||||
var quality = getQualityFromString("")
|
||||
if (subOrdub.contains("HDLight")) {
|
||||
quality = getQualityFromString("HD")
|
||||
} else if (subOrdub.contains("Bdrip")) {
|
||||
quality = getQualityFromString("BlueRay")
|
||||
} else if (subOrdub.contains("DVDSCR")) {
|
||||
quality = getQualityFromString("DVD")
|
||||
} else if (subOrdub.contains("CAM")) {
|
||||
quality = getQualityFromString("Cam")
|
||||
} else {
|
||||
quality = null
|
||||
var quality = when (!qualityExtracted.isNullOrBlank()) {
|
||||
qualityExtracted.contains("HDLight") -> getQualityFromString("HD")
|
||||
qualityExtracted.contains("Bdrip") -> getQualityFromString("BlueRay")
|
||||
qualityExtracted.contains("DVD") -> getQualityFromString("DVD")
|
||||
qualityExtracted.contains("CAM") -> getQualityFromString("Cam")
|
||||
|
||||
else -> null
|
||||
}
|
||||
if (type.contains("Film")) {
|
||||
return MovieSearchResponse(
|
||||
|
@ -313,7 +298,7 @@ class WiflixProvider : MainAPI() {
|
|||
val movies = document.select("div#dle-content > div.clearfix")
|
||||
|
||||
val home =
|
||||
movies.apmap { article -> // avec mapnotnull si un élément est null, il sera automatiquement enlevé de la liste
|
||||
movies.mapNotNull { article -> // avec mapnotnull si un élément est null, il sera automatiquement enlevé de la liste
|
||||
article.toSearchResponse()
|
||||
}
|
||||
return newHomePageResponse(request.name, home)
|
||||
|
|
Loading…
Reference in New Issue