small fix

This commit is contained in:
hexated 2022-10-19 02:03:40 +07:00
parent 70114b4306
commit 1d2c85998b
3 changed files with 5 additions and 33 deletions

View file

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

View file

@ -3,8 +3,6 @@ package com.hexated
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addActors
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 java.util.*
@ -52,8 +50,7 @@ class GoodPorn : MainAPI() {
val title = this.selectFirst("strong.title")?.text() ?: return null
val href = fixUrl(this.selectFirst("a")!!.attr("href"))
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, LoadData(href, previewUrl).toJson(), TvType.Movie) {
return newMovieSearchResponse(title, href, TvType.Movie) {
this.posterUrl = posterUrl
}
@ -79,8 +76,7 @@ class GoodPorn : MainAPI() {
}
override suspend fun load(url: String): LoadResponse {
val res = parseJson<LoadData>(url)
val document = app.get(res.url.toString()).document
val document = app.get(url).document
val title = document.selectFirst("div.headline > h1")?.text()?.trim().toString()
val poster =
@ -93,19 +89,12 @@ class GoodPorn : MainAPI() {
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.plot = description
this.tags = tags
addActors(actors)
this.recommendations = recommendations
this.trailers = mutableListOf(
TrailerData(
res.trailer.toString(),
referer = "$mainUrl/",
raw = true
)
)
}
}
@ -115,8 +104,7 @@ class GoodPorn : MainAPI() {
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
): Boolean {
val res = parseJson<LoadData>(data)
val document = app.get(res.url.toString()).document
val document = app.get(data).document
document.select("div.info div:last-child a").map { res ->
callback.invoke(
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
}
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.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.extractors.XStreamCdn
import com.lagradost.cloudstream3.network.WebViewResolver
import com.lagradost.cloudstream3.utils.*
import com.lagradost.nicehttp.requestCreator