Skip to content

Commit

Permalink
small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jackjohn committed Dec 9, 2023
1 parent 9b05f65 commit d89a7cf
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions Movierulzhd/src/main/kotlin/com/hexated/Movierulzhd.kt
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ open class Movierulzhd : MainAPI() {
referer = data,
headers = mapOf("X-Requested-With" to "XMLHttpRequest")
).parsed<ResponseHash>().embed_url
if (!source.contains("youtube")) loadExtractor(source, "$directUrl/", subtitleCallback, callback)
if (!source.contains("youtube")) loadCustomExtractor(source, "$directUrl/", subtitleCallback, callback)
} else {
var document = app.get(data).document
if (document.select("title").text() == "Just a moment...") {
Expand All @@ -257,7 +257,7 @@ open class Movierulzhd : MainAPI() {
).parsed<ResponseHash>().embed_url

when {
!source.contains("youtube") -> loadExtractor(
!source.contains("youtube") -> loadCustomExtractor(
source,
"$directUrl/",
subtitleCallback,
Expand All @@ -279,6 +279,34 @@ open class Movierulzhd : MainAPI() {
}
}

private suspend fun loadCustomExtractor(
url: String,
referer: String? = null,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit,
quality: Int? = null,
) {
loadExtractor(url, referer, subtitleCallback) { link ->
if(link.quality == Qualities.Unknown.value) {
callback.invoke(
ExtractorLink(
link.source,
link.name,
link.url,
link.referer,
when (link.type) {
ExtractorLinkType.M3U8 -> link.quality
else -> quality ?: link.quality
},
link.type,
link.headers,
link.extractorData
)
)
}
}
}

data class LinkData(
val tag: String? = null,
val type: String? = null,
Expand Down

0 comments on commit d89a7cf

Please sign in to comment.