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 } }