80 lines
2.4 KiB
Kotlin
80 lines
2.4 KiB
Kotlin
package com.hexated
|
|
|
|
import com.lagradost.cloudstream3.SubtitleFile
|
|
import com.lagradost.cloudstream3.*
|
|
import com.lagradost.cloudstream3.utils.*
|
|
|
|
open class Qiwi : ExtractorApi() {
|
|
override val name = "Qiwi"
|
|
override val mainUrl = "https://qiwi.gg"
|
|
override val requiresReferer = true
|
|
|
|
override suspend fun getUrl(
|
|
url: String,
|
|
referer: String?,
|
|
subtitleCallback: (SubtitleFile) -> Unit,
|
|
callback: (ExtractorLink) -> Unit
|
|
) {
|
|
val document = app.get(url, referer = referer).document
|
|
val title = document.select("title").text()
|
|
val source = document.select("video source").attr("src")
|
|
|
|
callback.invoke(
|
|
ExtractorLink(
|
|
this.name,
|
|
this.name,
|
|
source,
|
|
"$mainUrl/",
|
|
getIndexQuality(title),
|
|
headers = mapOf(
|
|
"Accept" to "video/webm,video/ogg,video/*;q=0.9,application/ogg;q=0.7,audio/*;q=0.6,*/*;q=0.5",
|
|
"Range" to "bytes=0-",
|
|
"Sec-Fetch-Dest" to "video",
|
|
"Sec-Fetch-Mode" to "no-cors",
|
|
)
|
|
)
|
|
)
|
|
|
|
}
|
|
|
|
private fun getIndexQuality(str: String): Int {
|
|
return Regex("(\\d{3,4})[pP]").find(str)?.groupValues?.getOrNull(1)?.toIntOrNull()
|
|
?: Qualities.Unknown.value
|
|
}
|
|
|
|
}
|
|
|
|
open class Mediafire : ExtractorApi() {
|
|
override val name = "Mediafire"
|
|
override val mainUrl = "https://www.mediafire.com"
|
|
override val requiresReferer = true
|
|
|
|
override suspend fun getUrl(
|
|
url: String,
|
|
referer: String?,
|
|
subtitleCallback: (SubtitleFile) -> Unit,
|
|
callback: (ExtractorLink) -> Unit
|
|
) {
|
|
val res = app.get(url, referer = referer).document
|
|
val title = res.select("div.dl-btn-label").text()
|
|
val video = res.selectFirst("a#downloadButton")?.attr("href")
|
|
|
|
callback.invoke(
|
|
ExtractorLink(
|
|
this.name,
|
|
this.name,
|
|
video ?: return,
|
|
"",
|
|
getQuality(title),
|
|
INFER_TYPE
|
|
)
|
|
)
|
|
|
|
}
|
|
|
|
private fun getQuality(str: String?): Int {
|
|
return Regex("(\\d{3,4})[pP]").find(str ?: "")?.groupValues?.getOrNull(1)?.toIntOrNull()
|
|
?: Qualities.Unknown.value
|
|
}
|
|
|
|
} |