fixed Loklok image also added CloudflareKiller to Movierulzhd

This commit is contained in:
hexated 2022-09-15 16:28:36 +07:00
parent 454c93fd88
commit a1bc324f36
5 changed files with 16 additions and 8 deletions

View file

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 1 version = 2
cloudstream { cloudstream {

View file

@ -8,6 +8,7 @@ import com.lagradost.cloudstream3.utils.AppUtils.toJson
import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.SubtitleHelper import com.lagradost.cloudstream3.utils.SubtitleHelper
import com.lagradost.cloudstream3.utils.getQualityFromName import com.lagradost.cloudstream3.utils.getQualityFromName
import kotlinx.coroutines.delay
class Loklok : MainAPI() { class Loklok : MainAPI() {
override var name = "Loklok" override var name = "Loklok"
@ -36,11 +37,12 @@ class Loklok : MainAPI() {
private const val mainImageUrl = "https://images.weserv.nl" private const val mainImageUrl = "https://images.weserv.nl"
} }
private fun encode(input: String): String? = java.net.URLEncoder.encode(input, "utf-8") private fun encode(input: String): String = java.net.URLEncoder.encode(input, "utf-8").replace("+", "%20")
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse { override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
val home = ArrayList<HomePageList>() val home = ArrayList<HomePageList>()
for (i in 0..10) { for (i in 0..10) {
delay(500)
app.get("$apiUrl/homePage/getHome?page=$i", headers = headers) app.get("$apiUrl/homePage/getHome?page=$i", headers = headers)
.parsedSafe<Home>()?.data?.recommendItems .parsedSafe<Home>()?.data?.recommendItems
?.filterNot { it.homeSectionType == "BLOCK_GROUP" } ?.filterNot { it.homeSectionType == "BLOCK_GROUP" }

View file

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 5 version = 6
cloudstream { cloudstream {

View file

@ -5,11 +5,12 @@ import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addActors 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.network.CloudflareKiller
import com.lagradost.cloudstream3.utils.* import com.lagradost.cloudstream3.utils.*
import org.jsoup.nodes.Element import org.jsoup.nodes.Element
class Movierulzhd : MainAPI() { class Movierulzhd : MainAPI() {
override var mainUrl = "https://movierulzhd.run" override var mainUrl = "https://movierulzhd.biz"
override var name = "Movierulzhd" override var name = "Movierulzhd"
override val hasMainPage = true override val hasMainPage = true
override var lang = "hi" override var lang = "hi"
@ -27,11 +28,13 @@ class Movierulzhd : MainAPI() {
"$mainUrl/episodes/page/" to "Episode", "$mainUrl/episodes/page/" to "Episode",
) )
private val interceptor = CloudflareKiller()
override suspend fun getMainPage( override suspend fun getMainPage(
page: Int, page: Int,
request: MainPageRequest request: MainPageRequest
): HomePageResponse { ): HomePageResponse {
val document = app.get(request.data + page).document val document = app.get(request.data + page, interceptor = interceptor).document
val home = val home =
document.select("div.items.normal article, div#archive-content article").mapNotNull { document.select("div.items.normal article, div#archive-content article").mapNotNull {
it.toSearchResult() it.toSearchResult()
@ -71,7 +74,7 @@ class Movierulzhd : MainAPI() {
override suspend fun search(query: String): List<SearchResponse> { override suspend fun search(query: String): List<SearchResponse> {
val link = "$mainUrl/search/$query" val link = "$mainUrl/search/$query"
val document = app.get(link).document val document = app.get(link, interceptor = interceptor).document
return document.select("div.result-item").map { return document.select("div.result-item").map {
val title = val title =
@ -85,7 +88,7 @@ class Movierulzhd : MainAPI() {
} }
override suspend fun load(url: String): LoadResponse { override suspend fun load(url: String): LoadResponse {
val document = app.get(url).document val document = app.get(url, interceptor = interceptor).document
val title = val title =
document.selectFirst("div.data > h1")?.text()?.trim().toString() document.selectFirst("div.data > h1")?.text()?.trim().toString()
@ -200,7 +203,7 @@ class Movierulzhd : MainAPI() {
callback: (ExtractorLink) -> Unit callback: (ExtractorLink) -> Unit
): Boolean { ): Boolean {
val document = app.get(data).document val document = app.get(data, interceptor = interceptor).document
val id = document.select("meta#dooplay-ajax-counter").attr("data-postid") val id = document.select("meta#dooplay-ajax-counter").attr("data-postid")
val type = if (data.contains("/movies/")) "movie" else "tv" val type = if (data.contains("/movies/")) "movie" else "tv"

View file

@ -81,6 +81,9 @@ subprojects {
implementation("org.jsoup:jsoup:1.13.1") // html parser implementation("org.jsoup:jsoup:1.13.1") // html parser
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.13.1") implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.13.1")
implementation("io.karn:khttp-android:0.1.2") implementation("io.karn:khttp-android:0.1.2")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4") // html parser
//run JS
implementation("org.mozilla:rhino:1.7.14")
} }
} }