mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
optimize code
This commit is contained in:
parent
039de442da
commit
cbdf11386c
7 changed files with 96 additions and 108 deletions
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
|
@ -56,6 +56,7 @@ jobs:
|
|||
ANICHI_APP: ${{ secrets.ANICHI_APP }}
|
||||
PRIMEWIRE_KEY: ${{ secrets.PRIMEWIRE_KEY }}
|
||||
ZSHOW_API: ${{ secrets.ZSHOW_API }}
|
||||
VATIC_API: ${{ secrets.VATIC_API }}
|
||||
run: |
|
||||
cd $GITHUB_WORKSPACE/src
|
||||
echo SORA_API=$SORA_API >> local.properties
|
||||
|
@ -72,6 +73,7 @@ jobs:
|
|||
echo ANICHI_APP=$ANICHI_APP >> local.properties
|
||||
echo PRIMEWIRE_KEY=$PRIMEWIRE_KEY >> local.properties
|
||||
echo ZSHOW_API=$ZSHOW_API >> local.properties
|
||||
echo VATIC_API=$VATIC_API >> local.properties
|
||||
|
||||
- name: Build Plugins
|
||||
run: |
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
import org.jetbrains.kotlin.konan.properties.Properties
|
||||
|
||||
// use an integer for version numbers
|
||||
version = 180
|
||||
version = 181
|
||||
|
||||
android {
|
||||
defaultConfig {
|
||||
val properties = Properties()
|
||||
properties.load(project.rootProject.file("local.properties").inputStream())
|
||||
|
||||
buildConfigField("String", "VATIC_API", "\"${properties.getProperty("VATIC_API")}\"")
|
||||
buildConfigField("String", "ZSHOW_API", "\"${properties.getProperty("ZSHOW_API")}\"")
|
||||
buildConfigField("String", "SORA_API", "\"${properties.getProperty("SORA_API")}\"")
|
||||
buildConfigField("String", "SORAHE", "\"${properties.getProperty("SORAHE")}\"")
|
||||
|
|
|
@ -34,8 +34,8 @@ object SoraExtractor : SoraStream() {
|
|||
"X-Requested-With" to "XMLHttpRequest"
|
||||
)
|
||||
|
||||
fun Document.getServers(): List<String> {
|
||||
return this.select("a").map { it.attr("data-id") }
|
||||
fun Document.getServers(): List<Pair<String,String>> {
|
||||
return this.select("a").map { it.attr("data-id") to it.text() }
|
||||
}
|
||||
|
||||
val media = app.get(
|
||||
|
@ -83,12 +83,12 @@ object SoraExtractor : SoraStream() {
|
|||
).document.getServers()
|
||||
}
|
||||
|
||||
serversId.apmap { id ->
|
||||
serversId.apmap { (id, name) ->
|
||||
val iframe =
|
||||
app.get("$gokuAPI/ajax/movie/episode/server/sources/$id", headers = headers)
|
||||
.parsedSafe<GokuServer>()?.data?.link ?: return@apmap
|
||||
loadCustomExtractor(
|
||||
if (iframe.contains("rabbitstream")) "Vidcloud" else "Upcloud",
|
||||
name,
|
||||
iframe,
|
||||
"$gokuAPI/",
|
||||
subtitleCallback,
|
||||
|
@ -2501,49 +2501,6 @@ object SoraExtractor : SoraStream() {
|
|||
|
||||
}
|
||||
|
||||
suspend fun invokeSusflix(
|
||||
tmdbId: Int? = null,
|
||||
season: Int? = null,
|
||||
episode: Int? = null,
|
||||
subtitleCallback: (SubtitleFile) -> Unit,
|
||||
callback: (ExtractorLink) -> Unit,
|
||||
) {
|
||||
val url = if (season == null) {
|
||||
"$susflixAPI/view/movie/$tmdbId"
|
||||
} else {
|
||||
"$susflixAPI/view/tv/$tmdbId/$season/$episode"
|
||||
}
|
||||
|
||||
val res = app.get(
|
||||
url, cookies = mapOf(
|
||||
"session" to "eyJfZnJlc2giOmZhbHNlLCJwaG9uZV9udW1iZXIiOiJzdXNoZXg5OCJ9.ZO6CsA.XUs6Y5gna8ExAUX55-myMi1QpYU"
|
||||
)
|
||||
).text.substringAfter("response = {").substringBefore("};").replace("\'", "\"")
|
||||
|
||||
val sources = tryParseJson<SusflixSources>("{$res}")
|
||||
sources?.qualities?.map { source ->
|
||||
callback.invoke(
|
||||
ExtractorLink(
|
||||
"Susflix",
|
||||
"Susflix",
|
||||
source.path ?: return@map,
|
||||
"$susflixAPI/",
|
||||
getQualityFromName(source.quality)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
sources?.srtfiles?.map { sub ->
|
||||
subtitleCallback.invoke(
|
||||
SubtitleFile(
|
||||
sub.caption ?: return@map,
|
||||
sub.url ?: return@map,
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
suspend fun invokeJump1(
|
||||
tmdbId: Int? = null,
|
||||
tvdbId: Int? = null,
|
||||
|
@ -2587,5 +2544,47 @@ object SoraExtractor : SoraStream() {
|
|||
)
|
||||
}
|
||||
|
||||
suspend fun invokeVatic(
|
||||
tmdbId: Int? = null,
|
||||
season: Int? = null,
|
||||
episode: Int? = null,
|
||||
subtitleCallback: (SubtitleFile) -> Unit,
|
||||
callback: (ExtractorLink) -> Unit,
|
||||
) {
|
||||
val vaticAPI = BuildConfig.VATIC_API
|
||||
val url = if (season == null) {
|
||||
"$vaticAPI/api/movie?id=$tmdbId"
|
||||
} else {
|
||||
"$vaticAPI/api/tv?id=$tmdbId&s=$season&e=$episode"
|
||||
}
|
||||
|
||||
val res = app.get(
|
||||
url
|
||||
).parsedSafe<VaticSources>()
|
||||
|
||||
res?.qualities?.map { source ->
|
||||
callback.invoke(
|
||||
ExtractorLink(
|
||||
"Vatic",
|
||||
"Vatic",
|
||||
source.path ?: return@map,
|
||||
"$vaticAPI/",
|
||||
if(source.quality.equals("auto", true)) Qualities.P1080.value else getQualityFromName(source.quality),
|
||||
INFER_TYPE
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
res?.srtfiles?.map { sub ->
|
||||
subtitleCallback.invoke(
|
||||
SubtitleFile(
|
||||
sub.caption ?: return@map,
|
||||
sub.url ?: return@map,
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -67,21 +67,6 @@ data class KisskhDetail(
|
|||
@JsonProperty("episodes") val episodes: ArrayList<KisskhEpisodes>? = arrayListOf(),
|
||||
)
|
||||
|
||||
data class SusflixSrtfiles(
|
||||
@JsonProperty("caption") val caption: String? = null,
|
||||
@JsonProperty("url") val url: String? = null,
|
||||
)
|
||||
|
||||
data class SusflixQualities(
|
||||
@JsonProperty("path") val path: String? = null,
|
||||
@JsonProperty("quality") val quality: String? = null,
|
||||
)
|
||||
|
||||
data class SusflixSources(
|
||||
@JsonProperty("Qualities") val qualities: ArrayList<SusflixQualities>? = arrayListOf(),
|
||||
@JsonProperty("Srtfiles") val srtfiles: ArrayList<SusflixSrtfiles>? = arrayListOf(),
|
||||
)
|
||||
|
||||
data class KisskhResults(
|
||||
@JsonProperty("id") val id: Int?,
|
||||
@JsonProperty("title") val title: String?,
|
||||
|
@ -416,3 +401,18 @@ data class ShowflixSearchMovies(
|
|||
data class ShowflixSearchSeries(
|
||||
@JsonProperty("results") val resultsSeries: ArrayList<ShowflixResultsSeries>? = arrayListOf(),
|
||||
)
|
||||
|
||||
data class VaticSrtfiles(
|
||||
@JsonProperty("caption") var caption: String? = null,
|
||||
@JsonProperty("url") var url: String? = null,
|
||||
)
|
||||
|
||||
data class VaticQualities(
|
||||
@JsonProperty("path") var path: String? = null,
|
||||
@JsonProperty("quality") var quality: String? = null,
|
||||
)
|
||||
|
||||
data class VaticSources(
|
||||
@JsonProperty("Qualities") var qualities: ArrayList<VaticQualities> = arrayListOf(),
|
||||
@JsonProperty("Srtfiles") var srtfiles: ArrayList<VaticSrtfiles> = arrayListOf(),
|
||||
)
|
|
@ -46,10 +46,10 @@ import com.hexated.SoraExtractor.invokePutactor
|
|||
import com.hexated.SoraExtractor.invokeShowflix
|
||||
import com.hexated.SoraExtractor.invokeTvMovies
|
||||
import com.hexated.SoraExtractor.invokeUhdmovies
|
||||
import com.hexated.SoraExtractor.invokeVatic
|
||||
import com.hexated.SoraExtractor.invokeVegamovies
|
||||
import com.hexated.SoraExtractor.invokeVidsrcto
|
||||
import com.hexated.SoraExtractor.invokeWatchOnline
|
||||
import com.hexated.SoraExtractor.invokeWatchflx
|
||||
import com.hexated.SoraExtractor.invokeWatchsomuch
|
||||
import com.hexated.SoraExtractor.invokeZshow
|
||||
import com.lagradost.cloudstream3.LoadResponse.Companion.addImdbId
|
||||
|
@ -123,7 +123,6 @@ open class SoraStream : TmdbProvider() {
|
|||
const val dramadayAPI = "https://dramaday.me"
|
||||
const val animetoshoAPI = "https://animetosho.org"
|
||||
const val putactorAPI = "https://putlocker.actor"
|
||||
const val susflixAPI = "https://susflix.tv"
|
||||
const val jump1API = "https://ca.jump1.net"
|
||||
const val vegaMoviesAPI = "https://vegamovies.id"
|
||||
const val hdmovies4uAPI = "https://hdmovies4u.name"
|
||||
|
@ -699,9 +698,6 @@ open class SoraStream : TmdbProvider() {
|
|||
{
|
||||
if (!res.isAnime) invoke2embed(res.imdbId, res.season, res.episode, callback)
|
||||
},
|
||||
// {
|
||||
// invokeSusflix(res.id,res.season,res.episode,subtitleCallback,callback)
|
||||
// },
|
||||
{
|
||||
if (!res.isAnime) invokeJump1(
|
||||
res.id,
|
||||
|
@ -723,9 +719,9 @@ open class SoraStream : TmdbProvider() {
|
|||
callback
|
||||
)
|
||||
},
|
||||
{
|
||||
if (!res.isAnime) invokeWatchflx(res.id, res.season, res.episode, callback)
|
||||
},
|
||||
// {
|
||||
// if (!res.isAnime) invokeWatchflx(res.id, res.season, res.episode, callback)
|
||||
// },
|
||||
{
|
||||
invokeZshow(
|
||||
res.title,
|
||||
|
@ -755,6 +751,15 @@ open class SoraStream : TmdbProvider() {
|
|||
callback
|
||||
)
|
||||
},
|
||||
{
|
||||
if (!res.isAnime) invokeVatic(
|
||||
res.id,
|
||||
res.season,
|
||||
res.episode,
|
||||
subtitleCallback,
|
||||
callback
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
return true
|
||||
|
|
|
@ -29,10 +29,10 @@ import com.hexated.SoraExtractor.invokeNetmovies
|
|||
import com.hexated.SoraExtractor.invokeGomovies
|
||||
import com.hexated.SoraExtractor.invokePutactor
|
||||
import com.hexated.SoraExtractor.invokeShowflix
|
||||
import com.hexated.SoraExtractor.invokeVatic
|
||||
import com.hexated.SoraExtractor.invokeVidSrc
|
||||
import com.hexated.SoraExtractor.invokeVidsrcto
|
||||
import com.hexated.SoraExtractor.invokeWatchOnline
|
||||
import com.hexated.SoraExtractor.invokeWatchflx
|
||||
import com.hexated.SoraExtractor.invokeWatchsomuch
|
||||
import com.hexated.SoraExtractor.invokeZshow
|
||||
import com.lagradost.cloudstream3.SubtitleFile
|
||||
|
@ -56,15 +56,6 @@ class SoraStreamLite : SoraStream() {
|
|||
{
|
||||
if(!res.isAnime) invokeJump1(res.id,res.tvdbId,res.title,res.year,res.season,res.episode,callback)
|
||||
},
|
||||
// {
|
||||
// invokeSusflix(
|
||||
// res.id,
|
||||
// res.season,
|
||||
// res.episode,
|
||||
// subtitleCallback,
|
||||
// callback
|
||||
// )
|
||||
// },
|
||||
{
|
||||
if (!res.isAnime) invokeBlackvid(
|
||||
res.id,
|
||||
|
@ -285,14 +276,14 @@ class SoraStreamLite : SoraStream() {
|
|||
callback
|
||||
)
|
||||
},
|
||||
{
|
||||
if (!res.isAnime) invokeWatchflx(
|
||||
res.id,
|
||||
res.season,
|
||||
res.episode,
|
||||
callback
|
||||
)
|
||||
},
|
||||
// {
|
||||
// if (!res.isAnime) invokeWatchflx(
|
||||
// res.id,
|
||||
// res.season,
|
||||
// res.episode,
|
||||
// callback
|
||||
// )
|
||||
// },
|
||||
{
|
||||
if(!res.isAnime) invoke2embed(
|
||||
res.imdbId,
|
||||
|
@ -321,6 +312,15 @@ class SoraStreamLite : SoraStream() {
|
|||
callback
|
||||
)
|
||||
},
|
||||
{
|
||||
if (!res.isAnime) invokeVatic(
|
||||
res.id,
|
||||
res.season,
|
||||
res.episode,
|
||||
subtitleCallback,
|
||||
callback
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
return true
|
||||
|
|
|
@ -151,25 +151,6 @@ fun Document.getMirrorServer(server: Int): String {
|
|||
return this.select("div.text-center a:contains(Server $server)").attr("href")
|
||||
}
|
||||
|
||||
suspend fun request(
|
||||
url: String,
|
||||
allowRedirects: Boolean = true,
|
||||
timeout: Long = 30L
|
||||
): Response {
|
||||
val client = OkHttpClient().newBuilder()
|
||||
.connectTimeout(timeout, TimeUnit.SECONDS)
|
||||
.readTimeout(timeout, TimeUnit.SECONDS)
|
||||
.writeTimeout(timeout, TimeUnit.SECONDS)
|
||||
.followRedirects(allowRedirects)
|
||||
.followSslRedirects(allowRedirects)
|
||||
.build()
|
||||
|
||||
val request: Request = Request.Builder()
|
||||
.url(url)
|
||||
.build()
|
||||
return client.newCall(request).await()
|
||||
}
|
||||
|
||||
suspend fun extractMirrorUHD(url: String, ref: String): String? {
|
||||
var baseDoc = app.get(fixUrl(url, ref)).document
|
||||
var downLink = baseDoc.getMirrorLink()
|
||||
|
|
Loading…
Reference in a new issue