mirror of
https://github.com/recloudstream/cloudstream-extensions-multilingual.git
synced 2024-08-15 03:15:14 +00:00
autoformat the code and add the changes requested
This commit is contained in:
parent
313017749c
commit
640cc4c575
4 changed files with 268 additions and 226 deletions
|
@ -7,25 +7,27 @@ import org.jsoup.Jsoup
|
||||||
open class MytvExtractor : ExtractorApi() {
|
open class MytvExtractor : ExtractorApi() {
|
||||||
override val name: String = "Mytv"
|
override val name: String = "Mytv"
|
||||||
override val mainUrl: String = "https://www.myvi.tv/"
|
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 val requiresReferer = false
|
||||||
|
|
||||||
|
|
||||||
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
|
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
|
||||||
val cleaned_url = url
|
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"
|
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 ->
|
srcRegex.find(this.text)?.groupValues?.get(1)?.let { link ->
|
||||||
var lien = 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 html = app.get(url).text
|
||||||
//val document = Jsoup.parse(html)
|
//val document = Jsoup.parse(html)
|
||||||
//val link1 = document.select("script")
|
//val link1 = document.select("script")
|
||||||
return listOf(
|
return listOf(
|
||||||
ExtractorLink(
|
ExtractorLink(
|
||||||
name,
|
name,
|
||||||
name ,
|
name,
|
||||||
lien,
|
lien,
|
||||||
cleaned_url, // voir si site demande le referer à mettre ici
|
cleaned_url, // voir si site demande le referer à mettre ici
|
||||||
Qualities.Unknown.value,
|
Qualities.Unknown.value,
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
package com.lagradost
|
package com.lagradost
|
||||||
import com.lagradost.cloudstream3.utils.*
|
import com.lagradost.cloudstream3.utils.*
|
||||||
import com.lagradost.cloudstream3.app
|
import com.lagradost.cloudstream3.app
|
||||||
|
@ -7,20 +8,21 @@ import org.jsoup.Jsoup
|
||||||
open class SibnetExtractor : ExtractorApi() {
|
open class SibnetExtractor : ExtractorApi() {
|
||||||
override val name: String = "Sibnet"
|
override val name: String = "Sibnet"
|
||||||
override val mainUrl: String = "https://video.sibnet.ru"
|
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 val requiresReferer = true
|
||||||
|
|
||||||
|
|
||||||
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
|
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
|
||||||
val cleaned_url = url
|
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"
|
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 ->
|
srcRegex.find(this.text)?.groupValues?.get(1)?.let { link ->
|
||||||
return listOf(
|
return listOf(
|
||||||
ExtractorLink(
|
ExtractorLink(
|
||||||
name,
|
name,
|
||||||
name ,
|
name,
|
||||||
mainUrl+link,
|
mainUrl + link,
|
||||||
cleaned_url, // voir si site demande le referer à mettre ici
|
cleaned_url, // voir si site demande le referer à mettre ici
|
||||||
Qualities.Unknown.value,
|
Qualities.Unknown.value,
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.lagradost
|
package com.lagradost
|
||||||
|
|
||||||
|
package com.lagradost.cloudstream3.animeproviders
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.lagradost.cloudstream3.*
|
import com.lagradost.cloudstream3.*
|
||||||
import com.lagradost.cloudstream3.utils.*
|
import com.lagradost.cloudstream3.utils.*
|
||||||
|
@ -14,8 +16,10 @@ class VostfreeProvider : MainAPI() {
|
||||||
override val hasQuickSearch = false // recherche rapide (optionel, pas vraimet utile)
|
override val hasQuickSearch = false // recherche rapide (optionel, pas vraimet utile)
|
||||||
override val hasMainPage = true // page d'accueil (optionel mais encoragé)
|
override val hasMainPage = true // page d'accueil (optionel mais encoragé)
|
||||||
override var lang = "fr" // fournisseur est en francais
|
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.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
|
// 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
|
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
|
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 link = "$mainUrl/?s=$query"
|
//val link = "$mainUrl/?s=$query"
|
||||||
val link = "$mainUrl/index.php?story=$query&do=search&subaction=search"
|
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'
|
// 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
|
// 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)
|
val document =
|
||||||
// on convertit le html en un 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
|
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)
|
.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 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 type =
|
||||||
|
div?.selectFirst("div.genre")?.text()?.replace("\t", "")?.replace("\n", "")
|
||||||
// replace enlève tous les '\t' et '\n' du titre
|
// 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 href = div?.selectFirst("div.info > div.title > a")?.attr("href")
|
||||||
val title = div.selectFirst("> div.info > div.title > a")?.text().toString()
|
?: 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) {
|
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 apmap qui sera ensuite return
|
||||||
title,
|
title,
|
||||||
href,
|
href,
|
||||||
TvType.AnimeMovie,
|
TvType.AnimeMovie,
|
||||||
false
|
false
|
||||||
) {
|
) {
|
||||||
this.posterUrl = mediaPoster
|
this.posterUrl = mediaPoster
|
||||||
// this.rating = rating
|
// this.rating = rating
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
null -> (
|
null -> (
|
||||||
newAnimeSearchResponse(
|
newAnimeSearchResponse(
|
||||||
title,
|
title,
|
||||||
href,
|
href,
|
||||||
TvType.Anime,
|
TvType.Anime,
|
||||||
false
|
false
|
||||||
) {
|
) {
|
||||||
this.posterUrl = mediaPoster
|
this.posterUrl = mediaPoster
|
||||||
// this.rating = rating
|
// this.rating = rating
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
)
|
)
|
||||||
else -> {
|
else -> {
|
||||||
throw ErrorLoadingException("invalid media type") // le type n'est pas reconnu ==> affiche une erreur
|
throw ErrorLoadingException("invalid media type") // le type n'est pas reconnu ==> affiche une erreur
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private data class EmbedUrlClass(
|
private data class EmbedUrlClass(
|
||||||
|
@ -85,113 +93,138 @@ class VostfreeProvider : MainAPI() {
|
||||||
@JsonProperty("url") val url: String,
|
@JsonProperty("url") val url: String,
|
||||||
@JsonProperty("episodeNumber") val episodeNumber: String,
|
@JsonProperty("episodeNumber") val episodeNumber: String,
|
||||||
)
|
)
|
||||||
|
|
||||||
override suspend fun load(url: String): LoadResponse {
|
override suspend fun load(url: String): LoadResponse {
|
||||||
val document = app.get(url).document // récupere le texte sur la page (requète http)
|
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
|
// 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<Episode>()
|
val episodes = ArrayList<Episode>()
|
||||||
|
|
||||||
val meta = document.selectFirst("div#dle-content > div.watch-top > div.image-bg > div.image-bg-content > div.slide-block ")
|
val meta =
|
||||||
var poster : String? = ""
|
document.selectFirst("div#dle-content > div.watch-top > div.image-bg > div.image-bg-content > div.slide-block ")
|
||||||
|
var poster: String? = ""
|
||||||
var title = ""
|
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")
|
val isSaison = document.select("div.new_player_series_count > a")
|
||||||
var saison00 = -1
|
var saison00 = -1
|
||||||
var i = 0
|
var i = 0
|
||||||
var noSeason =true
|
var noSeason = true
|
||||||
var enterInIseason = false
|
var enterInIseason = false
|
||||||
isSaison.forEach {
|
isSaison.forEach {
|
||||||
var url1=it.attr("href")
|
var url1 = it.attr("href")
|
||||||
while(noSeason){
|
while (noSeason) {
|
||||||
it.select("[alt=Saison 0$i]").forEach{ // enter in the block when it match the season
|
it.select("[alt=Saison 0$i]")
|
||||||
noSeason=false
|
.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
|
it.select("[alt=Saison $i]")
|
||||||
}
|
.forEach { // enter in the block when it match the season
|
||||||
|
noSeason = false
|
||||||
|
}
|
||||||
i++
|
i++
|
||||||
}
|
}
|
||||||
i=i-1
|
i = i - 1
|
||||||
saison00 = i
|
saison00 = i
|
||||||
i = 0 // reinit i et noSeason for the next page
|
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)
|
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
|
// 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 ")
|
var meta1 =
|
||||||
poster = mainUrl + meta1?.select(" div.slide-poster > img")?.attr("src") // récupere le texte de l'attribut 'data-src'
|
document1.selectFirst("div#dle-content > div.watch-top > div.image-bg > div.image-bg-content > div.slide-block ")
|
||||||
title = meta1?.select("div.slide-middle > h1")?.text() ?: throw ErrorLoadingException("Invalid title")
|
poster = mainUrl + meta1?.select(" div.slide-poster > img")
|
||||||
title =title.replace("Saison","").replace("saison","").replace("SAISON","")
|
?.attr("src") // récupere le texte de l'attribut 'data-src'
|
||||||
title =title.replace("Season","").replace("season","").replace("SEASON","")
|
title = meta1?.select("div.slide-middle > h1")?.text()
|
||||||
description= meta1.select("div.slide-middle > div.slide-desc").first()?.text() // first() selectione le premier élément de la liste
|
?: 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 =
|
val link =
|
||||||
EpisodeData(
|
EpisodeData(
|
||||||
url1,
|
url1,
|
||||||
it.text().replace("Episode ",""),
|
it.text().replace("Episode ", ""),
|
||||||
).toJson()
|
).toJson()
|
||||||
episodes.add( Episode(
|
episodes.add(
|
||||||
link,
|
Episode(
|
||||||
episode = it.text().replace("Episode ","").toInt(),
|
link,
|
||||||
season=saison00,
|
episode = it.text().replace("Episode ", "").toInt(),
|
||||||
name = "Saison ${saison00.toString()}" + it.text(),
|
season = saison00,
|
||||||
//description= description,
|
name = "Saison ${saison00.toString()}" + it.text(),
|
||||||
posterUrl = poster
|
//description= description,
|
||||||
) )
|
posterUrl = poster
|
||||||
}else{
|
)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
|
||||||
mediaType=TvType.AnimeMovie
|
mediaType = TvType.AnimeMovie
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
enterInIseason = true
|
enterInIseason = true
|
||||||
}
|
}
|
||||||
poster = mainUrl + meta?.select(" div.slide-poster > img")?.attr("src") // récupere le texte de l'attribut 'data-src'
|
poster = mainUrl + meta?.select(" div.slide-poster > img")
|
||||||
title = meta?.select("div.slide-middle > h1")?.text() ?: throw ErrorLoadingException("Invalid title")
|
?.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 saison0 = document.select("div.new_player_series_count > a")?.text()?.replace("Saison 0","")?.replace("Saison ","")?.toInt()
|
||||||
var season : Int?
|
var season: Int?
|
||||||
if(enterInIseason){val seasontext = meta.select("ul.slide-top > li:last-child > b:last-child").text()
|
if (enterInIseason) {
|
||||||
title =title.replace("Saison","").replace("saison","").replace("SAISON","")
|
val seasontext = meta.select("ul.slide-top > li:last-child > b:last-child").text()
|
||||||
title =title.replace("Season","").replace("season","").replace("SEASON","")
|
title = title.replace("Saison", "").replace("saison", "").replace("SAISON", "")
|
||||||
|
.replace("Season", "").replace("season", "").replace("SEASON", "")
|
||||||
var index = seasontext?.indexOf('0')
|
var index = seasontext?.indexOf('0')
|
||||||
var no = seasontext
|
var no = seasontext
|
||||||
while (index == 0) {no = seasontext?.drop(1).toString()
|
while (index == 0) {
|
||||||
index = no?.indexOf('0')}
|
no = seasontext?.drop(1).toString()
|
||||||
|
index = no?.indexOf('0')
|
||||||
|
}
|
||||||
season = no.toInt()
|
season = no.toInt()
|
||||||
}else{
|
} else {
|
||||||
season = null}
|
season = null
|
||||||
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 =
|
val link =
|
||||||
EpisodeData(
|
EpisodeData(
|
||||||
url,
|
url,
|
||||||
it.text().replace("Episode ",""),
|
it.text().replace("Episode ", ""),
|
||||||
).toJson()
|
).toJson()
|
||||||
episodes.add( Episode(
|
episodes.add(
|
||||||
link,
|
Episode(
|
||||||
episode = it.text().replace("Episode ","").toInt(),
|
link,
|
||||||
season=season,
|
episode = it.text().replace("Episode ", "").toInt(),
|
||||||
name = "Saison ${season.toString()}" + it.text(),
|
season = season,
|
||||||
//description= description,
|
name = "Saison ${season.toString()}" + it.text(),
|
||||||
posterUrl = poster
|
//description= description,
|
||||||
|
posterUrl = poster
|
||||||
|
|
||||||
) )}else{
|
)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
|
||||||
mediaType=TvType.AnimeMovie
|
mediaType = TvType.AnimeMovie
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (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.posterUrl = poster
|
||||||
this.plot = description
|
this.plot = description
|
||||||
}
|
}
|
||||||
|
@ -204,7 +237,10 @@ class VostfreeProvider : MainAPI() {
|
||||||
) {
|
) {
|
||||||
this.posterUrl = poster
|
this.posterUrl = poster
|
||||||
this.plot = description
|
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,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit,
|
callback: (ExtractorLink) -> Unit,
|
||||||
): Boolean {
|
): Boolean {
|
||||||
val parsedInfo = tryParseJson<EpisodeData>(data)//?:throw ErrorLoadingException("Invalid url")
|
val parsedInfo =
|
||||||
val url = if(parsedInfo?.url !=null){parsedInfo.url}else{data}
|
tryParseJson<EpisodeData>(data)//?:throw ErrorLoadingException("Invalid url")
|
||||||
val noEpisode = if(parsedInfo?.episodeNumber !=null){parsedInfo.episodeNumber}else{"1"} // if is not a movie then take the episode number else 1
|
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
|
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
|
// supprimer les zéro de 0015 pour obtenir l'episode 15
|
||||||
var index = noEpisode?.indexOf('0')
|
var index = noEpisode?.indexOf('0')
|
||||||
var no = noEpisode
|
var no = noEpisode
|
||||||
while (index == 0) {no = noEpisode?.drop(1).toString()
|
while (index == 0) {
|
||||||
index = no?.indexOf('0')}
|
no = noEpisode?.drop(1).toString()
|
||||||
|
index = no?.indexOf('0')
|
||||||
|
}
|
||||||
|
|
||||||
var cssQuery = " div#buttons_$no" // no numéro épisode
|
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
|
val buttonsNepisode = player_bottom?.select(cssQuery)
|
||||||
buttonsNepisode.select("> div").forEach {
|
?: throw ErrorLoadingException("Non player") //séléctione tous les players pour l'episode NoEpisode
|
||||||
val player = it.attr("id")?.toString()?: throw ErrorLoadingException("Player No found") //prend tous les players resultat : "player_2140" et "player_6521"
|
buttonsNepisode.select("> div").forEach {
|
||||||
val playerName = it.select("div#$player").text() // prend le nom du player ex : "Uqload" et "Sibnet"
|
val player = it.attr("id")?.toString()
|
||||||
//for(i in playerName.indices){
|
?: 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 =
|
var codePlayload =
|
||||||
document.selectFirst("div#content_$player")?.text().toString() // resultat : "325544" ou "https:..." peut être lorsque playerName = VIP ou Upvid DStream
|
document.selectFirst("div#content_$player")?.text()
|
||||||
var playerUrl =""
|
.toString() // resultat : "325544" ou "https:..." peut être lorsque playerName = VIP ou Upvid DStream
|
||||||
when (playerName) {
|
var playerUrl = ""
|
||||||
"VIP" -> playerUrl = codePlayload
|
playerUrl = when (playerName) {
|
||||||
"Upvid" -> playerUrl = codePlayload // extractor à faire
|
"VIP", "Upvid", "Dstream", "Streamsb", "Vudeo", "NinjaS" -> codePlayload
|
||||||
"Uqload" -> // film_iframe
|
"Uqload" -> "https://uqload.com/embed-$codePlayload.html"
|
||||||
playerUrl = "https://uqload.com/embed-$codePlayload.html" // OK
|
"Mytv" -> "https://www.myvi.tv/embed/$codePlayload"
|
||||||
"Dstream" -> playerUrl = codePlayload
|
"Sibnet" -> "https://video.sibnet.ru/shell.php?videoid=$codePlayload"
|
||||||
"Streamsb" -> playerUrl = codePlayload // OK
|
"Stream" -> "https://myvi.ru/player/embed/html/$codePlayload"
|
||||||
"Vudeo" -> playerUrl = codePlayload // OK
|
else -> ""
|
||||||
"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
|
|
||||||
|
|
||||||
|
|
||||||
|
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
|
return true
|
||||||
}
|
}
|
||||||
|
@ -288,97 +333,87 @@ class VostfreeProvider : MainAPI() {
|
||||||
|
|
||||||
override suspend fun getMainPage(
|
override suspend fun getMainPage(
|
||||||
page: Int,
|
page: Int,
|
||||||
request : MainPageRequest
|
request: MainPageRequest
|
||||||
): HomePageResponse {
|
): HomePageResponse {
|
||||||
val list = ArrayList<HomePageList>()
|
val list = ArrayList<HomePageList>()
|
||||||
val animeDubStatus = ArrayList<String>(15)
|
val animeDubStatus = ArrayList<String>(1)
|
||||||
|
|
||||||
animeDubStatus.add("/animes-vf/")
|
animeDubStatus.add("/animes-vf/")
|
||||||
animeDubStatus.add("/animes-vostfr/")
|
animeDubStatus.add("/animes-vostfr/")
|
||||||
animeDubStatus.add("/films-vf-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 {
|
animeDubStatus.forEach {
|
||||||
val documentZero = app.get("$mainUrl$it").document
|
val documentZero = app.get("$mainUrl$it").document
|
||||||
val numberOFpage=documentZero.select("div.navigation > div.pages > a").text()
|
val numberOFpage = documentZero.select("div.navigation > div.pages > a").text()
|
||||||
var lastpage = if(numberOFpage !="")numberOFpage.substringAfterLast(" ").toString().toInt() else 1
|
var lastpage = if (numberOFpage != "") numberOFpage.substringAfterLast(" ").toString()
|
||||||
|
.toInt() else 1
|
||||||
val openPageMax = 2 // prendre uniquement les n pages
|
val openPageMax = 2 // prendre uniquement les n pages
|
||||||
lastpage =if(lastpage>openPageMax){openPageMax}else{ lastpage}
|
lastpage = if (lastpage > openPageMax) {
|
||||||
var categoryTitle =""
|
openPageMax
|
||||||
for(i in 1 .. lastpage) {
|
} else {
|
||||||
|
lastpage
|
||||||
|
}
|
||||||
|
var categoryTitle = ""
|
||||||
|
for (i in 1..lastpage) {
|
||||||
var page = "/page/$i"
|
var page = "/page/$i"
|
||||||
val document = app.get("$mainUrl$it$page").document
|
val document = app.get("$mainUrl$it$page").document
|
||||||
|
|
||||||
val movies = document.select("div#content > div#dle-content > div.movie-poster")
|
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)) {
|
val genre = article.select("div.genre").text()
|
||||||
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 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
|
||||||
val returnList = movies.mapNotNull { article ->
|
{
|
||||||
// map est la même chose que apmap (mais apmap est plus rapide)
|
newAnimeSearchResponse(
|
||||||
// ici si un élément est null, il sera automatiquement enlevé de la liste
|
title,
|
||||||
val poster = article.select("span.image")
|
link,
|
||||||
val posterUrl = mainUrl + poster.select("> img").attr("src")
|
TvType.Anime,
|
||||||
val subdub =article.select("div.quality").text()
|
false,
|
||||||
|
) {
|
||||||
val genre= article.select("div.genre").text()
|
this.posterUrl = posterUrl
|
||||||
|
if (subdub == "VF") DubStatus.Dubbed else DubStatus.Subbed
|
||||||
val title = article.select("div.info > div.title").text()
|
//this.quality = quality
|
||||||
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))
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (returnList.isEmpty()) throw ErrorLoadingException()
|
||||||
|
list.add(HomePageList(categoryTitle, returnList))
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (list.isEmpty()) throw ErrorLoadingException()
|
if (list.isEmpty()) throw ErrorLoadingException()
|
||||||
return HomePageResponse(
|
return HomePageResponse(
|
||||||
list)
|
list
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
|
|
||||||
package com.lagradost
|
package com.lagradost
|
||||||
import com.lagradost.cloudstream3.utils.*
|
import com.lagradost.cloudstream3.utils.*
|
||||||
import com.lagradost.cloudstream3.app
|
import com.lagradost.cloudstream3.app
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
open class VudeoExtractor : ExtractorApi() {
|
open class VudeoExtractor : ExtractorApi() {
|
||||||
override val name: String = "Vudeo"
|
override val name: String = "Vudeo"
|
||||||
override val mainUrl: String = "https://vudeo.io/"
|
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
|
override val requiresReferer = false
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,7 +19,7 @@ open class VudeoExtractor : ExtractorApi() {
|
||||||
return listOf(
|
return listOf(
|
||||||
ExtractorLink(
|
ExtractorLink(
|
||||||
name,
|
name,
|
||||||
name ,
|
name,
|
||||||
link,
|
link,
|
||||||
cleaned_url, // voir si site demande le referer à mettre ici
|
cleaned_url, // voir si site demande le referer à mettre ici
|
||||||
Qualities.Unknown.value,
|
Qualities.Unknown.value,
|
||||||
|
@ -29,3 +30,5 @@ open class VudeoExtractor : ExtractorApi() {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue