fix build

This commit is contained in:
hexated 2023-05-03 02:45:23 +07:00
parent 51556f94b6
commit 34aae5c115
10 changed files with 335 additions and 71 deletions

View file

@ -15,6 +15,21 @@ import javax.crypto.spec.IvParameterSpec
import javax.crypto.spec.PBEKeySpec
import javax.crypto.spec.SecretKeySpec
class Sbasian : StreamSB() {
override var mainUrl = "https://sbasian.pro"
override var name = "Sbasian"
}
class Fembed9hd : XStreamCdn() {
override var mainUrl = "https://fembed9hd.com"
override var name = "Fembed9hd"
}
class Moviesm4u : Filesim() {
override val mainUrl = "https://moviesm4u.com"
override val name = "Moviesm4u"
}
class Sbnet : StreamSB() {
override var name = "Sbnet"
override var mainUrl = "https://sbnet.one"

View file

@ -865,6 +865,7 @@ object SoraExtractor : SoraStream() {
suspend fun invokeAnimes(
id: Int? = null,
title: String? = null,
jpTitle: String? = null,
epsTitle: String? = null,
year: Int? = null,
season: Int? = null,
@ -894,48 +895,60 @@ object SoraExtractor : SoraStream() {
invokeBiliBili(aniId, episode, subtitleCallback, callback)
},
{
if (season != null) invokeAllanime(aniId, episode, callback)
if (season != null) invokeAllanime(aniId, title, jpTitle, episode, callback)
}
)
}
private suspend fun invokeAllanime(
aniId: String? = null,
title: String? = null,
jpTitle: String? = null,
episode: Int? = null,
callback: (ExtractorLink) -> Unit
) {
val searchHash = "b645a686b1988327795e1203867ed24f27c6338b41e5e3412fc1478a8ab6774e"
val serverHash = "0ac09728ee9d556967c1a60bbcf55a9f58b4112006d09a258356aeafe1c33889"
val aniDetail = app.get("$consumetAnilistAPI/info/$aniId").parsedSafe<ConsumetDetails>()
val searchQuaery =
"""$allanimeAPI/allanimeapi?variables={"search":{"query":"${aniDetail?.title?.romaji ?: return}","allowAdult":false,"allowUnknown":false},"limit":26,"page":1,"translationType":"sub","countryOrigin":"ALL"}&extensions={"persistedQuery":{"version":1,"sha256Hash":"$searchHash"}}"""
val id = app.get(searchQuaery)
.parsedSafe<AllanimeResponses>()?.data?.shows?.edges?.find {
it.thumbnail == aniDetail.cover || it.thumbnail == aniDetail.image || ((it.name?.equals(
aniDetail.title.romaji,
true
) == true || it.englishName?.equals(
aniDetail.title.romaji,
true
) == true) && it.airedStart?.year == aniDetail.releaseDate)
}?._id
val aniDetail = app.get("$consumetAnilistAPI/info/$aniId").parsedSafe<ConsumetDetails>() ?: return
val edges = app.get(allanimeQueries("""{"search":{"query":"$title","allowAdult":false,"allowUnknown":false},"limit":26,"page":1,"translationType":"sub","countryOrigin":"ALL"}""", allanimeSearchQuery))
.parsedSafe<AllanimeResponses>()?.data?.shows?.edges
val id = edges?.let { edge ->
if (edges.size == 1) {
edge.firstOrNull()
} else {
edge.find {
(it.thumbnail == aniDetail.cover || it.thumbnail == aniDetail.image) || (
(it.name.equals(
aniDetail.title?.romaji,
true
) || it.name.equals(
jpTitle,
true
) || it.englishName.equals(aniDetail.title?.english, true))
&& it.airedStart?.year == aniDetail.releaseDate)
} ?: edge.find {
it.name.equals(
aniDetail.title?.romaji,
true
) || it.name.equals(
jpTitle,
true
) || it.englishName.equals(aniDetail.title?.english, true) || it.englishName.equals(title, true)
}
}
}?._id ?: return
listOf(
"sub",
"dub"
).apmap { tl ->
val serverQuery =
"""$allanimeAPI/allanimeapi?variables={"showId":"${id ?: return@apmap}","translationType":"$tl","episodeString":"$episode"}&extensions={"persistedQuery":{"version":1,"sha256Hash":"$serverHash"}}"""
val server = app.get(serverQuery)
val server = app.get(allanimeQueries("""{"showId":"$id","translationType":"$tl","episodeString":"$episode"}""", allanimeServerQuery))
.parsedSafe<AllanimeResponses>()?.data?.episode?.sourceUrls?.find { it.sourceName == "Ac" }
val serverUrl = fixUrl(
server?.sourceUrl?.replace("/clock", "/clock.json") ?: return@apmap,
"https://blog.allanime.pro"
)
app.get(serverUrl)
.parsedSafe<AllanimeLinks>()?.links?.filter { it.resolutionStr == "RAW" && it.hls == true }?.forEach { source ->
.parsedSafe<AllanimeLinks>()?.links?.filter { it.resolutionStr == "RAW" && it.hls == true }
?.forEach { source ->
val translation = if (tl == "sub") "Raw" else "English Dub"
M3u8Helper.generateM3u8(
"Vrv [$translation]",
@ -1470,7 +1483,7 @@ object SoraExtractor : SoraStream() {
val doc = request.document
val token = doc.selectFirst("meta[name=csrf-token]")?.attr("content")
val m4uData = if (season == null) {
doc.select("div.le-server span#fem").attr("data")
doc.select("div.le-server span").map { it.attr("data") }
} else {
val episodeData =
doc.selectFirst("div.col-lg-9.col-xl-9 p:matches((?i)S0?$season-E0?$episode$)")
@ -1493,26 +1506,28 @@ object SoraExtractor : SoraStream() {
session =
cookiesSet.find { it.second.contains("laravel_session") }?.second?.substringAfter("laravel_session=")
?.substringBefore(";")
requestEmbed.document.select("span#fem").attr("data")
requestEmbed.document.select("div.le-server span").map { it.attr("data") }
}
val iframe = app.post(
"$m4uhdAPI/ajax",
data = mapOf(
"m4u" to m4uData, "_token" to "$token"
),
referer = link,
headers = mapOf(
"Accept" to "*/*",
"X-Requested-With" to "XMLHttpRequest",
),
cookies = mapOf(
"laravel_session" to "$session",
"XSRF-TOKEN" to "$xsrf",
),
).document.select("iframe").attr("src")
m4uData.apmap { data ->
val iframe = app.post(
"$m4uhdAPI/ajax",
data = mapOf(
"m4u" to data, "_token" to "$token"
),
referer = link,
headers = mapOf(
"Accept" to "*/*",
"X-Requested-With" to "XMLHttpRequest",
),
cookies = mapOf(
"laravel_session" to "$session",
"XSRF-TOKEN" to "$xsrf",
),
).document.select("iframe").attr("src")
loadExtractor(iframe, m4uhdAPI, subtitleCallback, callback)
loadExtractor(iframe, m4uhdAPI, subtitleCallback, callback)
}
}

View file

@ -243,10 +243,11 @@ open class SoraStream : TmdbProvider() {
override suspend fun load(url: String): LoadResponse? {
val data = parseJson<Data>(url)
val type = getType(data.type)
val append = "alternative_titles,credits,external_ids,keywords,videos,recommendations"
val resUrl = if (type == TvType.Movie) {
"$tmdbAPI/movie/${data.id}?api_key=$apiKey&append_to_response=keywords,credits,external_ids,videos,recommendations"
"$tmdbAPI/movie/${data.id}?api_key=$apiKey&append_to_response=$append"
} else {
"$tmdbAPI/tv/${data.id}?api_key=$apiKey&append_to_response=keywords,credits,external_ids,videos,recommendations"
"$tmdbAPI/tv/${data.id}?api_key=$apiKey&append_to_response=$append"
}
val res = app.get(resUrl).parsedSafe<MediaDetail>()
?: throw ErrorLoadingException("Invalid Json Response")
@ -297,6 +298,7 @@ open class SoraStream : TmdbProvider() {
airedYear = year,
lastSeason = lastSeason,
epsTitle = eps.name,
jpTitle = res.alternative_titles?.results?.find { it.iso_3166_1 == "JP" }?.title
).toJson(),
name = eps.name,
season = eps.seasonNumber,
@ -339,6 +341,7 @@ open class SoraStream : TmdbProvider() {
year = year,
orgTitle = orgTitle,
isAnime = isAnime,
jpTitle = res.alternative_titles?.results?.find { it.iso_3166_1 == "JP" }?.title
).toJson(),
) {
this.posterUrl = poster
@ -405,6 +408,7 @@ open class SoraStream : TmdbProvider() {
if (res.isAnime) invokeAnimes(
res.id,
res.title,
res.jpTitle,
res.epsTitle,
res.airedYear ?: res.year,
res.season,
@ -875,6 +879,7 @@ open class SoraStream : TmdbProvider() {
val airedYear: Int? = null,
val lastSeason: Int? = null,
val epsTitle: String? = null,
val jpTitle: String? = null,
)
data class Data(
@ -951,6 +956,16 @@ open class SoraStream : TmdbProvider() {
@JsonProperty("results") val results: ArrayList<Trailers>? = arrayListOf(),
)
data class AltTitles(
@JsonProperty("iso_3166_1") val iso_3166_1: String? = null,
@JsonProperty("title") val title: String? = null,
@JsonProperty("type") val type: String? = null,
)
data class ResultsAltTitles(
@JsonProperty("results") val results: ArrayList<AltTitles>? = arrayListOf(),
)
data class ExternalIds(
@JsonProperty("imdb_id") val imdb_id: String? = null,
@JsonProperty("tvdb_id") val tvdb_id: String? = null,
@ -993,6 +1008,7 @@ open class SoraStream : TmdbProvider() {
@JsonProperty("external_ids") val external_ids: ExternalIds? = null,
@JsonProperty("credits") val credits: Credits? = null,
@JsonProperty("recommendations") val recommendations: ResultsRecommendations? = null,
@JsonProperty("alternative_titles") val alternative_titles: ResultsAltTitles? = null,
)
data class EmbedJson(

View file

@ -108,6 +108,7 @@ class SoraStreamLite : SoraStream() {
if (res.isAnime) invokeAnimes(
res.id,
res.title,
res.jpTitle,
res.epsTitle,
res.airedYear ?: res.year,
res.season,

View file

@ -20,5 +20,8 @@ class SoraStreamPlugin: Plugin() {
registerExtractorAPI(Watchx())
registerExtractorAPI(StreamhideCom())
registerExtractorAPI(Movhide())
registerExtractorAPI(Moviesm4u())
registerExtractorAPI(Fembed9hd())
registerExtractorAPI(Sbasian())
}
}

View file

@ -2,6 +2,7 @@ package com.hexated
import android.util.Base64
import com.fasterxml.jackson.annotation.JsonProperty
import com.hexated.SoraStream.Companion.allanimeAPI
import com.hexated.SoraStream.Companion.base64DecodeAPI
import com.hexated.SoraStream.Companion.baymoviesAPI
import com.hexated.SoraStream.Companion.consumetCrunchyrollAPI
@ -44,14 +45,55 @@ import kotlin.math.min
val soraAPI = base64DecodeAPI("cA==YXA=cy8=Y20=di8=LnQ=b2s=a2w=bG8=aS4=YXA=ZS0=aWw=b2I=LW0=Z2E=Ly8=czo=dHA=aHQ=")
val bflixChipperKey = base64DecodeAPI("Yjc=ejM=TzA=YTk=WHE=WnU=bXU=RFo=")
val bflixKey = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
val soraHeaders = mapOf(
"lang" to "en",
"versioncode" to "33",
"clienttype" to "android_Official",
"deviceid" to getDeviceId(),
)
val allanimeSearchQuery = """
query(
${'$'}search: SearchInput
${'$'}limit: Int
${'$'}page: Int
${'$'}translationType: VaildTranslationTypeEnumType
${'$'}countryOrigin: VaildCountryOriginEnumType
) {
shows(
search: ${'$'}search
limit: ${'$'}limit
page: ${'$'}page
translationType: ${'$'}translationType
countryOrigin: ${'$'}countryOrigin
) {
pageInfo {
total
}
edges {
_id
name
thumbnail
englishName
nativeName
}
}
}
""".trimIndent().trim()
val allanimeServerQuery = """
query(
${'$'}showId: String!,
${'$'}translationType: VaildTranslationTypeEnumType!,
${'$'}episodeString: String!
) {
episode(
showId: ${'$'}showId
translationType: ${'$'}translationType
episodeString: ${'$'}episodeString
) {
sourceUrls
}
}
""".trimIndent().trim()
val encodedIndex = arrayOf(
"GamMovies",
"JSMovies",
@ -1044,6 +1086,10 @@ fun String.decryptGomoviesJson(key: String = "123"): String {
return sb.toString()
}
fun allanimeQueries(variables: String, query: String) : String {
return "${allanimeAPI}/allanimeapi?variables=$variables&query=$query"
}
fun Headers.getGomoviesCookies(cookieKey: String = "set-cookie"): Map<String, String> {
val cookieList =
this.filter { it.first.equals(cookieKey, ignoreCase = true) }.mapNotNull {