mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
fixed #295
This commit is contained in:
parent
207f8359c2
commit
f4f5ee5f5b
9 changed files with 184 additions and 33 deletions
|
@ -1,7 +1,7 @@
|
|||
import org.jetbrains.kotlin.konan.properties.Properties
|
||||
|
||||
// use an integer for version numbers
|
||||
version = 15
|
||||
version = 16
|
||||
|
||||
android {
|
||||
defaultConfig {
|
||||
|
|
|
@ -1,6 +1,14 @@
|
|||
package com.hexated
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.lagradost.cloudstream3.ErrorLoadingException
|
||||
import com.lagradost.cloudstream3.SubtitleFile
|
||||
import com.lagradost.cloudstream3.app
|
||||
import com.lagradost.cloudstream3.extractors.*
|
||||
import com.lagradost.cloudstream3.extractors.helper.AesHelper
|
||||
import com.lagradost.cloudstream3.utils.AppUtils
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.M3u8Helper
|
||||
|
||||
class Doods : DoodLaExtractor() {
|
||||
override var name = "Doods"
|
||||
|
@ -34,4 +42,61 @@ class Likessb : StreamSB() {
|
|||
|
||||
class DbGdriveplayer : Gdriveplayer() {
|
||||
override var mainUrl = "https://database.gdriveplayer.us"
|
||||
}
|
||||
|
||||
class NineTv {
|
||||
|
||||
companion object {
|
||||
private const val key = "B#8G4o2\$WWFz"
|
||||
suspend fun getUrl(
|
||||
url: String,
|
||||
referer: String?,
|
||||
subtitleCallback: (SubtitleFile) -> Unit,
|
||||
callback: (ExtractorLink) -> Unit
|
||||
) {
|
||||
val mainUrl = getBaseUrl(url)
|
||||
val master = Regex("MasterJS\\s*=\\s*'([^']+)").find(
|
||||
app.get(
|
||||
url,
|
||||
referer = referer
|
||||
).text
|
||||
)?.groupValues?.get(1)
|
||||
val decrypt = AesHelper.cryptoAESHandler(master ?: return, key.toByteArray(), false)
|
||||
?.replace("\\", "") ?: throw ErrorLoadingException("failed to decrypt")
|
||||
|
||||
val name = url.getHost()
|
||||
val source = Regex(""""?file"?:\s*"([^"]+)""").find(decrypt)?.groupValues?.get(1)
|
||||
val tracks = Regex("""tracks:\s*\[(.+)]""").find(decrypt)?.groupValues?.get(1)
|
||||
|
||||
M3u8Helper.generateM3u8(
|
||||
name,
|
||||
source ?: return,
|
||||
"$mainUrl/",
|
||||
headers = mapOf(
|
||||
"Accept" to "*/*",
|
||||
"Connection" to "keep-alive",
|
||||
"Sec-Fetch-Dest" to "empty",
|
||||
"Sec-Fetch-Mode" to "cors",
|
||||
"Sec-Fetch-Site" to "cross-site",
|
||||
"Origin" to mainUrl,
|
||||
)
|
||||
).forEach(callback)
|
||||
|
||||
AppUtils.tryParseJson<List<Tracks>>("[$tracks]")
|
||||
?.filter { it.kind == "captions" }?.map { track ->
|
||||
subtitleCallback.invoke(
|
||||
SubtitleFile(
|
||||
track.label ?: "",
|
||||
track.file ?: return@map null
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data class Tracks(
|
||||
@JsonProperty("file") val file: String? = null,
|
||||
@JsonProperty("label") val label: String? = null,
|
||||
@JsonProperty("kind") val kind: String? = null,
|
||||
)
|
||||
}
|
|
@ -21,6 +21,8 @@ open class Gomov : MainAPI() {
|
|||
TvType.AsianDrama
|
||||
)
|
||||
|
||||
val sources = arrayOf("https://chillx.top", "https://watchx.top", "https://bestx.stream")
|
||||
|
||||
override val mainPage = mainPageOf(
|
||||
"page/%d/?s&search=advanced&post_type=movie" to "Movies",
|
||||
"category/western-series/page/%d/" to "Western Series",
|
||||
|
@ -154,19 +156,31 @@ open class Gomov : MainAPI() {
|
|||
val id = document.selectFirst("div#muvipro_player_content_id")?.attr("data-id")
|
||||
|
||||
if(id.isNullOrEmpty()) {
|
||||
document.select("ul.muvipro-player-tabs li a").apmap {
|
||||
val iframe = app.get(fixUrl(it.attr("href"))).document.selectFirst("div.gmr-embed-responsive iframe")
|
||||
?.attr("src")
|
||||
loadExtractor(httpsify(iframe ?: return@apmap ), "$directUrl/", subtitleCallback, callback)
|
||||
document.select("ul.muvipro-player-tabs li a").apmap { ele ->
|
||||
val iframe = app.get(fixUrl(ele.attr("href"))).document.selectFirst("div.gmr-embed-responsive iframe")
|
||||
?.attr("src")?.let { httpsify(it) } ?: return@apmap
|
||||
|
||||
when {
|
||||
sources.any { iframe.startsWith(it) } -> NineTv.getUrl(iframe, "$directUrl/", subtitleCallback, callback)
|
||||
else -> {
|
||||
loadExtractor(iframe, "$directUrl/", subtitleCallback, callback)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
document.select("div.tab-content-ajax").apmap {
|
||||
document.select("div.tab-content-ajax").apmap { ele ->
|
||||
val server = app.post(
|
||||
"$directUrl/wp-admin/admin-ajax.php",
|
||||
data = mapOf("action" to "muvipro_player_content", "tab" to it.attr("id"), "post_id" to "$id")
|
||||
).document.select("iframe").attr("src")
|
||||
data = mapOf("action" to "muvipro_player_content", "tab" to ele.attr("id"), "post_id" to "$id")
|
||||
).document.select("iframe").attr("src").let { httpsify(it) }
|
||||
|
||||
when {
|
||||
sources.any { server.startsWith(it) } -> NineTv.getUrl(server, "$directUrl/", subtitleCallback, callback)
|
||||
else -> {
|
||||
loadExtractor(server, "$directUrl/", subtitleCallback, callback)
|
||||
}
|
||||
}
|
||||
|
||||
loadExtractor(httpsify(server), "$directUrl/", subtitleCallback, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -174,17 +188,21 @@ open class Gomov : MainAPI() {
|
|||
|
||||
}
|
||||
|
||||
private fun String?.fixImageQuality(): String? {
|
||||
if(this == null) return null
|
||||
val regex = Regex("(-\\d*x\\d*)").find(this)?.groupValues
|
||||
if(regex?.isEmpty() == true) return this
|
||||
return this.replace(regex?.get(0) ?: return null, "")
|
||||
}
|
||||
}
|
||||
|
||||
private fun getBaseUrl(url: String): String {
|
||||
return URI(url).let {
|
||||
"${it.scheme}://${it.host}"
|
||||
}
|
||||
}
|
||||
fun String?.fixImageQuality(): String? {
|
||||
if(this == null) return null
|
||||
val regex = Regex("(-\\d*x\\d*)").find(this)?.groupValues
|
||||
if(regex?.isEmpty() == true) return this
|
||||
return this.replace(regex?.get(0) ?: return null, "")
|
||||
}
|
||||
|
||||
fun getBaseUrl(url: String): String {
|
||||
return URI(url).let {
|
||||
"${it.scheme}://${it.host}"
|
||||
}
|
||||
}
|
||||
|
||||
fun String.getHost(): String {
|
||||
return fixTitle(URI(this).host.substringBeforeLast(".").substringAfterLast("."))
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue