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? { private fun Element.toSearchResult(): SearchResponse? {
val title = this.selectFirst("h2.entry-title > a")?.text()?.trim() ?: return null val title = this.selectFirst("h2.entry-title > a")?.text()?.trim() ?: return null
val href = fixUrl(this.selectFirst("a")!!.attr("href")) 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("-", "") val quality = this.select("div.gmr-qual, div.gmr-quality-item > a").text().trim().replace("-", "")
return if (quality.isEmpty()) { return if (quality.isEmpty()) {
val episode = val episode =
@ -66,7 +66,7 @@ open class Gomov : MainAPI() {
private fun Element.toRecommendResult(): SearchResponse? { private fun Element.toRecommendResult(): SearchResponse? {
val title = this.selectFirst("a > span.idmuvi-rp-title")?.text()?.trim() ?: return null val title = this.selectFirst("a > span.idmuvi-rp-title")?.text()?.trim() ?: return null
val href = this.selectFirst("a")!!.attr("href") 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) { return newMovieSearchResponse(title, href, TvType.Movie) {
this.posterUrl = posterUrl this.posterUrl = posterUrl
} }
@ -88,7 +88,7 @@ open class Gomov : MainAPI() {
document.selectFirst("h1.entry-title")?.text()?.substringBefore("Season")?.substringBefore("Episode")?.trim() document.selectFirst("h1.entry-title")?.text()?.substringBefore("Season")?.substringBefore("Episode")?.trim()
.toString() .toString()
val poster = 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 tags = document.select("span.gmr-movie-genre:contains(Genre:) > a").map { it.text() }
val year = val year =
@ -176,24 +176,29 @@ open class Gomov : MainAPI() {
} }
private fun Element?.getImgAttr() : String? { private fun Element.getImageAttr(): String? {
return this?.attr("data-src").takeIf { it?.isNotEmpty() == true } ?: this?.attr("src") 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? { private fun Element?.getIframeAttr() : String? {
return this?.attr("data-litespeed-src").takeIf { it?.isNotEmpty() == true } ?: this?.attr("src") return this?.attr("data-litespeed-src").takeIf { it?.isNotEmpty() == true } ?: this?.attr("src")
} }
} private fun String?.fixImageQuality(): String? {
if (this == null) return null
fun String?.fixImageQuality(): String? { val regex = Regex("(-\\d*x\\d*)").find(this)?.groupValues?.get(0) ?: return this
if (this == null) return null return this.replace(regex, "")
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 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? { 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 = getProperLink(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").last()?.imageFromElement()) val posterUrl = fixUrlNull(this.select("div.poster img").last()?.getImageAttr())
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) {
this.posterUrl = posterUrl this.posterUrl = posterUrl
@ -96,7 +96,7 @@ open class Movierulzhd : MainAPI() {
directUrl = getBaseUrl(request.url) directUrl = getBaseUrl(request.url)
val title = val title =
document.selectFirst("div.data > h1")?.text()?.trim().toString() 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 tags = document.select("div.sgeneros > a").map { it.text() }
val year = Regex(",\\s?(\\d+)").find( val year = Regex(",\\s?(\\d+)").find(
@ -123,7 +123,7 @@ open class Movierulzhd : MainAPI() {
val recName = val recName =
it.selectFirst("a")!!.attr("href").toString().removeSuffix("/").split("/").last() it.selectFirst("a")!!.attr("href").toString().removeSuffix("/").split("/").last()
val recHref = it.selectFirst("a")!!.attr("href") val recHref = it.selectFirst("a")!!.attr("href")
val recPosterUrl = it.selectFirst("img")?.imageFromElement() val recPosterUrl = it.selectFirst("img")?.getImageAttr()
newTvSeriesSearchResponse(recName, recHref, TvType.TvSeries) { newTvSeriesSearchResponse(recName, recHref, TvType.TvSeries) {
this.posterUrl = recPosterUrl this.posterUrl = recPosterUrl
} }
@ -134,7 +134,7 @@ open class Movierulzhd : MainAPI() {
document.select("ul.episodios > li").map { document.select("ul.episodios > li").map {
val href = it.select("a").attr("href") val href = it.select("a").attr("href")
val name = fixTitle(it.select("div.episodiotitle > a").text().trim()) 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 = val episode =
it.select("div.numerando").text().replace(" ", "").split("-").last() it.select("div.numerando").text().replace(" ", "").split("-").last()
.toIntOrNull() .toIntOrNull()
@ -248,7 +248,7 @@ open class Movierulzhd : MainAPI() {
return true return true
} }
private fun Element.imageFromElement(): String? { private fun Element.getImageAttr(): String? {
return when { return when {
this.hasAttr("data-src") -> this.attr("abs:data-src") this.hasAttr("data-src") -> this.attr("abs:data-src")
this.hasAttr("data-lazy-src") -> this.attr("abs:data-lazy-src") this.hasAttr("data-lazy-src") -> this.attr("abs:data-lazy-src")

View file

@ -1971,14 +1971,14 @@ object SoraExtractor : SoraStream() {
} else { } else {
"$title Season $season" "$title Season $season"
} }
val idCookies = val savedCookies =
mapOf( 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 req = app.get("$api/search/$query")
val doc = req.document val doc = req.document
var cookies = req.cookies + idCookies
val media = doc.select("div.$mediaSelector").map { val media = doc.select("div.$mediaSelector").map {
Triple( Triple(
it.attr("data-filmName"), it.attr("data-year"), it.select("a").attr("href") it.attr("data-filmName"), it.attr("data-year"), it.select("a").attr("href")
@ -2006,9 +2006,8 @@ object SoraExtractor : SoraStream() {
fixUrl( fixUrl(
media.third, media.third,
api api
), cookies = cookies )
) )
cookies = cookies + res.cookies
res.document.selectFirst("div#$episodeSelector a:contains(Episode ${slug.second})") res.document.selectFirst("div#$episodeSelector a:contains(Episode ${slug.second})")
?.attr("href") ?.attr("href")
} ?: return } ?: return
@ -2019,11 +2018,11 @@ object SoraExtractor : SoraStream() {
media.third.substringAfterLast("/") to iframe.substringAfterLast("/") media.third.substringAfterLast("/") to iframe.substringAfterLast("/")
.substringBefore("-") .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 { val serverUrl = res.document.selectFirst("script:containsData(pushState)")?.data()?.let {
""",\s*'([^']+)""".toRegex().find(it)?.groupValues?.get(1) """,\s*'([^']+)""".toRegex().find(it)?.groupValues?.get(1)
} ?: return } ?: return
cookies = cookies + res.cookies val cookies = savedCookies + res.cookies
val url = res.document.select("meta[property=og:url]").attr("content") val url = res.document.select("meta[property=og:url]").attr("content")
val headers = mapOf("X-Requested-With" to "XMLHttpRequest") val headers = mapOf("X-Requested-With" to "XMLHttpRequest")
val qualities = intArrayOf(2160, 1440, 1080, 720, 480, 360) 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.invokeVegamovies
import com.hexated.SoraExtractor.invokeVidsrcto import com.hexated.SoraExtractor.invokeVidsrcto
import com.hexated.SoraExtractor.invokeCinemaTv import com.hexated.SoraExtractor.invokeCinemaTv
import com.hexated.SoraExtractor.invokeGomovies
import com.hexated.SoraExtractor.invokeWatchsomuch import com.hexated.SoraExtractor.invokeWatchsomuch
import com.hexated.SoraExtractor.invokeZshow import com.hexated.SoraExtractor.invokeZshow
import com.lagradost.cloudstream3.LoadResponse.Companion.addImdbId import com.lagradost.cloudstream3.LoadResponse.Companion.addImdbId
@ -452,6 +453,15 @@ open class SoraStream : TmdbProvider() {
callback callback
) )
}, },
{
if (!res.isAnime) invokeGomovies (
res.title,
res.year,
res.season,
res.episode,
callback
)
},
{ {
if (!res.isAnime) invokeLing( if (!res.isAnime) invokeLing(
res.title, res.title,

View file

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