small fix

This commit is contained in:
hexated 2022-10-19 02:03:40 +07:00
parent 507068832d
commit e1bb903716
3 changed files with 5 additions and 33 deletions

View file

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

View file

@ -3,8 +3,6 @@ package com.hexated
import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addActors import com.lagradost.cloudstream3.LoadResponse.Companion.addActors
import com.lagradost.cloudstream3.utils.* import com.lagradost.cloudstream3.utils.*
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
import com.lagradost.cloudstream3.utils.AppUtils.toJson
import org.jsoup.nodes.Element import org.jsoup.nodes.Element
import java.util.* import java.util.*
@ -52,8 +50,7 @@ class GoodPorn : MainAPI() {
val title = this.selectFirst("strong.title")?.text() ?: return null val title = this.selectFirst("strong.title")?.text() ?: return null
val href = fixUrl(this.selectFirst("a")!!.attr("href")) val href = fixUrl(this.selectFirst("a")!!.attr("href"))
val posterUrl = fixUrlNull(this.select("div.img > img").attr("data-original")) val posterUrl = fixUrlNull(this.select("div.img > img").attr("data-original"))
val previewUrl = fixUrlNull(this.select("div.img > img").attr("data-preview")) return newMovieSearchResponse(title, href, TvType.Movie) {
return newMovieSearchResponse(title, LoadData(href, previewUrl).toJson(), TvType.Movie) {
this.posterUrl = posterUrl this.posterUrl = posterUrl
} }
@ -79,8 +76,7 @@ class GoodPorn : MainAPI() {
} }
override suspend fun load(url: String): LoadResponse { override suspend fun load(url: String): LoadResponse {
val res = parseJson<LoadData>(url) val document = app.get(url).document
val document = app.get(res.url.toString()).document
val title = document.selectFirst("div.headline > h1")?.text()?.trim().toString() val title = document.selectFirst("div.headline > h1")?.text()?.trim().toString()
val poster = val poster =
@ -93,19 +89,12 @@ class GoodPorn : MainAPI() {
it.toSearchResult() it.toSearchResult()
} }
return newMovieLoadResponse(title, url, TvType.NSFW, LoadData(res.url, res.trailer).toJson()) { return newMovieLoadResponse(title, url, TvType.NSFW, url) {
this.posterUrl = poster this.posterUrl = poster
this.plot = description this.plot = description
this.tags = tags this.tags = tags
addActors(actors) addActors(actors)
this.recommendations = recommendations this.recommendations = recommendations
this.trailers = mutableListOf(
TrailerData(
res.trailer.toString(),
referer = "$mainUrl/",
raw = true
)
)
} }
} }
@ -115,8 +104,7 @@ class GoodPorn : MainAPI() {
subtitleCallback: (SubtitleFile) -> Unit, subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit callback: (ExtractorLink) -> Unit
): Boolean { ): Boolean {
val res = parseJson<LoadData>(data) val document = app.get(data).document
val document = app.get(res.url.toString()).document
document.select("div.info div:last-child a").map { res -> document.select("div.info div:last-child a").map { res ->
callback.invoke( callback.invoke(
ExtractorLink( ExtractorLink(
@ -132,22 +120,7 @@ class GoodPorn : MainAPI() {
) )
} }
callback.invoke(
ExtractorLink(
"Preview",
"Preview",
res.trailer.toString(),
referer = data,
quality = Qualities.Unknown.value,
headers = mapOf("Range" to "bytes=0-"),
)
)
return true return true
} }
data class LoadData(
val url: String? = null,
val trailer: String? = null,
)
} }

View file

@ -2,7 +2,6 @@ package com.hexated
import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.extractors.XStreamCdn
import com.lagradost.cloudstream3.network.WebViewResolver import com.lagradost.cloudstream3.network.WebViewResolver
import com.lagradost.cloudstream3.utils.* import com.lagradost.cloudstream3.utils.*
import com.lagradost.nicehttp.requestCreator import com.lagradost.nicehttp.requestCreator