package com.lagradost.cloudstream3.extractors import com.lagradost.cloudstream3.app import com.lagradost.cloudstream3.utils.ExtractorApi import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.JsUnpacker import com.lagradost.cloudstream3.utils.Qualities import java.net.URI open class Streamhub : ExtractorApi() { override var mainUrl = "https://streamhub.to" override var name = "Streamhub" override val requiresReferer = false override fun getExtractorUrl(id: String): String { return "$mainUrl/e/$id" } override suspend fun getUrl(url: String, referer: String?): List? { val response = app.get(url).text Regex("eval((.|\\n)*?)").find(response)?.groupValues?.get(1)?.let { jsEval -> JsUnpacker("eval$jsEval").unpack()?.let { unPacked -> Regex("sources:\\[\\{src:\"(.*?)\"").find(unPacked)?.groupValues?.get(1)?.let { link -> return listOf( ExtractorLink( this.name, this.name, link, referer ?: "", Qualities.Unknown.value, URI(link).path.endsWith(".m3u8") ) ) } } } return null } }