From 7a5a2375c7f9b710f8a38cff4af1fd438bbb7da2 Mon Sep 17 00:00:00 2001 From: hexated Date: Tue, 21 Feb 2023 22:50:13 +0700 Subject: [PATCH] fix --- Loklok/build.gradle.kts | 5 +++-- Loklok/src/main/kotlin/com/hexated/Loklok.kt | 9 +++++---- SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt | 4 +++- SoraStream/src/main/kotlin/com/hexated/SoraStream.kt | 1 + SoraStream/src/main/kotlin/com/hexated/SoraStreamLite.kt | 1 + 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Loklok/build.gradle.kts b/Loklok/build.gradle.kts index 65e18c29..6541e685 100644 --- a/Loklok/build.gradle.kts +++ b/Loklok/build.gradle.kts @@ -1,12 +1,13 @@ // use an integer for version numbers -version = 16 +version = 17 cloudstream { language = "en" // All of these properties are optional, you can safely remove them - description = "#2 best extension based on Loklok API" +// description = "#2 best extension based on Loklok API" + description = "Use External Player" authors = listOf("Hexated") /** diff --git a/Loklok/src/main/kotlin/com/hexated/Loklok.kt b/Loklok/src/main/kotlin/com/hexated/Loklok.kt index e0213287..724f6f55 100644 --- a/Loklok/src/main/kotlin/com/hexated/Loklok.kt +++ b/Loklok/src/main/kotlin/com/hexated/Loklok.kt @@ -223,9 +223,10 @@ class Loklok : MainAPI() { """[{"category":${res.category},"contentId":"${res.id}","episodeId":${res.epId},"definition":"${video.code}"}]""".toRequestBody( RequestBodyTypes.JSON.toMediaTypeOrNull() ) - val json = - app.post("$apiUrl/media/bathGetplayInfo", requestBody = body, headers = headers) - .parsedSafe()?.data?.firstOrNull() + val json = app.get( + "$apiUrl/media/previewInfo?category=${res.category}&contentId=${res.id}&episodeId=${res.epId}&definition=${video.code}", + headers = headers, + ).parsedSafe()?.data callback.invoke( ExtractorLink( this.name, @@ -337,7 +338,7 @@ class Loklok : MainAPI() { ) data class PreviewResponse( - @JsonProperty("data") val data: ArrayList? = arrayListOf(), + @JsonProperty("data") val data: PreviewVideos? = null, ) data class PreviewVideos( diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt b/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt index 4f4fc869..1809ec85 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt @@ -847,6 +847,7 @@ object SoraExtractor : SoraStream() { year: Int? = null, season: Int? = null, episode: Int? = null, + lastSeason: Int? = null, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit ) { @@ -858,7 +859,7 @@ object SoraExtractor : SoraStream() { "$fixTitle", true ) == true && it.releaseDate?.equals("$year") == true && it.type == "Movie" } else { - it.title?.equals("$fixTitle", true) == true && it.type == "TV Series" + it.title?.equals("$fixTitle", true) == true && it.type == "TV Series" && it.season == lastSeason } }?.id ?: return @@ -2780,6 +2781,7 @@ data class CrunchyrollDetails( data class ConsumetResults( @JsonProperty("id") val id: String? = null, @JsonProperty("title") val title: String? = null, + @JsonProperty("season") val season: Int? = null, @JsonProperty("releaseDate") val releaseDate: String? = null, @JsonProperty("type") val type: String? = null, ) diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt b/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt index ce325b5c..9d77cee2 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt @@ -471,6 +471,7 @@ open class SoraStream : TmdbProvider() { res.year, res.season, res.episode, + res.lastSeason, subtitleCallback, callback ) diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraStreamLite.kt b/SoraStream/src/main/kotlin/com/hexated/SoraStreamLite.kt index f11fe178..5af1dcb6 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraStreamLite.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraStreamLite.kt @@ -172,6 +172,7 @@ class SoraStreamLite : SoraStream() { res.year, res.season, res.episode, + res.lastSeason, subtitleCallback, callback )