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