Voe first request
parent
9c5cc6ccc6
commit
88bbcfee27
|
@ -10,7 +10,7 @@ import android.util.Log
|
|||
import androidx.appcompat.app.AppCompatActivity
|
||||
|
||||
@CloudstreamPlugin
|
||||
class TestPlugin: Plugin() {
|
||||
class SflixPlugin: Plugin() {
|
||||
var activity: AppCompatActivity? = null
|
||||
|
||||
override fun load(context: Context) {
|
||||
|
@ -20,7 +20,9 @@ class TestPlugin: Plugin() {
|
|||
registerExtractorAPI(MixDropCo())
|
||||
|
||||
// Force this extractor to be first in the list
|
||||
// Use this when you rewrite/upgrade an existing extractor
|
||||
addExtractor(Upstream())
|
||||
addExtractor(Voe2())
|
||||
|
||||
registerMainAPI(ExampleProvider(this))
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import com.fasterxml.jackson.annotation.JsonProperty
|
|||
import org.jsoup.Jsoup
|
||||
import org.jsoup.nodes.Element
|
||||
|
||||
class ExampleProvider(val plugin: TestPlugin) : MainAPI() {
|
||||
class SflixProvider(val plugin: TestPlugin) : MainAPI() {
|
||||
// all providers must be an instance of MainAPI
|
||||
override var mainUrl = "https://sflix.to"
|
||||
override var name = "Sflix"
|
||||
|
@ -54,39 +54,6 @@ class ExampleProvider(val plugin: TestPlugin) : MainAPI() {
|
|||
}
|
||||
|
||||
|
||||
/*override val mainPage = mainPageOf(
|
||||
"tv-show" to "TV Show",
|
||||
"movie" to "Movie",
|
||||
"top-imdb" to "Top-IMDB",
|
||||
)
|
||||
|
||||
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
|
||||
// page: An integer > 0, starts on 1 and counts up, Depends on how much the user has scrolled.
|
||||
val url = "$mainUrl/${request.data}?page=$page"
|
||||
var list = mutableListOf<AnimeSearchResponse>()
|
||||
val res = app.get(url).document
|
||||
|
||||
res.select(".flw-item").mapNotNull { article ->
|
||||
val name = article.selectFirst("h2 > a")?.text() ?: ""
|
||||
val poster = article.selectFirst("img")?.attr("data-src")
|
||||
val url = article.selectFirst("a.btn")?.attr("href") ?: ""
|
||||
|
||||
list.add(newAnimeSearchResponse(name, url){
|
||||
this.posterUrl = poster
|
||||
})
|
||||
}
|
||||
|
||||
return newHomePageResponse(
|
||||
list = HomePageList(
|
||||
name = request.name,
|
||||
list = list,
|
||||
isHorizontalImages = true
|
||||
),
|
||||
hasNext = true
|
||||
)
|
||||
}*/
|
||||
|
||||
|
||||
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
|
||||
val html = app.get("$mainUrl/home").text
|
||||
val document = Jsoup.parse(html)
|
||||
|
@ -95,8 +62,6 @@ class ExampleProvider(val plugin: TestPlugin) : MainAPI() {
|
|||
val map = mapOf(
|
||||
"Trending Movies" to "div#trending-movies",
|
||||
"Trending TV Shows" to "div#trending-tv",
|
||||
// "Latest Movies" to "div#trending-tv", // film_list-wrap
|
||||
// "Latest TV Shows" to "div#trending-tv", // film_list-wrap
|
||||
)
|
||||
map.forEach {
|
||||
all.add(HomePageList(
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
package com.lagradost.cloudstream3.extractors
|
||||
|
||||
import android.util.Base64
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.lagradost.cloudstream3.SubtitleFile
|
||||
import com.lagradost.cloudstream3.app
|
||||
import com.lagradost.cloudstream3.utils.AppUtils
|
||||
import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.M3u8Helper
|
||||
|
||||
open class Voe2 : ExtractorApi() {
|
||||
override val name = "Voe"
|
||||
override val mainUrl = "https://voe.sx"
|
||||
override val requiresReferer = true
|
||||
|
||||
private val linkRegex = "(http|https)://([\\w_-]+(?:\\.[\\w_-]+)+)([\\w.,@?^=%&:/~+#-]*[\\w@?^=%&/~+#-])".toRegex()
|
||||
private val base64Regex = Regex("'.*'")
|
||||
|
||||
override suspend fun getUrl(
|
||||
url: String,
|
||||
referer: String?,
|
||||
subtitleCallback: (SubtitleFile) -> Unit,
|
||||
callback: (ExtractorLink) -> Unit
|
||||
) {
|
||||
Log.d("mnemo", "voe.sx loaded")
|
||||
|
||||
// Extract the first redirect URL, like https://roberteachfinal.com/e/xxxxxxx
|
||||
val res = app.get(url, referer = referer).document
|
||||
val redirRegex = """window.location.href = '(.*)'""".toRegex()
|
||||
val redirResult = redirRegex.find(doc)
|
||||
if (redirResult != null){
|
||||
Log.d("mnemo", redirResult)
|
||||
}
|
||||
else{
|
||||
Log.d("mnemo", "voe.sx redir not found")
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val res = app.get(url, referer = referer).document
|
||||
val script = res.select("script").find { it.data().contains("sources =") }?.data()
|
||||
val link = Regex("[\"']hls[\"']:\\s*[\"'](.*)[\"']").find(script ?: return)?.groupValues?.get(1)
|
||||
|
||||
val videoLinks = mutableListOf<String>()
|
||||
|
||||
if (!link.isNullOrBlank()) {
|
||||
videoLinks.add(
|
||||
when {
|
||||
linkRegex.matches(link) -> link
|
||||
else -> String(Base64.decode(link, Base64.DEFAULT))
|
||||
}
|
||||
)
|
||||
} else {
|
||||
val link2 = base64Regex.find(script)?.value ?: return
|
||||
val decoded = Base64.decode(link2, Base64.DEFAULT).toString()
|
||||
val videoLinkDTO = AppUtils.parseJson<WcoSources>(decoded)
|
||||
videoLinkDTO.let { videoLinks.add(it.toString()) }
|
||||
}
|
||||
|
||||
videoLinks.forEach { videoLink ->
|
||||
M3u8Helper.generateM3u8(
|
||||
name,
|
||||
videoLink,
|
||||
"$mainUrl/",
|
||||
headers = mapOf("Origin" to "$mainUrl/")
|
||||
).forEach(callback)
|
||||
}
|
||||
}
|
||||
|
||||
data class WcoSources(
|
||||
@JsonProperty("VideoLinkDTO") val VideoLinkDTO: String,
|
||||
)
|
||||
}
|
Loading…
Reference in New Issue