sora: added netflix

This commit is contained in:
hexated 2023-09-15 01:39:07 +07:00
parent 4077d1275d
commit 36e77332c5
12 changed files with 167 additions and 28 deletions

View file

@ -1,7 +1,7 @@
import org.jetbrains.kotlin.konan.properties.Properties
// use an integer for version numbers
version = 168
version = 169
android {
defaultConfig {

View file

@ -13,6 +13,7 @@ import com.lagradost.cloudstream3.base64Decode
import com.lagradost.cloudstream3.extractors.Pixeldrain
import com.lagradost.cloudstream3.utils.*
import java.math.BigInteger
import java.net.URI
import java.security.MessageDigest
open class Playm4u : ExtractorApi() {
@ -150,7 +151,7 @@ open class VCloud : ExtractorApi() {
val changedLink = doc.selectFirst("script:containsData(url =)")?.data()?.let {
"""url\s*=\s*['"](.*)['"];""".toRegex().find(it)?.groupValues?.get(1)
?.substringAfter("r=")
}
} ?: doc.selectFirst("div.div.vd.d-none a")?.attr("href")
val header = doc.selectFirst("div.card-header")?.text()
app.get(
base64Decode(changedLink ?: return), cookies = res.cookies, headers = mapOf(
@ -158,7 +159,8 @@ open class VCloud : ExtractorApi() {
)
).document.select("p.text-success ~ a").apmap {
val link = it.attr("href")
if (it.text().contains(Regex("Server : 1|2"))) {
val uri = URI(link)
if (uri.path.contains("workers.dev")) {
callback.invoke(
ExtractorLink(
this.name,
@ -184,6 +186,16 @@ open class VCloud : ExtractorApi() {
}
class HubcloudLol : VCloud() {
override val name = "Hubcloud"
override val mainUrl = "https://hubcloud.lol"
}
class Hubcloud : VCloud() {
override val name = "Hubcloud"
override val mainUrl = "https://hubcloud.in"
}
class Pixeldra : Pixeldrain() {
override val mainUrl = "https://pixeldra.in"
}

View file

@ -5,12 +5,7 @@ import com.lagradost.cloudstream3.utils.*
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
import com.lagradost.nicehttp.Requests
import com.lagradost.nicehttp.Session
import com.lagradost.cloudstream3.extractors.Filesim
import com.lagradost.cloudstream3.extractors.GMPlayer
import com.lagradost.cloudstream3.extractors.StreamSB
import com.lagradost.cloudstream3.extractors.Voe
import com.lagradost.cloudstream3.extractors.helper.AesHelper.cryptoAESHandler
import com.lagradost.cloudstream3.extractors.helper.GogoHelper
import com.lagradost.cloudstream3.network.CloudflareKiller
import com.lagradost.nicehttp.RequestBodyTypes
import kotlinx.coroutines.delay
@ -319,7 +314,6 @@ object SoraExtractor : SoraStream() {
callback: (ExtractorLink) -> Unit,
fixIframe: Boolean = false,
encrypt: Boolean = false,
key: String? = null,
) {
fun String.fixBloat() : String {
return this.replace("\"", "").replace("\\", "")
@ -572,8 +566,8 @@ object SoraExtractor : SoraStream() {
"${link.name} ${it.second}",
link.url,
link.referer,
when {
link.type == ExtractorLinkType.M3U8 -> link.quality
when (link.type) {
ExtractorLinkType.M3U8 -> link.quality
else -> getQualityFromName(it.first)
},
link.type,
@ -900,8 +894,8 @@ object SoraExtractor : SoraStream() {
"${link.name} [${it.second}]",
link.url,
link.referer,
when {
link.type == ExtractorLinkType.M3U8 -> link.quality
when (link.type) {
ExtractorLinkType.M3U8 -> link.quality
else -> it.third
},
link.type,
@ -2756,6 +2750,52 @@ object SoraExtractor : SoraStream() {
)
}
suspend fun invokeNetflix(
imdbId: String? = null,
season: Int? = null,
episode: Int? = null,
callback: (ExtractorLink) -> Unit,
) {
val headers = mapOf("X-Requested-With" to "XMLHttpRequest", "Cookie" to "hd=on")
val netflixId = imdbToNetflixId(imdbId, season)
val (title, id) = app.get(
"$netflixAPI/post.php?id=${netflixId ?: return}&t=${APIHolder.unixTime}",
headers = headers
).parsedSafe<NetflixResponse>().let { media ->
if (season == null) {
media?.title to netflixId
} else {
val seasonId = media?.season?.find { it.s == "$season" }?.id
val episodeId =
app.get(
"$netflixAPI/episodes.php?s=${seasonId}&series=$netflixId&t=${APIHolder.unixTime}",
headers = headers
)
.parsedSafe<NetflixResponse>()?.episodes?.find { it.ep == "E$episode" }?.id
media?.title to episodeId
}
}
app.get(
"$netflixAPI/playlist.php?id=${id ?: return}&t=${title ?: return}&tm=${APIHolder.unixTime}",
headers = headers
).text.let {
tryParseJson<ArrayList<NetflixResponse>>(it)
}?.firstOrNull()?.sources?.map {
callback.invoke(
ExtractorLink(
"Netflix",
"Netflix",
fixUrl(it.file ?: return@map, netflixAPI),
"$netflixAPI/",
getQualityFromName(it.file.substringAfter("q=")),
INFER_TYPE,
headers = mapOf("Cookie" to "hd=on")
)
)
}
}
}

View file

@ -428,3 +428,36 @@ data class EMovieTraks(
data class FourCartoonSources(
@JsonProperty("videoSource") val videoSource: String? = null,
)
data class WatchhubStream(
@JsonProperty("name") val name: String? = null,
@JsonProperty("externalUrl") val externalUrl: String? = null,
)
data class WatchhubResponse(
@JsonProperty("streams") val streams: ArrayList<WatchhubStream>? = arrayListOf(),
)
data class NetflixSources(
@JsonProperty("file") val file: String? = null,
@JsonProperty("label") val label: String? = null,
)
data class NetflixEpisodes(
@JsonProperty("id") val id: String? = null,
@JsonProperty("t") val t: String? = null,
@JsonProperty("s") val s: String? = null,
@JsonProperty("ep") val ep: String? = null,
)
data class NetflixSeason(
@JsonProperty("s") val s: String? = null,
@JsonProperty("id") val id: String? = null,
)
data class NetflixResponse(
@JsonProperty("title") val title: String? = null,
@JsonProperty("season") val season: ArrayList<NetflixSeason>? = arrayListOf(),
@JsonProperty("episodes") val episodes: ArrayList<NetflixEpisodes>? = arrayListOf(),
@JsonProperty("sources") val sources: ArrayList<NetflixSources>? = arrayListOf(),
)

View file

@ -41,6 +41,7 @@ import com.hexated.SoraExtractor.invokeFourCartoon
import com.hexated.SoraExtractor.invokeJump1
import com.hexated.SoraExtractor.invokeMoment
import com.hexated.SoraExtractor.invokeMultimovies
import com.hexated.SoraExtractor.invokeNetflix
import com.hexated.SoraExtractor.invokeNetmovies
import com.hexated.SoraExtractor.invokePobmovies
import com.hexated.SoraExtractor.invokePrimewire
@ -79,6 +80,7 @@ open class SoraStream : TmdbProvider() {
const val malsyncAPI = "https://api.malsync.moe"
const val consumetHelper = "https://api.consumet.org/anime/9anime/helper"
const val jikanAPI = "https://api.jikan.moe/v4"
const val watchhubApi = "https://watchhub.strem.io"
private val apiKey =
base64DecodeAPI("ZTM=NTg=MjM=MjM=ODc=MzI=OGQ=MmE=Nzk=Nzk=ZjI=NTA=NDY=NDA=MzA=YjA=") // PLEASE DON'T STEAL
@ -131,6 +133,7 @@ open class SoraStream : TmdbProvider() {
const val susflixAPI = "https://susflix.tv"
const val jump1API = "https://ca.jump1.net"
const val vegaMoviesAPI = "https://vegamovies.im"
const val netflixAPI = "https://m.netflixmirror.com"
// INDEX SITE
const val dahmerMoviesAPI = "https://edytjedhgmdhm.abfhaqrhbnf.workers.dev"
@ -738,6 +741,14 @@ open class SoraStream : TmdbProvider() {
callback
)
},
{
if (!res.isAnime) invokeNetflix(
res.imdbId,
res.season,
res.episode,
callback
)
}
)
return true

View file

@ -28,6 +28,7 @@ import com.hexated.SoraExtractor.invokeFourCartoon
import com.hexated.SoraExtractor.invokeJump1
import com.hexated.SoraExtractor.invokeMoment
import com.hexated.SoraExtractor.invokeMultimovies
import com.hexated.SoraExtractor.invokeNetflix
import com.hexated.SoraExtractor.invokeNetmovies
import com.hexated.SoraExtractor.invokePrimewire
import com.hexated.SoraExtractor.invokeVidSrc
@ -327,6 +328,14 @@ class SoraStreamLite : SoraStream() {
callback
)
},
{
if (!res.isAnime) invokeNetflix(
res.imdbId,
res.season,
res.episode,
callback
)
}
)
return true

View file

@ -20,5 +20,7 @@ class SoraStreamPlugin: Plugin() {
registerExtractorAPI(Playm4u())
registerExtractorAPI(VCloud())
registerExtractorAPI(Pixeldra())
registerExtractorAPI(Hubcloud())
registerExtractorAPI(HubcloudLol())
}
}

View file

@ -13,6 +13,7 @@ import com.hexated.SoraStream.Companion.malsyncAPI
import com.hexated.SoraStream.Companion.smashyStreamAPI
import com.hexated.SoraStream.Companion.tvMoviesAPI
import com.hexated.SoraStream.Companion.watchOnlineAPI
import com.hexated.SoraStream.Companion.watchhubApi
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.APIHolder.getCaptchaToken
import com.lagradost.cloudstream3.APIHolder.unixTimeMS
@ -1139,6 +1140,17 @@ suspend fun tmdbToAnimeId(title: String?, year: Int?, season: String?, type: TvT
}
suspend fun imdbToNetflixId(imdbId: String?, season: Int?): String? {
val url = if (season == null) {
"$watchhubApi/stream/movie/$imdbId.json"
} else {
"$watchhubApi/stream/series/$imdbId:1:1.json"
}
return app.get(url)
.parsedSafe<WatchhubResponse>()?.streams?.find { it.name == "Netflix" }?.externalUrl
?.substringAfterLast("/")
}
suspend fun loadCustomExtractor(
name: String? = null,
url: String,
@ -1154,8 +1166,8 @@ suspend fun loadCustomExtractor(
name ?: link.name,
link.url,
link.referer,
when {
link.type == ExtractorLinkType.M3U8 -> link.quality
when (link.type) {
ExtractorLinkType.M3U8 -> link.quality
else -> quality ?: link.quality
},
link.type,