From 3ba228c881e5885d9c66b80aa28c1b05a9fc7bd6 Mon Sep 17 00:00:00 2001 From: hexated Date: Tue, 6 Sep 2022 02:44:51 +0700 Subject: [PATCH] fixed PhimmoichillProvider --- PhimmoichillProvider/build.gradle.kts | 4 +-- .../com/lagradost/PhimmoichillProvider.kt | 29 +++++++++---------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/PhimmoichillProvider/build.gradle.kts b/PhimmoichillProvider/build.gradle.kts index 84621af..4eee292 100644 --- a/PhimmoichillProvider/build.gradle.kts +++ b/PhimmoichillProvider/build.gradle.kts @@ -1,5 +1,5 @@ // use an integer for version numbers -version = 1 +version = 2 cloudstream { @@ -7,7 +7,7 @@ cloudstream { // All of these properties are optional, you can safely remove them // description = "Lorem Ipsum" - // authors = listOf("Cloudburst") + authors = listOf("Hexated") /** * Status int as the following: diff --git a/PhimmoichillProvider/src/main/kotlin/com/lagradost/PhimmoichillProvider.kt b/PhimmoichillProvider/src/main/kotlin/com/lagradost/PhimmoichillProvider.kt index 1f53fc7..2aed816 100644 --- a/PhimmoichillProvider/src/main/kotlin/com/lagradost/PhimmoichillProvider.kt +++ b/PhimmoichillProvider/src/main/kotlin/com/lagradost/PhimmoichillProvider.kt @@ -8,7 +8,6 @@ import com.lagradost.cloudstream3.mvvm.safeApiCall import com.lagradost.cloudstream3.utils.* import org.jsoup.nodes.Element import java.net.URLDecoder -import java.util.ArrayList class PhimmoichillProvider : MainAPI() { override var mainUrl = "https://phimmoichill.net" @@ -97,7 +96,9 @@ class PhimmoichillProvider : MainAPI() { document.select("ul.entry-meta.block-film li:nth-child(7) span").text().toRatingInt() val actors = document.select("ul.entry-meta.block-film li:last-child a").map { it.text() } val recommendations = document.select("ul#list-film-realted li.item").map { - it.toSearchResult() + it.toSearchResult().apply { + this.posterUrl = decode(it.selectFirst("img")!!.attr("data-src").substringAfter("url=")) + } } return if (tvType == TvType.TvSeries) { @@ -145,24 +146,21 @@ class PhimmoichillProvider : MainAPI() { ): Boolean { val document = app.get(data).document - val key = document.select("div#content script").mapNotNull { script -> - if (script.data().contains("filmInfo.episodeID =")) { - val id = script.data().substringAfter("filmInfo.episodeID = parseInt('") - .substringBefore("');") + val key = document.select("div#content script") + .find { it.data().contains("filmInfo.episodeID =") }?.data()?.let { script -> + val id = script.substringAfter("filmInfo.episodeID = parseInt('") app.post( // Not mainUrl url = "https://phimmoichills.net/pmplayer.php", - data = mapOf("qcao" to id), + data = mapOf("qcao" to id, "sv" to "0"), referer = data, headers = mapOf( "X-Requested-With" to "XMLHttpRequest", "Content-Type" to "application/x-www-form-urlencoded; charset=UTF-8" ) - ).text.also { println("HERERERR $it") }.substringAfterLast("iniPlayers(\"").substringBefore("\",") - } else { - null + ).text.substringAfterLast("iniPlayers(\"") + .substringBefore("\",") } - }.first() listOf( Pair("https://so-trym.topphimmoi.org/hlspm/$key", "PMFAST"), @@ -197,10 +195,11 @@ class PhimmoichillProvider : MainAPI() { playList ?: return@safeApiCall, referer = "$mainUrl/", quality = Qualities.P1080.value, - headers = mapOf( -// "If-None-Match" to "*", - "Origin" to mainUrl, - ) + headers = if (source == "PMHLS") { + mapOf("Origin" to mainUrl) + } else { + mapOf() + } ) ) }