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 - name: Setup Android SDK
uses: android-actions/setup-android@v2 uses: android-actions/setup-android@v2
- name: Access SORA_API - name: Access Secrets
env: env:
SORA_API: ${{ secrets.SORA_API }} 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 - name: Build Plugins
run: | run: |

View file

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

View file

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

View file

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

View file

@ -78,8 +78,7 @@ open class SoraStream : TmdbProvider() {
companion object { companion object {
/** TOOLS */ /** TOOLS */
private const val tmdbAPI = "https://api.themoviedb.org/3" private const val tmdbAPI = "https://api.themoviedb.org/3"
const val tmdb2mal = "https://tmdb2mal.slidemovies.org" const val tmdb2anilist = "https://tmdb2anilist.slidemovies.org"
const val jikanAPI = "https://api.jikan.moe/v4"
const val gdbot = "https://gdbot.xyz" const val gdbot = "https://gdbot.xyz"
const val consumetAnilistAPI = "https://api.consumet.org/meta/anilist" 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.HttpUrl.Companion.toHttpUrl
import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.RequestBody.Companion.toRequestBody import okhttp3.RequestBody.Companion.toRequestBody
import okio.ByteString.Companion.encode
import org.jsoup.nodes.Document import org.jsoup.nodes.Document
import java.net.URI import java.net.URI
import java.net.URL 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? { suspend fun bypassOuo(url: String?): String? {
var res = session.get(url ?: return null) var res = session.get(url ?: return null)
run lit@{ run lit@{