From 640cc4c5750066177bd9c3e38d69c8ec1511fda2 Mon Sep 17 00:00:00 2001 From: Eddy Date: Sun, 4 Sep 2022 17:30:14 +0200 Subject: [PATCH] autoformat the code and add the changes requested --- .../kotlin/com/lagradost/MytvExtractor.kt | 14 +- .../kotlin/com/lagradost/SibnetExtractor.kt | 10 +- .../kotlin/com/lagradost/VostfreeProvider.kt | 461 ++++++++++-------- .../kotlin/com/lagradost/VudeoExtractor.kt | 9 +- 4 files changed, 268 insertions(+), 226 deletions(-) diff --git a/VostfreeProvider/src/main/kotlin/com/lagradost/MytvExtractor.kt b/VostfreeProvider/src/main/kotlin/com/lagradost/MytvExtractor.kt index d60efcf..66c5d21 100644 --- a/VostfreeProvider/src/main/kotlin/com/lagradost/MytvExtractor.kt +++ b/VostfreeProvider/src/main/kotlin/com/lagradost/MytvExtractor.kt @@ -7,25 +7,27 @@ import org.jsoup.Jsoup open class MytvExtractor : ExtractorApi() { override val name: String = "Mytv" override val mainUrl: String = "https://www.myvi.tv/" - private val srcRegex = Regex("""PlayerLoader\.CreatePlayer\(\"v\=(.*)\\u0026tp""") // would be possible to use the parse and find src attribute + private val srcRegex = + Regex("""PlayerLoader\.CreatePlayer\(\"v\=(.*)\\u0026tp""") // would be possible to use the parse and find src attribute override val requiresReferer = false override suspend fun getUrl(url: String, referer: String?): List? { val cleaned_url = url - val html =app.get(cleaned_url) + val html = app.get(cleaned_url) with(html) { // raised error ERROR_CODE_PARSING_CONTAINER_UNSUPPORTED (3003) is due to the response: "error_nofile" srcRegex.find(this.text)?.groupValues?.get(1)?.let { link -> var lien = link - lien= lien.replace("%2f","/").replace("%3a",":").replace("%3f","?").replace("%3d","=").replace("%26","&") + lien = lien.replace("%2f", "/").replace("%3a", ":").replace("%3f", "?") + .replace("%3d", "=").replace("%26", "&") //val html = app.get(url).text - //val document = Jsoup.parse(html) - //val link1 = document.select("script") + //val document = Jsoup.parse(html) + //val link1 = document.select("script") return listOf( ExtractorLink( name, - name , + name, lien, cleaned_url, // voir si site demande le referer à mettre ici Qualities.Unknown.value, diff --git a/VostfreeProvider/src/main/kotlin/com/lagradost/SibnetExtractor.kt b/VostfreeProvider/src/main/kotlin/com/lagradost/SibnetExtractor.kt index 98a1778..46bdccb 100644 --- a/VostfreeProvider/src/main/kotlin/com/lagradost/SibnetExtractor.kt +++ b/VostfreeProvider/src/main/kotlin/com/lagradost/SibnetExtractor.kt @@ -1,3 +1,4 @@ + package com.lagradost import com.lagradost.cloudstream3.utils.* import com.lagradost.cloudstream3.app @@ -7,20 +8,21 @@ import org.jsoup.Jsoup open class SibnetExtractor : ExtractorApi() { override val name: String = "Sibnet" override val mainUrl: String = "https://video.sibnet.ru" - private val srcRegex = Regex("""player\.src\(\[\{src: \"(.*?)\"""") // would be possible to use the parse and find src attribute + private val srcRegex = + Regex("""player\.src\(\[\{src: \"(.*?)\"""") // would be possible to use the parse and find src attribute override val requiresReferer = true override suspend fun getUrl(url: String, referer: String?): List? { val cleaned_url = url - val html =app.get(cleaned_url) + val html = app.get(cleaned_url) with(html) { // raised error ERROR_CODE_PARSING_CONTAINER_UNSUPPORTED (3003) is due to the response: "error_nofile" srcRegex.find(this.text)?.groupValues?.get(1)?.let { link -> return listOf( ExtractorLink( name, - name , - mainUrl+link, + name, + mainUrl + link, cleaned_url, // voir si site demande le referer à mettre ici Qualities.Unknown.value, ) diff --git a/VostfreeProvider/src/main/kotlin/com/lagradost/VostfreeProvider.kt b/VostfreeProvider/src/main/kotlin/com/lagradost/VostfreeProvider.kt index b485430..7358cdd 100644 --- a/VostfreeProvider/src/main/kotlin/com/lagradost/VostfreeProvider.kt +++ b/VostfreeProvider/src/main/kotlin/com/lagradost/VostfreeProvider.kt @@ -1,5 +1,7 @@ package com.lagradost +package com.lagradost.cloudstream3.animeproviders + import com.fasterxml.jackson.annotation.JsonProperty import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.utils.* @@ -14,8 +16,10 @@ class VostfreeProvider : MainAPI() { override val hasQuickSearch = false // recherche rapide (optionel, pas vraimet utile) override val hasMainPage = true // page d'accueil (optionel mais encoragé) override var lang = "fr" // fournisseur est en francais + //override val supportedTypes = setOf(TvType.Movie) // ici on ne supporte que les films - override val supportedTypes = setOf( TvType.Anime,TvType.AnimeMovie,TvType.OVA) // animes, animesfilms et series + override val supportedTypes = + setOf(TvType.Anime, TvType.AnimeMovie, TvType.OVA) // animes, animesfilms et series // liste des types: https://recloudstream.github.io/dokka/app/com.lagradost.cloudstream3/-tv-type/index.html /** @@ -23,54 +27,58 @@ class VostfreeProvider : MainAPI() { La recherche retourne une SearchResponse, qui peut être des classes suivants: AnimeSearchResponse, MovieSearchResponse, TorrentSearchResponse, TvSeriesSearchResponse 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 { //val link = "$mainUrl/?s=$query" val link = "$mainUrl/index.php?story=$query&do=search&subaction=search" // L'url pour chercher un anime de dragon sera donc: 'https://vostfree.cx/index.php?story=dragon&do=search&subaction=search' // le $ dans une string permet d'insérer une variable - val document = app.get(link).document // app.get() permet de télécharger la page html avec une requete HTTP (get) - // on convertit le html en un document + val document = + app.get(link).document // app.get() permet de télécharger la page html avec une requete HTTP (get) + // on convertit le html en un document 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) - //val posterContainer = div.selectFirst("> span.image ") // selectione le premier élément correspondant à ces critères - val type = div?.selectFirst("div.genre")?.text()?.replace("\t", "")?.replace("\n", "") + //val posterContainer = div.selectFirst("> span.image ") // selectione le premier élément correspondant à ces critères + val type = + div?.selectFirst("div.genre")?.text()?.replace("\t", "")?.replace("\n", "") // 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 = mainUrl + div?.selectFirst("span.image > img") + ?.attr("src") // 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() + 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() - when (type) { - "FILM" -> ( - newMovieSearchResponse( // réponse du film qui sera ajoutée à la liste apmap qui sera ensuite return - title, - href, - TvType.AnimeMovie, - false - ) { - this.posterUrl = mediaPoster - // this.rating = rating - } - ) - null -> ( - newAnimeSearchResponse( - title, - href, - TvType.Anime, - false - ) { - this.posterUrl = mediaPoster - // this.rating = rating - } + when (type) { + "FILM" -> ( + newMovieSearchResponse( // réponse du film qui sera ajoutée à la liste apmap qui sera ensuite return + title, + href, + TvType.AnimeMovie, + false + ) { + this.posterUrl = mediaPoster + // this.rating = rating + } + ) + null -> ( + newAnimeSearchResponse( + title, + href, + TvType.Anime, + false + ) { + this.posterUrl = mediaPoster + // this.rating = rating + } - ) - else -> { - 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 + } } } - } } private data class EmbedUrlClass( @@ -85,113 +93,138 @@ class VostfreeProvider : MainAPI() { @JsonProperty("url") val url: String, @JsonProperty("episodeNumber") val episodeNumber: String, ) + override suspend fun load(url: String): LoadResponse { val document = app.get(url).document // récupere le texte sur la page (requète http) // url est le lien retourné par la fonction search (la variable href) ou la fonction getMainPage - var mediaType=TvType.Anime + var mediaType = TvType.Anime val episodes = ArrayList() - val meta = document.selectFirst("div#dle-content > div.watch-top > div.image-bg > div.image-bg-content > div.slide-block ") - var poster : String? = "" + val meta = + document.selectFirst("div#dle-content > div.watch-top > div.image-bg > div.image-bg-content > div.slide-block ") + var poster: String? = "" var title = "" - var description : String? = ""// first() selectione le premier élément de la liste + var description: String? = ""// first() selectione le premier élément de la liste ///////////////////////////////////////////////// val isSaison = document.select("div.new_player_series_count > a") var saison00 = -1 var i = 0 - var noSeason =true + var noSeason = true var enterInIseason = false isSaison.forEach { - var url1=it.attr("href") - while(noSeason){ - it.select("[alt=Saison 0$i]").forEach{ // enter in the block when it match the season - noSeason=false - } - it.select("[alt=Saison $i]").forEach{ // enter in the block when it match the season - noSeason=false - } + var url1 = it.attr("href") + while (noSeason) { + it.select("[alt=Saison 0$i]") + .forEach { // enter in the block when it match the season + noSeason = false + } + it.select("[alt=Saison $i]") + .forEach { // enter in the block when it match the season + noSeason = false + } i++ } - i=i-1 + i = i - 1 saison00 = i i = 0 // reinit i et noSeason for the next page - noSeason =true + noSeason = true var document1 = app.get(url1).document // récupere le texte sur la page (requète http) // url est le lien retourné par la fonction search (la variable href) ou la fonction getMainPage - var meta1 = document1.selectFirst("div#dle-content > div.watch-top > div.image-bg > div.image-bg-content > div.slide-block ") - poster = mainUrl + meta1?.select(" div.slide-poster > img")?.attr("src") // récupere le texte de l'attribut 'data-src' - title = meta1?.select("div.slide-middle > h1")?.text() ?: throw ErrorLoadingException("Invalid title") - title =title.replace("Saison","").replace("saison","").replace("SAISON","") - title =title.replace("Season","").replace("season","").replace("SEASON","") - description= meta1.select("div.slide-middle > div.slide-desc").first()?.text() // first() selectione le premier élément de la liste + var meta1 = + document1.selectFirst("div#dle-content > div.watch-top > div.image-bg > div.image-bg-content > div.slide-block ") + poster = mainUrl + meta1?.select(" div.slide-poster > img") + ?.attr("src") // récupere le texte de l'attribut 'data-src' + title = meta1?.select("div.slide-middle > h1")?.text() + ?: throw ErrorLoadingException("Invalid title") + title = title.replace("Saison", "").replace("saison", "").replace("SAISON", "") + .replace("Season", "").replace("season", "").replace("SEASON", "") + description = meta1.select("div.slide-middle > div.slide-desc").first() + ?.text() // first() selectione le premier élément de la liste - val listEpisode =document.select(" select.new_player_selector > option").forEach { + val listEpisode = document.select(" select.new_player_selector > option").forEach { - if( it.text()!="Film"){ + if (it.text() != "Film") { val link = EpisodeData( url1, - it.text().replace("Episode ",""), + it.text().replace("Episode ", ""), ).toJson() - episodes.add( Episode( - link, - episode = it.text().replace("Episode ","").toInt(), - season=saison00, - name = "Saison ${saison00.toString()}" + it.text(), - //description= description, - posterUrl = poster - ) ) - }else{ + episodes.add( + Episode( + link, + episode = it.text().replace("Episode ", "").toInt(), + season = saison00, + name = "Saison ${saison00.toString()}" + it.text(), + //description= description, + posterUrl = poster + ) + ) + } else { - mediaType=TvType.AnimeMovie + mediaType = TvType.AnimeMovie } } enterInIseason = true } - poster = mainUrl + meta?.select(" div.slide-poster > img")?.attr("src") // récupere le texte de l'attribut 'data-src' - title = meta?.select("div.slide-middle > h1")?.text() ?: throw ErrorLoadingException("Invalid title") + poster = mainUrl + meta?.select(" div.slide-poster > img") + ?.attr("src") // récupere le texte de l'attribut 'data-src' + title = meta?.select("div.slide-middle > h1")?.text() + ?: throw ErrorLoadingException("Invalid title") - description = meta.select("div.slide-middle > div.slide-desc").first()?.text() // first() selectione le premier élément de la liste + description = meta.select("div.slide-middle > div.slide-desc").first() + ?.text() // first() selectione le premier élément de la liste //var saison0 = document.select("div.new_player_series_count > a")?.text()?.replace("Saison 0","")?.replace("Saison ","")?.toInt() - var season : Int? - if(enterInIseason){val seasontext = meta.select("ul.slide-top > li:last-child > b:last-child").text() - title =title.replace("Saison","").replace("saison","").replace("SAISON","") - title =title.replace("Season","").replace("season","").replace("SEASON","") + var season: Int? + if (enterInIseason) { + val seasontext = meta.select("ul.slide-top > li:last-child > b:last-child").text() + title = title.replace("Saison", "").replace("saison", "").replace("SAISON", "") + .replace("Season", "").replace("season", "").replace("SEASON", "") var index = seasontext?.indexOf('0') var no = seasontext - while (index == 0) {no = seasontext?.drop(1).toString() - index = no?.indexOf('0')} + while (index == 0) { + no = seasontext?.drop(1).toString() + index = no?.indexOf('0') + } season = no.toInt() - }else{ - season = null} - val listEpisode =document.select(" select.new_player_selector > option").forEach { + } else { + season = null + } + val listEpisode = document.select(" select.new_player_selector > option").forEach { - if( it.text()!="Film"){ + if (it.text() != "Film") { val link = EpisodeData( url, - it.text().replace("Episode ",""), + it.text().replace("Episode ", ""), ).toJson() - episodes.add( Episode( - link, - episode = it.text().replace("Episode ","").toInt(), - season=season, - name = "Saison ${season.toString()}" + it.text(), - //description= description, - posterUrl = poster + episodes.add( + Episode( + link, + episode = it.text().replace("Episode ", "").toInt(), + season = season, + name = "Saison ${season.toString()}" + it.text(), + //description= description, + posterUrl = poster - ) )}else{ + ) + ) + } else { - mediaType=TvType.AnimeMovie + mediaType = TvType.AnimeMovie } } if (mediaType == TvType.AnimeMovie) { - return newMovieLoadResponse(title, url, mediaType,url) { // retourne les informations du film + return newMovieLoadResponse( + title, + url, + mediaType, + url + ) { // retourne les informations du film this.posterUrl = poster this.plot = description } @@ -204,7 +237,10 @@ class VostfreeProvider : MainAPI() { ) { this.posterUrl = poster this.plot = description - addEpisodes(if(title.contains("VF")) DubStatus.Dubbed else DubStatus.Subbed, episodes) + addEpisodes( + if (title.contains("VF")) DubStatus.Dubbed else DubStatus.Subbed, + episodes + ) } } @@ -218,69 +254,78 @@ class VostfreeProvider : MainAPI() { subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit, ): Boolean { - val parsedInfo = tryParseJson(data)//?:throw ErrorLoadingException("Invalid url") - val url = if(parsedInfo?.url !=null){parsedInfo.url}else{data} - val noEpisode = if(parsedInfo?.episodeNumber !=null){parsedInfo.episodeNumber}else{"1"} // if is not a movie then take the episode number else 1 + val parsedInfo = + tryParseJson(data)//?:throw ErrorLoadingException("Invalid url") + val url = if (parsedInfo?.url != null) { + parsedInfo.url + } else { + data + } + val noEpisode = if (parsedInfo?.episodeNumber != null) { + parsedInfo.episodeNumber + } else { + "1" + } // if is not a movie then take the episode number else 1 val document = app.get(url).document - document.select("div.new_player_bottom").apmap { player_bottom -> // séléctione tous les players + document.select("div.new_player_bottom") + .apmap { player_bottom -> // séléctione tous les players - // supprimer les zéro de 0015 pour obtenir l'episode 15 - var index = noEpisode?.indexOf('0') - var no = noEpisode - while (index == 0) {no = noEpisode?.drop(1).toString() - index = no?.indexOf('0')} + // supprimer les zéro de 0015 pour obtenir l'episode 15 + var index = noEpisode?.indexOf('0') + var no = noEpisode + while (index == 0) { + no = noEpisode?.drop(1).toString() + index = no?.indexOf('0') + } - var cssQuery = " div#buttons_$no" // no numéro épisode - val buttonsNepisode = player_bottom?.select(cssQuery)?:throw ErrorLoadingException("Non player") //séléctione tous les players pour l'episode NoEpisode - buttonsNepisode.select("> div").forEach { - val player = it.attr("id")?.toString()?: throw ErrorLoadingException("Player No found") //prend tous les players resultat : "player_2140" et "player_6521" - val playerName = it.select("div#$player").text() // prend le nom du player ex : "Uqload" et "Sibnet" - //for(i in playerName.indices){ + var cssQuery = " div#buttons_$no" // no numéro épisode + val buttonsNepisode = player_bottom?.select(cssQuery) + ?: throw ErrorLoadingException("Non player") //séléctione tous les players pour l'episode NoEpisode + buttonsNepisode.select("> div").forEach { + val player = it.attr("id")?.toString() + ?: throw ErrorLoadingException("Player No found") //prend tous les players resultat : "player_2140" et "player_6521" + val playerName = it.select("div#$player") + .text() // prend le nom du player ex : "Uqload" et "Sibnet" + //for(i in playerName.indices){ var codePlayload = - document.selectFirst("div#content_$player")?.text().toString() // resultat : "325544" ou "https:..." peut être lorsque playerName = VIP ou Upvid DStream - var playerUrl ="" - when (playerName) { - "VIP" -> playerUrl = codePlayload - "Upvid" -> playerUrl = codePlayload // extractor à faire - "Uqload" -> // film_iframe - playerUrl = "https://uqload.com/embed-$codePlayload.html" // OK - "Dstream" -> playerUrl = codePlayload - "Streamsb" -> playerUrl = codePlayload // OK - "Vudeo" -> playerUrl = codePlayload // OK - "Mytv" -> // film_iframe - playerUrl = "https://www.myvi.tv/embed/$codePlayload" //OK - "Sibnet" -> // film_iframe - playerUrl = "https://video.sibnet.ru/shell.php?videoid=$codePlayload" // OK - - "NinjaS" -> // film_iframe - playerUrl = codePlayload - "Stream" -> // == myTv extractor + security - playerUrl = "https://myvi.ru/player/embed/html/$codePlayload" //OK - + document.selectFirst("div#content_$player")?.text() + .toString() // resultat : "325544" ou "https:..." peut être lorsque playerName = VIP ou Upvid DStream + var playerUrl = "" + playerUrl = when (playerName) { + "VIP", "Upvid", "Dstream", "Streamsb", "Vudeo", "NinjaS" -> codePlayload + "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 -> "" + } + 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 + ) + ) + } + // } } - 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 - )) - } - // } - } - } - return true } @@ -288,97 +333,87 @@ class VostfreeProvider : MainAPI() { override suspend fun getMainPage( page: Int, - request : MainPageRequest + request: MainPageRequest ): HomePageResponse { val list = ArrayList() - val animeDubStatus = ArrayList(15) + val animeDubStatus = ArrayList(1) animeDubStatus.add("/animes-vf/") animeDubStatus.add("/animes-vostfr/") animeDubStatus.add("/films-vf-vostfr/") - animeDubStatus.add("/genre/Action/") - animeDubStatus.add("/genre/Aventure/") - animeDubStatus.add("/genre/Comédie/") - animeDubStatus.add("/genre/Tranche+de+vie/") - animeDubStatus.add("/genre/Drame/") - animeDubStatus.add("/genre/Fantasy/") - animeDubStatus.add("/genre/Surnaturel/") - animeDubStatus.add("/genre/Mystère/") - animeDubStatus.add("/genre/Shonen/") - animeDubStatus.add("/genre/Psychologique/") - animeDubStatus.add("/genre/Romance/") - animeDubStatus.add("/genre/Sci-Fi/") + animeDubStatus.forEach { val documentZero = app.get("$mainUrl$it").document - val numberOFpage=documentZero.select("div.navigation > div.pages > a").text() - var lastpage = if(numberOFpage !="")numberOFpage.substringAfterLast(" ").toString().toInt() else 1 + val numberOFpage = documentZero.select("div.navigation > div.pages > a").text() + var lastpage = if (numberOFpage != "") numberOFpage.substringAfterLast(" ").toString() + .toInt() else 1 val openPageMax = 2 // prendre uniquement les n pages - lastpage =if(lastpage>openPageMax){openPageMax}else{ lastpage} - var categoryTitle ="" - for(i in 1 .. lastpage) { + lastpage = if (lastpage > openPageMax) { + openPageMax + } else { + lastpage + } + var categoryTitle = "" + for (i in 1..lastpage) { var page = "/page/$i" val document = app.get("$mainUrl$it$page").document val movies = document.select("div#content > div#dle-content > div.movie-poster") + categoryTitle = + document.select("div#left-movies-block > ul#left-movies-tabs > li").text() + .replace("Animes VF", " Animes EN FRANÇAIS (page $i)") + .replace("Animes VOSTFR", " Animes VOSTFR (page $i)") + .replace("Films VF et VOSTFR", "FILMS EN FRANÇAIS OU EN VOSTFR (page $i)") + .replace("Liste", "").replace("La liste des", "") + val returnList = movies.mapNotNull { article -> + // map est la même chose que apmap (mais apmap est plus rapide) + // ici si un élément est null, il sera automatiquement enlevé de la liste + val poster = article.select("span.image") + val posterUrl = mainUrl + poster.select("> img").attr("src") + val subdub = article.select("div.quality").text() - if (it.contains("genre", true)) { - categoryTitle = it.replace("/genre/", "").replace("/", " (page $i)").replace("+", " ") - categoryTitle = "Catégorie : $categoryTitle" - } else { - categoryTitle = - document.select("div#left-movies-block > ul#left-movies-tabs > li").text().replace("Animes VF", " Animes EN FRANÇAIS (page $i)").replace("Animes VOSTFR", " Animes VOSTFR (page $i)") - .replace("Films VF et VOSTFR", "FILMS EN FRANÇAIS OU EN VOSTFR (page $i)").replace("Liste","").replace("La liste des","") - } + val genre = article.select("div.genre").text() + val title = article.select("div.info > div.title").text() + val link = article.select("div.play > a").attr("href") + if (genre == "FILM") { + newMovieSearchResponse( + title, + link, + TvType.AnimeMovie, + false, + ) { + this.posterUrl = posterUrl + //this.quality = quality + } - - val returnList = movies.mapNotNull { article -> - // map est la même chose que apmap (mais apmap est plus rapide) - // ici si un élément est null, il sera automatiquement enlevé de la liste - val poster = article.select("span.image") - val posterUrl = mainUrl + poster.select("> img").attr("src") - val subdub =article.select("div.quality").text() - - val genre= article.select("div.genre").text() - - val title = article.select("div.info > div.title").text() - val link = article.select("div.play > a").attr("href") - if (genre == "FILM") { - newMovieSearchResponse( - title, - link, - TvType.AnimeMovie, - false, - ) { - this.posterUrl = posterUrl - //this.quality = quality - } - - } else // a tv serie - { - newAnimeSearchResponse( - title, - link, - TvType.Anime, - false, - ) { - this.posterUrl = posterUrl - if (subdub=="VF") DubStatus.Dubbed else DubStatus.Subbed - //this.quality = quality - } } - - } - if (returnList.isEmpty()) throw ErrorLoadingException() - list.add(HomePageList(categoryTitle, returnList)) + } else // a tv serie + { + newAnimeSearchResponse( + title, + link, + TvType.Anime, + false, + ) { + this.posterUrl = posterUrl + if (subdub == "VF") DubStatus.Dubbed else DubStatus.Subbed + //this.quality = quality + } + } } + if (returnList.isEmpty()) throw ErrorLoadingException() + list.add(HomePageList(categoryTitle, returnList)) + + } } if (list.isEmpty()) throw ErrorLoadingException() return HomePageResponse( - list) + list + ) } diff --git a/VostfreeProvider/src/main/kotlin/com/lagradost/VudeoExtractor.kt b/VostfreeProvider/src/main/kotlin/com/lagradost/VudeoExtractor.kt index ceeaab1..a0d4e54 100644 --- a/VostfreeProvider/src/main/kotlin/com/lagradost/VudeoExtractor.kt +++ b/VostfreeProvider/src/main/kotlin/com/lagradost/VudeoExtractor.kt @@ -1,13 +1,14 @@ + package com.lagradost import com.lagradost.cloudstream3.utils.* import com.lagradost.cloudstream3.app - open class VudeoExtractor : ExtractorApi() { override val name: String = "Vudeo" override val mainUrl: String = "https://vudeo.io/" - private val srcRegex = Regex("""sources\: \[\"(.*)\"""") // would be possible to use the parse and find src attribute + private val srcRegex = + Regex("""sources\: \[\"(.*)\"""") // would be possible to use the parse and find src attribute override val requiresReferer = false @@ -18,7 +19,7 @@ open class VudeoExtractor : ExtractorApi() { return listOf( ExtractorLink( name, - name , + name, link, cleaned_url, // voir si site demande le referer à mettre ici Qualities.Unknown.value, @@ -29,3 +30,5 @@ open class VudeoExtractor : ExtractorApi() { return null } } + +