From 51d8c748807c9e780c03837947a9ed7755bc8fe7 Mon Sep 17 00:00:00 2001 From: lisa Date: Sat, 23 Dec 2023 09:41:12 +0700 Subject: [PATCH] small fix --- .../main/kotlin/com/hexated/SoraExtractor.kt | 33 ++++++++++++++----- .../src/main/kotlin/com/hexated/SoraParser.kt | 6 ++++ .../src/main/kotlin/com/hexated/SoraStream.kt | 1 + .../main/kotlin/com/hexated/SoraStreamLite.kt | 1 + 4 files changed, 33 insertions(+), 8 deletions(-) diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt b/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt index 8c4853af5..2af0cbe1b 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt @@ -2269,9 +2269,11 @@ object SoraExtractor : SoraStream() { title: String? = null, year: Int? = null, season: Int? = null, + lastSeason: Int? = null, episode: Int? = null, callback: (ExtractorLink) -> Unit, ) { + val showboxApi = "https://www.showbox.media" val (seasonSlug, episodeSlug) = getEpisodeSlug(season, episode) @@ -2281,16 +2283,31 @@ object SoraExtractor : SoraStream() { ), headers = mapOf("X-Requested-With" to "XMLHttpRequest") ).parsed().let { Jsoup.parse(it) } - val mediaId = res.select("a.nav-item").find { - it.select("h3.film-name").text() - .equals(title, true) && it.select("div.film-infor > span:first-child").text() - .contains(if (season == null) "$year" else "SS") && it.select("div.film-infor > span:last-child") - .text() - .equals(if (season == null) "Movie" else "TV") - }?.attr("href")?.substringAfterLast("/") + val mediaRes = res.select("a.nav-item").map { + ShowboxMedia( + it.attr("href"), + it.select("h3.film-name").text(), + it.select("div.film-infor > span:first-child").text(), + it.select("div.film-infor > span:last-child").text(), + ) + } + + val media = mediaRes.find { + it.title.equals( + title, + true + ) && it.infor == if (season == null) "$year" else "SS $lastSeason" && it.type == if (season == null) "Movie" else "TV" + } ?: mediaRes.find { + it.title.equals( + title, + true + ) && it.infor.contains(if (season == null) "$year" else "SS") && it.type == if (season == null) "Movie" else "TV" + } + + val shareId = media?.url?.substringAfterLast("/") ?: return val shareKey = - app.get("$showboxApi/index/share_link?id=${mediaId ?: return}&type=${if (season == null) "1" else "2"}") + app.get("$showboxApi/index/share_link?id=${shareId}&type=${if (season == null) "1" else "2"}") .parsedSafe()?.data?.link?.substringAfterLast("/") val headers = mapOf("Accept-Language" to "en") diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraParser.kt b/SoraStream/src/main/kotlin/com/hexated/SoraParser.kt index 01ebad4ab..938462bc4 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraParser.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraParser.kt @@ -2,6 +2,12 @@ package com.hexated import com.fasterxml.jackson.annotation.JsonProperty +data class ShowboxMedia( + val url: String, + val title: String, + val infor: String, + val type: String, +) data class FDMovieIFrame( val link: String, val quality: String, diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt b/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt index 0477026dc..379a47e06 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt @@ -366,6 +366,7 @@ open class SoraStream : TmdbProvider() { res.title, res.year, res.season, + res.lastSeason, res.episode, callback ) diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraStreamLite.kt b/SoraStream/src/main/kotlin/com/hexated/SoraStreamLite.kt index 5e5afe20e..22f27b3aa 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraStreamLite.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraStreamLite.kt @@ -57,6 +57,7 @@ class SoraStreamLite : SoraStream() { res.title, res.year, res.season, + res.lastSeason, res.episode, callback )