small fixed Movierulzhd

This commit is contained in:
hexated 2022-09-13 14:01:23 +07:00
parent d20842a0e3
commit 781616b1f7
2 changed files with 9 additions and 13 deletions

View file

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

View file

@ -5,11 +5,8 @@ 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.WebViewResolver
import com.lagradost.cloudstream3.utils.* import com.lagradost.cloudstream3.utils.*
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
import org.jsoup.nodes.Element import org.jsoup.nodes.Element
import java.net.URI
class Movierulzhd : MainAPI() { class Movierulzhd : MainAPI() {
override var mainUrl = "https://movierulzhd.run" override var mainUrl = "https://movierulzhd.run"
@ -43,15 +40,15 @@ class Movierulzhd : MainAPI() {
private fun getProperLink(uri: String): String { private fun getProperLink(uri: String): String {
return when { return when {
uri.contains("/episode/") -> { uri.contains("/episodes/") -> {
var title = uri.substringAfter("$mainUrl/episode/") var title = uri.substringAfter("$mainUrl/episodes/")
title = Regex("(.+?)-season").find(title)?.groupValues?.get(1).toString() title = Regex("(.+?)-season").find(title)?.groupValues?.get(1).toString()
"$mainUrl/tvseries/$title" "$mainUrl/tvshows/$title"
} }
uri.contains("/season/") -> { uri.contains("/seasons/") -> {
var title = uri.substringAfter("$mainUrl/season/") var title = uri.substringAfter("$mainUrl/seasons/")
title = Regex("(.+?)-season").find(title)?.groupValues?.get(1).toString() title = Regex("(.+?)-season").find(title)?.groupValues?.get(1).toString()
"$mainUrl/tvseries/$title" "$mainUrl/tvshows/$title"
} }
else -> { else -> {
uri uri
@ -61,7 +58,7 @@ class Movierulzhd : MainAPI() {
private fun Element.toSearchResult(): SearchResponse? { private fun Element.toSearchResult(): SearchResponse? {
val title = this.selectFirst("h3 > a")?.text() ?: return null val title = this.selectFirst("h3 > a")?.text() ?: return null
val href = fixUrl(this.selectFirst("h3 > a")!!.attr("href")) val href = getProperLink(fixUrl(this.selectFirst("h3 > a")!!.attr("href")))
val posterUrl = fixUrlNull(this.select("div.poster > img").attr("src")) val posterUrl = fixUrlNull(this.select("div.poster > img").attr("src"))
val quality = getQualityFromString(this.select("span.quality").text()) val quality = getQualityFromString(this.select("span.quality").text())
return newMovieSearchResponse(title, href, TvType.Movie) { return newMovieSearchResponse(title, href, TvType.Movie) {
@ -161,7 +158,6 @@ class Movierulzhd : MainAPI() {
private suspend fun invokeSbflix( private suspend fun invokeSbflix(
url: String, url: String,
callback: (ExtractorLink) -> Unit, callback: (ExtractorLink) -> Unit,
subtitleCallback: (SubtitleFile) -> Unit,
) { ) {
val mainUrl = "https://sbflix.xyz" val mainUrl = "https://sbflix.xyz"
val name = "Sbflix" val name = "Sbflix"
@ -218,7 +214,7 @@ class Movierulzhd : MainAPI() {
when { when {
source.startsWith("https://sbflix.xyz") -> { source.startsWith("https://sbflix.xyz") -> {
invokeSbflix(source, callback, subtitleCallback) invokeSbflix(source, callback)
} }
// source.startsWith("https://series.databasegdriveplayer.co") -> { // source.startsWith("https://series.databasegdriveplayer.co") -> {
// invokeDatabase(source, callback, subtitleCallback) // invokeDatabase(source, callback, subtitleCallback)