2021-10-02 07:28:22 +00:00
|
|
|
package com.lagradost.cloudstream3.movieproviders
|
|
|
|
|
|
|
|
import com.lagradost.cloudstream3.*
|
|
|
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
|
|
|
import com.lagradost.cloudstream3.utils.Qualities
|
|
|
|
import org.jsoup.Jsoup
|
|
|
|
|
|
|
|
// referer = https://vf-film.org, USERAGENT ALSO REQUIRED
|
2021-10-02 17:53:20 +00:00
|
|
|
class VfFilmProvider : MainAPI() {
|
2022-03-16 15:29:11 +00:00
|
|
|
override var mainUrl = "https://vf-film.me"
|
|
|
|
override var name = "vf-film.me"
|
2021-12-08 23:39:30 +00:00
|
|
|
override val lang = "fr"
|
|
|
|
override val hasQuickSearch = false
|
|
|
|
override val hasMainPage = false
|
|
|
|
override val hasChromecastSupport = false
|
2021-10-02 07:28:22 +00:00
|
|
|
|
2021-12-08 23:39:30 +00:00
|
|
|
override val supportedTypes = setOf(TvType.Movie)
|
2021-10-02 07:28:22 +00:00
|
|
|
|
2022-01-16 22:31:42 +00:00
|
|
|
override suspend fun search(query: String): List<SearchResponse> {
|
2021-10-02 07:28:22 +00:00
|
|
|
val url = "$mainUrl/?s=$query"
|
2021-12-05 16:22:30 +00:00
|
|
|
val response = app.get(url).text
|
2021-10-02 07:28:22 +00:00
|
|
|
val document = Jsoup.parse(response)
|
|
|
|
val items = document.select("ul.MovieList > li > article > a")
|
|
|
|
if (items.isNullOrEmpty()) return ArrayList()
|
|
|
|
|
|
|
|
val returnValue = ArrayList<SearchResponse>()
|
|
|
|
for (item in items) {
|
|
|
|
val href = item.attr("href")
|
|
|
|
|
2021-12-05 16:22:30 +00:00
|
|
|
val poster = item.selectFirst("> div.Image > figure > img").attr("src")
|
|
|
|
.replace("//image", "https://image")
|
2021-10-02 07:28:22 +00:00
|
|
|
|
|
|
|
val name = item.selectFirst("> h3.Title").text()
|
|
|
|
|
|
|
|
val year = item.selectFirst("> span.Year").text()?.toIntOrNull()
|
|
|
|
|
|
|
|
returnValue.add(MovieSearchResponse(name, href, this.name, TvType.Movie, poster, year))
|
|
|
|
}
|
|
|
|
return returnValue
|
|
|
|
}
|
|
|
|
|
2022-01-16 22:31:42 +00:00
|
|
|
override suspend fun loadLinks(
|
2021-10-02 07:28:22 +00:00
|
|
|
data: String,
|
|
|
|
isCasting: Boolean,
|
|
|
|
subtitleCallback: (SubtitleFile) -> Unit,
|
|
|
|
callback: (ExtractorLink) -> Unit
|
|
|
|
): Boolean {
|
2022-01-30 22:02:57 +00:00
|
|
|
if (data.length <= 4) return false
|
2021-10-02 07:28:22 +00:00
|
|
|
callback.invoke(
|
|
|
|
ExtractorLink(
|
|
|
|
this.name,
|
|
|
|
this.name,
|
|
|
|
data,
|
|
|
|
"",
|
|
|
|
Qualities.P720.value,
|
|
|
|
false
|
|
|
|
)
|
|
|
|
)
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2022-01-29 21:25:12 +00:00
|
|
|
private suspend fun getDirect(original: String): String { // original data, https://vf-film.org/?trembed=1&trid=55313&trtype=1 for example
|
2021-12-05 16:22:30 +00:00
|
|
|
val response = app.get(original).text
|
|
|
|
val url = "iframe .*src=\"(.*?)\"".toRegex().find(response)?.groupValues?.get(1)
|
|
|
|
.toString() // https://vudeo.net/embed-uweno86lzx8f.html for example
|
|
|
|
val vudoResponse = app.get(url).text
|
2021-10-02 07:28:22 +00:00
|
|
|
val document = Jsoup.parse(vudoResponse)
|
2021-12-05 16:22:30 +00:00
|
|
|
val vudoUrl = Regex("sources: \\[\"(.*?)\"]").find(document.html())?.groupValues?.get(1)
|
|
|
|
.toString() // direct mp4 link, https://m11.vudeo.net/2vp3ukyw2avjdohilpebtzuct42q5jwvpmpsez3xjs6d7fbs65dpuey2rbra/v.mp4 for exemple
|
2021-11-07 22:53:49 +00:00
|
|
|
return vudoUrl
|
2021-10-02 07:28:22 +00:00
|
|
|
}
|
|
|
|
|
2022-01-16 22:31:42 +00:00
|
|
|
override suspend fun load(url: String): LoadResponse {
|
2021-12-05 16:22:30 +00:00
|
|
|
val response = app.get(url).text
|
2021-10-02 07:28:22 +00:00
|
|
|
val document = Jsoup.parse(response)
|
|
|
|
val title = document?.selectFirst("div.SubTitle")?.text()
|
|
|
|
?: throw ErrorLoadingException("Service might be unavailable")
|
2021-12-05 16:22:30 +00:00
|
|
|
|
2021-10-02 07:28:22 +00:00
|
|
|
val year = document.select("span.Date").text()?.toIntOrNull()
|
|
|
|
|
|
|
|
val rating = document.select("span.AAIco-star").text()
|
|
|
|
|
|
|
|
val duration = document.select("span.Time").text()?.toIntOrNull()
|
|
|
|
|
2021-12-05 16:22:30 +00:00
|
|
|
val poster = document.selectFirst("div.Image > figure > img").attr("src")
|
|
|
|
.replace("//image", "https://image")
|
2021-10-02 07:28:22 +00:00
|
|
|
|
|
|
|
val descript = document.selectFirst("div.Description > p").text()
|
|
|
|
|
|
|
|
val players = document.select("ul.TPlayerNv > li")
|
2021-11-07 22:53:49 +00:00
|
|
|
var number_player = 0
|
2021-10-02 07:28:22 +00:00
|
|
|
var found = false
|
|
|
|
for (player in players) {
|
|
|
|
if (player.selectFirst("> span").text() == "Vudeo") {
|
|
|
|
found = true
|
|
|
|
break
|
|
|
|
} else {
|
2021-11-07 22:53:49 +00:00
|
|
|
number_player += 1
|
2021-10-02 07:28:22 +00:00
|
|
|
}
|
|
|
|
}
|
2022-01-30 22:02:57 +00:00
|
|
|
if (!found) {
|
2021-11-07 22:53:49 +00:00
|
|
|
number_player = 0
|
2021-10-02 07:28:22 +00:00
|
|
|
}
|
2021-11-07 22:53:49 +00:00
|
|
|
val i = number_player.toString()
|
2021-10-02 07:28:22 +00:00
|
|
|
val trid = Regex("iframe .*trid=(.*?)&").find(document.html())?.groupValues?.get(1)
|
|
|
|
|
2021-11-07 22:53:49 +00:00
|
|
|
val data = getDirect("$mainUrl/?trembed=$i&trid=$trid&trtype=1")
|
2021-10-02 07:28:22 +00:00
|
|
|
|
2022-04-03 21:41:28 +00:00
|
|
|
return newMovieLoadResponse(
|
2021-10-02 07:28:22 +00:00
|
|
|
title,
|
|
|
|
url,
|
|
|
|
TvType.Movie,
|
2022-04-03 21:41:28 +00:00
|
|
|
data
|
|
|
|
) {
|
|
|
|
this.posterUrl = poster
|
|
|
|
this.year = year
|
|
|
|
this.plot = descript
|
|
|
|
//this.rating = rating
|
|
|
|
this.duration = duration
|
|
|
|
}
|
2021-10-02 07:28:22 +00:00
|
|
|
}
|
|
|
|
}
|