added source to SoraExtractor

This commit is contained in:
hexated 2022-10-18 23:16:43 +07:00
parent 02d09d3099
commit 507068832d
6 changed files with 53 additions and 49 deletions

View File

@ -1,5 +1,5 @@
// use an integer for version numbers
version = 6
version = 7
cloudstream {

View File

@ -1,5 +1,6 @@
package com.hexated
import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.extractors.XStreamCdn
import com.lagradost.cloudstream3.network.WebViewResolver
@ -202,7 +203,7 @@ object SoraExtractor : SoraStream() {
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
) {
val url = if(season == null) {
val url = if (season == null) {
"$movie123API/imdb.php?imdb=$imdbId&server=vcu"
} else {
"$movie123API/tmdb_api.php?se=$season&ep=$episode&tmdb=$tmdbId&server_name=vcu"
@ -228,6 +229,39 @@ object SoraExtractor : SoraStream() {
)
}
}
suspend fun invokeMovieHab(
id: Int? = null,
season: Int? = null,
episode: Int? = null,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
) {
val url = if (season == null) {
"$movieHabAPI/embed/movie?tmdb=$id"
} else {
"$movieHabAPI/embed/series?tmdb=$id&sea=$season&epi=$episode"
}
val doc = app.get(url, referer = "$movieHabAPI/").document
val movieId = doc.select("div#embed-player").attr("data-movie-id")
doc.select("div.dropdown-menu a").apmap {
val dataId = it.attr("data-id")
app.get(
"$movieHabAPI/ajax/get_stream_link?id=$dataId&movie=$movieId&is_init=true&captcha=&ref=",
referer = url,
headers = mapOf("X-Requested-With" to "XMLHttpRequest")
).parsedSafe<MovieHabRes>()?.data?.let { res ->
loadExtractor(
res.link ?: return@let null,
movieHabAPI,
subtitleCallback,
callback
)
}
}
}
}
private fun getQuality(str: String): Int {
@ -300,4 +334,13 @@ suspend fun loadLinksWithWebView(
true
)
)
}
}
private data class MovieHabData(
@JsonProperty("link") val link: String? = null,
@JsonProperty("token") val token: String? = null,
)
private data class MovieHabRes(
@JsonProperty("data") val data: MovieHabData? = null,
)

View File

@ -5,6 +5,7 @@ import com.hexated.RandomUserAgent.getRandomUserAgent
import com.hexated.SoraExtractor.invoke123Movie
import com.hexated.SoraExtractor.invokeDbgo
import com.hexated.SoraExtractor.invokeLocalSources
import com.hexated.SoraExtractor.invokeMovieHab
import com.hexated.SoraExtractor.invokeOlgply
import com.hexated.SoraExtractor.invokeTwoEmbed
import com.hexated.SoraExtractor.invokeVidSrc
@ -39,6 +40,7 @@ open class SoraStream : TmdbProvider() {
const val vidSrcAPI = "https://v2.vidsrc.me"
const val dbgoAPI = "https://dbgo.fun"
const val movie123API = "https://api.123movie.cc"
const val movieHabAPI = "https://moviehab.com"
fun getType(t: String?): TvType {
return when (t) {
@ -263,14 +265,10 @@ open class SoraStream : TmdbProvider() {
invokeDbgo(res.imdbId, res.season, res.episode, subtitleCallback, callback)
},
{
invoke123Movie(
res.id,
res.imdbId,
res.season,
res.episode,
subtitleCallback,
callback
)
invoke123Movie(res.id, res.imdbId, res.season, res.episode, subtitleCallback, callback)
},
{
invokeMovieHab(res.id, res.season, res.episode, subtitleCallback, callback)
})

View File

@ -1,5 +1,5 @@
// use an integer for version numbers
version = 8
version = 9
cloudstream {

View File

@ -1,36 +0,0 @@
package com.hexated
import com.fasterxml.jackson.annotation.JsonProperty
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
class SpeedoStream1 : ExtractorApi() {
override val name = "SpeedoStream"
override val mainUrl = "https://speedostream.nl"
override val requiresReferer = true
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink> {
val sources = mutableListOf<ExtractorLink>()
app.get(url, referer = referer).document.select("script").map { script ->
if (script.data().contains("jwplayer(\"vplayer\").setup(")) {
val data = script.data().substringAfter("sources: [")
.substringBefore("],").replace("file", "\"file\"").trim()
AppUtils.tryParseJson<File>(data)?.let {
M3u8Helper.generateM3u8(
name,
it.file,
"$mainUrl/",
).forEach { m3uData -> sources.add(m3uData) }
}
}
}
return sources
}
private data class File(
@JsonProperty("file") val file: String,
)
}

View File

@ -10,6 +10,5 @@ class YomoviesProviderPlugin: Plugin() {
override fun load(context: Context) {
// All providers should be added in this manner. Please don't edit the providers list directly.
registerMainAPI(YomoviesProvider())
registerExtractorAPI(SpeedoStream1())
}
}