This commit is contained in:
jack 2023-12-12 02:08:18 +07:00
parent 408d91f5a5
commit 7142755991
5 changed files with 53 additions and 29 deletions

View File

@ -45,7 +45,7 @@ open class Gomov : MainAPI() {
private fun Element.toSearchResult(): SearchResponse? {
val title = this.selectFirst("h2.entry-title > a")?.text()?.trim() ?: return null
val href = fixUrl(this.selectFirst("a")!!.attr("href"))
val posterUrl = fixUrlNull(this.selectFirst("a > img").getImgAttr()).fixImageQuality()
val posterUrl = fixUrlNull(this.selectFirst("a > img")?.getImageAttr()).fixImageQuality()
val quality = this.select("div.gmr-qual, div.gmr-quality-item > a").text().trim().replace("-", "")
return if (quality.isEmpty()) {
val episode =
@ -66,7 +66,7 @@ open class Gomov : MainAPI() {
private fun Element.toRecommendResult(): SearchResponse? {
val title = this.selectFirst("a > span.idmuvi-rp-title")?.text()?.trim() ?: return null
val href = this.selectFirst("a")!!.attr("href")
val posterUrl = fixUrlNull(this.selectFirst("a > img").getImgAttr().fixImageQuality())
val posterUrl = fixUrlNull(this.selectFirst("a > img")?.getImageAttr().fixImageQuality())
return newMovieSearchResponse(title, href, TvType.Movie) {
this.posterUrl = posterUrl
}
@ -88,7 +88,7 @@ open class Gomov : MainAPI() {
document.selectFirst("h1.entry-title")?.text()?.substringBefore("Season")?.substringBefore("Episode")?.trim()
.toString()
val poster =
fixUrlNull(document.selectFirst("figure.pull-left > img").getImgAttr())?.fixImageQuality()
fixUrlNull(document.selectFirst("figure.pull-left > img")?.getImageAttr())?.fixImageQuality()
val tags = document.select("span.gmr-movie-genre:contains(Genre:) > a").map { it.text() }
val year =
@ -176,24 +176,29 @@ open class Gomov : MainAPI() {
}
private fun Element?.getImgAttr() : String? {
return this?.attr("data-src").takeIf { it?.isNotEmpty() == true } ?: this?.attr("src")
private fun Element.getImageAttr(): String? {
return when {
this.hasAttr("data-src") -> this.attr("abs:data-src")
this.hasAttr("data-lazy-src") -> this.attr("abs:data-lazy-src")
this.hasAttr("srcset") -> this.attr("abs:srcset").substringBefore(" ")
else -> this.attr("abs:src")
}
}
private fun Element?.getIframeAttr() : String? {
return this?.attr("data-litespeed-src").takeIf { it?.isNotEmpty() == true } ?: this?.attr("src")
}
}
fun String?.fixImageQuality(): String? {
if (this == null) return null
val regex = Regex("(-\\d*x\\d*)").find(this)?.groupValues?.get(0) ?: return this
return this.replace(regex, "")
}
fun getBaseUrl(url: String): String {
return URI(url).let {
"${it.scheme}://${it.host}"
private fun String?.fixImageQuality(): String? {
if (this == null) return null
val regex = Regex("(-\\d*x\\d*)").find(this)?.groupValues?.get(0) ?: return this
return this.replace(regex, "")
}
private fun getBaseUrl(url: String): String {
return URI(url).let {
"${it.scheme}://${it.host}"
}
}
}

View File

@ -68,7 +68,7 @@ open class Movierulzhd : MainAPI() {
private fun Element.toSearchResult(): SearchResponse? {
val title = this.selectFirst("h3 > a")?.text() ?: return null
val href = getProperLink(fixUrl(this.selectFirst("h3 > a")!!.attr("href")))
val posterUrl = fixUrlNull(this.select("div.poster img").last()?.imageFromElement())
val posterUrl = fixUrlNull(this.select("div.poster img").last()?.getImageAttr())
val quality = getQualityFromString(this.select("span.quality").text())
return newMovieSearchResponse(title, href, TvType.Movie) {
this.posterUrl = posterUrl
@ -96,7 +96,7 @@ open class Movierulzhd : MainAPI() {
directUrl = getBaseUrl(request.url)
val title =
document.selectFirst("div.data > h1")?.text()?.trim().toString()
val poster = fixUrlNull(document.selectFirst("div.poster img:last-child")?.imageFromElement())
val poster = fixUrlNull(document.selectFirst("div.poster img:last-child")?.getImageAttr())
val tags = document.select("div.sgeneros > a").map { it.text() }
val year = Regex(",\\s?(\\d+)").find(
@ -123,7 +123,7 @@ open class Movierulzhd : MainAPI() {
val recName =
it.selectFirst("a")!!.attr("href").toString().removeSuffix("/").split("/").last()
val recHref = it.selectFirst("a")!!.attr("href")
val recPosterUrl = it.selectFirst("img")?.imageFromElement()
val recPosterUrl = it.selectFirst("img")?.getImageAttr()
newTvSeriesSearchResponse(recName, recHref, TvType.TvSeries) {
this.posterUrl = recPosterUrl
}
@ -134,7 +134,7 @@ open class Movierulzhd : MainAPI() {
document.select("ul.episodios > li").map {
val href = it.select("a").attr("href")
val name = fixTitle(it.select("div.episodiotitle > a").text().trim())
val image = it.selectFirst("div.imagen > img")?.imageFromElement()
val image = it.selectFirst("div.imagen > img")?.getImageAttr()
val episode =
it.select("div.numerando").text().replace(" ", "").split("-").last()
.toIntOrNull()
@ -248,7 +248,7 @@ open class Movierulzhd : MainAPI() {
return true
}
private fun Element.imageFromElement(): String? {
private fun Element.getImageAttr(): String? {
return when {
this.hasAttr("data-src") -> this.attr("abs:data-src")
this.hasAttr("data-lazy-src") -> this.attr("abs:data-lazy-src")

View File

@ -1971,14 +1971,14 @@ object SoraExtractor : SoraStream() {
} else {
"$title Season $season"
}
val idCookies =
val savedCookies =
mapOf(
"advanced-frontendgomovies7" to "bjd4n0nnv4hlt4fj5cdjgbrne2",
"_identitygomovies7" to "52fdc70b008c0b1d881dac0f01cca819edd512de01cc8bbc1224ed4aafb78b52a:2:{i:0;s:18:\"_identitygomovies7\";i:1;s:52:\"[2050366,\"HnVRRAObTASOJEr45YyCM8wiHol0V1ko\",2592000]\";}"
"_identitygomovies7" to """52fdc70b008c0b1d881dac0f01cca819edd512de01cc8bbc1224ed4aafb78b52a:2:{i:0;s:18:"_identitygomovies7";i:1;s:52:"[2050366,"HnVRRAObTASOJEr45YyCM8wiHol0V1ko",2592000]";}""",
"_on_page" to "a7ae14b5ed54124bac8a10a84da3cc57f3eb1737692db730ebf8f8d17e091bcca%3A2%3A%7Bi%3A0%3Bs%3A8%3A%22_on_page%22%3Bi%3A1%3Bs%3A8%3A%22onpage_1%22%3B%7D",
"_pops2" to "9fcbd414a7444076e7431ef4db4cd0a011b4429c0397f23d17b709f43b432610a%3A2%3A%7Bi%3A0%3Bs%3A6%3A%22_pops2%22%3Bi%3A1%3Bs%3A8%3A%22pop_up_1%22%3B%7D",
)
val req = app.get("$api/search/$query")
val doc = req.document
var cookies = req.cookies + idCookies
val media = doc.select("div.$mediaSelector").map {
Triple(
it.attr("data-filmName"), it.attr("data-year"), it.select("a").attr("href")
@ -2006,9 +2006,8 @@ object SoraExtractor : SoraStream() {
fixUrl(
media.third,
api
), cookies = cookies
)
)
cookies = cookies + res.cookies
res.document.selectFirst("div#$episodeSelector a:contains(Episode ${slug.second})")
?.attr("href")
} ?: return
@ -2019,11 +2018,11 @@ object SoraExtractor : SoraStream() {
media.third.substringAfterLast("/") to iframe.substringAfterLast("/")
.substringBefore("-")
}
val res = app.get(fixUrl(iframe ?: return, api), cookies = cookies, verify = false)
val res = app.get(fixUrl(iframe, api), verify = false)
val serverUrl = res.document.selectFirst("script:containsData(pushState)")?.data()?.let {
""",\s*'([^']+)""".toRegex().find(it)?.groupValues?.get(1)
} ?: return
cookies = cookies + res.cookies
val cookies = savedCookies + res.cookies
val url = res.document.select("meta[property=og:url]").attr("content")
val headers = mapOf("X-Requested-With" to "XMLHttpRequest")
val qualities = intArrayOf(2160, 1440, 1080, 720, 480, 360)

View File

@ -44,6 +44,7 @@ import com.hexated.SoraExtractor.invokeUhdmovies
import com.hexated.SoraExtractor.invokeVegamovies
import com.hexated.SoraExtractor.invokeVidsrcto
import com.hexated.SoraExtractor.invokeCinemaTv
import com.hexated.SoraExtractor.invokeGomovies
import com.hexated.SoraExtractor.invokeWatchsomuch
import com.hexated.SoraExtractor.invokeZshow
import com.lagradost.cloudstream3.LoadResponse.Companion.addImdbId
@ -452,6 +453,15 @@ open class SoraStream : TmdbProvider() {
callback
)
},
{
if (!res.isAnime) invokeGomovies (
res.title,
res.year,
res.season,
res.episode,
callback
)
},
{
if (!res.isAnime) invokeLing(
res.title,

View File

@ -30,6 +30,7 @@ import com.hexated.SoraExtractor.invokeShowflix
import com.hexated.SoraExtractor.invokeVidSrc
import com.hexated.SoraExtractor.invokeVidsrcto
import com.hexated.SoraExtractor.invokeCinemaTv
import com.hexated.SoraExtractor.invokeGomovies
import com.hexated.SoraExtractor.invokeWatchsomuch
import com.hexated.SoraExtractor.invokeZshow
import com.lagradost.cloudstream3.SubtitleFile
@ -133,6 +134,15 @@ class SoraStreamLite : SoraStream() {
callback
)
},
{
if (!res.isAnime) invokeGomovies(
res.title,
res.year,
res.season,
res.episode,
callback
)
},
{
if (!res.isAnime) invokeKimcartoon(
res.title,