fix: StreamBlasters

This commit is contained in:
darkdemon 2022-10-09 02:00:40 +05:30
parent 01273fae57
commit 6bfff101ca

View file

@ -7,10 +7,11 @@ import com.lagradost.cloudstream3.LoadResponse.Companion.addActors
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
import com.lagradost.cloudstream3.mvvm.safeApiCall import com.lagradost.cloudstream3.mvvm.safeApiCall
import com.lagradost.cloudstream3.utils.* import com.lagradost.cloudstream3.utils.*
import org.jsoup.Jsoup
import org.jsoup.nodes.Element import org.jsoup.nodes.Element
class StreamBlastersProvider : MainAPI() { // all providers must be an instance of MainAPI class StreamBlastersProvider : MainAPI() { // all providers must be an instance of MainAPI
override var mainUrl = "https://streamblasters.lol" override var mainUrl = "https://streamblasters.pics"
override var name = "StreamBlasters" override var name = "StreamBlasters"
override val hasMainPage = true override val hasMainPage = true
override var lang = "hi" override var lang = "hi"
@ -56,7 +57,7 @@ class StreamBlastersProvider : MainAPI() { // all providers must be an instance
val document = app.get("$mainUrl/?s=$query").document val document = app.get("$mainUrl/?s=$query").document
return document.select(".result-item").mapNotNull { return document.select(".result-item").mapNotNull {
val title = it.select(".title a")?.text()?.trim() ?: return@mapNotNull null val title = it.select(".title a").text().trim()
val href = fixUrl(it.selectFirst(".title a")?.attr("href").toString()) val href = fixUrl(it.selectFirst(".title a")?.attr("href").toString())
val posterUrl = fixUrlNull(it.selectFirst(".thumbnail img")?.attr("src")) val posterUrl = fixUrlNull(it.selectFirst(".thumbnail img")?.attr("src"))
val quality = getQualityFromString(it.select("span.quality").text()) val quality = getQualityFromString(it.select("span.quality").text())
@ -140,7 +141,7 @@ class StreamBlastersProvider : MainAPI() { // all providers must be an instance
it.attr("data-nume") it.attr("data-nume")
}.apmap { nume -> }.apmap { nume ->
safeApiCall { safeApiCall {
val source = app.post( val response = app.post(
url = "$mainUrl/wp-admin/admin-ajax.php", url = "$mainUrl/wp-admin/admin-ajax.php",
data = mapOf( data = mapOf(
"action" to "doo_player_ajax", "action" to "doo_player_ajax",
@ -151,8 +152,8 @@ class StreamBlastersProvider : MainAPI() { // all providers must be an instance
referer = data, referer = data,
headers = mapOf("X-Requested-With" to "XMLHttpRequest") headers = mapOf("X-Requested-With" to "XMLHttpRequest")
).parsed<ResponseHash>().embed_url ).parsed<ResponseHash>().embed_url
val source = Jsoup.parse(response).select("iframe").attr("src")
loadExtractor(source, data, subtitleCallback, callback) loadExtractor(httpsify(source), data, subtitleCallback, callback)
} }
} }
return true return true