Skip to content

Commit

Permalink
small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lisa committed Dec 23, 2023
1 parent 211c58b commit 51d8c74
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 8 deletions.
33 changes: 25 additions & 8 deletions SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -2281,16 +2283,31 @@ object SoraExtractor : SoraStream() {
), headers = mapOf("X-Requested-With" to "XMLHttpRequest")
).parsed<String>().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<FebboxResponse>()?.data?.link?.substringAfterLast("/")

val headers = mapOf("Accept-Language" to "en")
Expand Down
6 changes: 6 additions & 0 deletions SoraStream/src/main/kotlin/com/hexated/SoraParser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions SoraStream/src/main/kotlin/com/hexated/SoraStream.kt
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ open class SoraStream : TmdbProvider() {
res.title,
res.year,
res.season,
res.lastSeason,
res.episode,
callback
)
Expand Down
1 change: 1 addition & 0 deletions SoraStream/src/main/kotlin/com/hexated/SoraStreamLite.kt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class SoraStreamLite : SoraStream() {
res.title,
res.year,
res.season,
res.lastSeason,
res.episode,
callback
)
Expand Down

0 comments on commit 51d8c74

Please sign in to comment.