small refactoring code

This commit is contained in:
hexated 2023-05-05 16:31:57 +07:00
parent 212c0ee199
commit 52f7ea9d59
7 changed files with 61 additions and 67 deletions

View file

@ -40,10 +40,18 @@ jobs:
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: Access SORA_API
- name: Access Secrets
env:
SORA_API: ${{ secrets.SORA_API }}
run: echo SORA_API=$SORA_API > $GITHUB_WORKSPACE/src/local.properties
SORAHE: ${{ secrets.SORAHE }}
SORAXA: ${{ secrets.SORAXA }}
SORATED: ${{ secrets.SORATED }}
run: |
cd $GITHUB_WORKSPACE/src
echo SORA_API=$SORA_API > local.properties
echo SORAHE=$SORAHE > local.properties
echo SORAXA=$SORAXA > local.properties
echo SORATED=$SORATED > local.properties
- name: Build Plugins
run: |

View file

@ -32,10 +32,6 @@ class Krakenfiles : ExtractorApi() {
}
data class Source(
@JsonProperty("url") val url: String? = null,
)
}
class Gofile : ExtractorApi() {

View file

@ -9,6 +9,9 @@ android {
properties.load(project.rootProject.file("local.properties").inputStream())
buildConfigField("String", "SORA_API", "\"${properties.getProperty("SORA_API")}\"")
buildConfigField("String", "SORAHE", "\"${properties.getProperty("SORAHE")}\"")
buildConfigField("String", "SORAXA", "\"${properties.getProperty("SORAXA")}\"")
buildConfigField("String", "SORATED", "\"${properties.getProperty("SORATED")}\"")
}

View file

@ -5,6 +5,7 @@ import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.extractors.Filesim
import com.lagradost.cloudstream3.extractors.StreamSB
import com.lagradost.cloudstream3.extractors.XStreamCdn
import com.lagradost.cloudstream3.extractors.helper.AsianEmbedHelper
import com.lagradost.cloudstream3.utils.AppUtils
import com.lagradost.cloudstream3.utils.ExtractorApi
import com.lagradost.cloudstream3.utils.ExtractorLink
@ -15,9 +16,9 @@ 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 StreamM4u : XStreamCdn() {
override val name: String = "StreamM4u"
override val mainUrl: String = "https://streamm4u.club"
}
class Fembed9hd : XStreamCdn() {
@ -25,9 +26,9 @@ class Fembed9hd : XStreamCdn() {
override var name = "Fembed9hd"
}
class Moviesm4u : Filesim() {
override val mainUrl = "https://moviesm4u.com"
override val name = "Moviesm4u"
class Sbasian : StreamSB() {
override var mainUrl = "https://sbasian.pro"
override var name = "Sbasian"
}
class Sbnet : StreamSB() {
@ -35,11 +36,6 @@ class Sbnet : StreamSB() {
override var mainUrl = "https://sbnet.one"
}
class StreamM4u : XStreamCdn() {
override val name: String = "StreamM4u"
override val mainUrl: String = "https://streamm4u.club"
}
class Sblongvu : StreamSB() {
override var name = "Sblongvu"
override var mainUrl = "https://sblongvu.com"
@ -50,6 +46,11 @@ class Keephealth : StreamSB() {
override var mainUrl = "https://keephealth.info"
}
class Moviesm4u : Filesim() {
override val mainUrl = "https://moviesm4u.com"
override val name = "Moviesm4u"
}
class FileMoonIn : Filesim() {
override val mainUrl = "https://filemoon.in"
override val name = "FileMoon"
@ -97,6 +98,7 @@ open class Chillx : ExtractorApi() {
val source = Regex("""sources:\s*\[\{"file":"([^"]+)""").find(decrypt)?.groupValues?.get(1)
val tracks = Regex("""tracks:\s*\[(.+)]""").find(decrypt)?.groupValues?.get(1)
// required
val headers = mapOf(
"Accept" to "*/*",
"Connection" to "keep-alive",

View file

@ -649,24 +649,24 @@ object SoraExtractor : SoraStream() {
)
}
// if(season == null) return
// json.definitionList?.map { video ->
// val media = app.get(
// "${BuildConfig.SORA_API}/movieDrama/getPlayInfo?category=${type}&contentId=${id}&episodeId=${json.id}&definition=${video.code}",
// headers = soraHeaders,
// ).parsedSafe<SorastreamResponse>()?.data
//
// callback.invoke(
// ExtractorLink(
// this.name,
// this.name,
// media?.mediaUrl ?: return@map null,
// base64DecodeAPI("Lw==b20=LmM=b2s=a2w=bG8=Ly8=czo=dHA=aHQ="),
// getSoraQuality(media.currentDefinition ?: ""),
// true,
// )
// )
// }
if(season == null) return
json.definitionList?.map { video ->
val media = app.get(
"${BuildConfig.SORA_API}/movieDrama/getPlayInfo?category=${type}&contentId=${id}&episodeId=${json.id}&definition=${video.code}",
headers = soraHeaders,
).parsedSafe<SorastreamResponse>()?.data
callback.invoke(
ExtractorLink(
this.name,
this.name,
if(media?.mediaUrl?.startsWith(BuildConfig.SORAXA) == true) upgradeSoraUrl(media.mediaUrl) else media?.mediaUrl ?: return@map null,
if(media.mediaUrl.startsWith(BuildConfig.SORAHE)) base64DecodeAPI("Lw==b20=LmM=b2s=a2w=bG8=Ly8=czo=dHA=aHQ=") else "",
getSoraQuality(media.currentDefinition ?: ""),
true,
)
)
}
}
suspend fun invokeXmovies(
@ -873,16 +873,9 @@ object SoraExtractor : SoraStream() {
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
) {
val malId =
if (season != null) app.get("$tmdb2mal/?id=$id&s=$season").text.trim()
else app.get("${jikanAPI}/anime?q=${title}&start_date=${year}&type=movie&limit=1")
.parsedSafe<JikanResponse>()?.data?.firstOrNull()?.mal_id
val aniId = app.post(
"https://graphql.anilist.co/", data = mapOf(
"query" to "{Media(idMal:$malId,type:ANIME){id}}",
)
).parsedSafe<DataAni>()?.data?.media?.id
val (aniId, malId) = app.get(
if(season == null) "$tmdb2anilist/movie/?id=$id" else "$tmdb2anilist/tv/?id=$id&s=$season"
).parsedSafe<Tmdb2Anilist>().let { it?.anilist_id to it?.mal_id }
argamap(
{
@ -2956,6 +2949,12 @@ data class BaymoviesConfig(
val workers: List<String>
)
data class Tmdb2Anilist(
@JsonProperty("tmdb_id") val tmdb_id: String? = null,
@JsonProperty("anilist_id") val anilist_id: String? = null,
@JsonProperty("mal_id") val mal_id: String? = null,
)
data class Movie123Media(
@JsonProperty("url") val url: String? = null,
)
@ -3155,26 +3154,6 @@ data class FDAds(
@JsonProperty("linkr") val linkr: String? = null,
)
data class DataMal(
@JsonProperty("mal_id") val mal_id: String? = null,
)
data class JikanResponse(
@JsonProperty("data") val data: ArrayList<DataMal>? = arrayListOf(),
)
data class IdAni(
@JsonProperty("id") val id: String? = null,
)
data class MediaAni(
@JsonProperty("Media") val media: IdAni? = null,
)
data class DataAni(
@JsonProperty("data") val data: MediaAni? = null,
)
data class Smashy1Tracks(
@JsonProperty("file") val file: String? = null,
@JsonProperty("label") val label: String? = null,

View file

@ -78,8 +78,7 @@ open class SoraStream : TmdbProvider() {
companion object {
/** TOOLS */
private const val tmdbAPI = "https://api.themoviedb.org/3"
const val tmdb2mal = "https://tmdb2mal.slidemovies.org"
const val jikanAPI = "https://api.jikan.moe/v4"
const val tmdb2anilist = "https://tmdb2anilist.slidemovies.org"
const val gdbot = "https://gdbot.xyz"
const val consumetAnilistAPI = "https://api.consumet.org/meta/anilist"

View file

@ -27,6 +27,7 @@ import okhttp3.Headers
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.RequestBody.Companion.toRequestBody
import okio.ByteString.Companion.encode
import org.jsoup.nodes.Document
import java.net.URI
import java.net.URL
@ -593,6 +594,12 @@ suspend fun fetchSoraEpisodes(id: String, type: String, episode: Int?): EpisodeV
}
}
fun upgradeSoraUrl(url: String) : String {
val expiry = System.currentTimeMillis() * 60 * 60 * 12
val mac = "fuckfuck".encode().hmacSha256("$expiry".encode()).hex()
return "${url.replace(BuildConfig.SORAXA, BuildConfig.SORATED).substringBefore(".m3u8")}.m3u8?hdntl=exp=$expiry-acl=%2f*-data=hdntl-hmac=$mac"
}
suspend fun bypassOuo(url: String?): String? {
var res = session.get(url ?: return null)
run lit@{