Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jackjohn committed Dec 11, 2023
1 parent 408d91f commit 7142755
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 28 deletions.
35 changes: 20 additions & 15 deletions Gomov/src/main/kotlin/com/hexated/Gomov.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -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
}
Expand All @@ -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 =
Expand Down Expand Up @@ -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, "")
}
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, "")
}

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}"
}
}

}
10 changes: 5 additions & 5 deletions Movierulzhd/src/main/kotlin/com/hexated/Movierulzhd.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand All @@ -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
}
Expand All @@ -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()
Expand Down Expand Up @@ -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")
Expand Down
15 changes: 7 additions & 8 deletions SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions SoraStream/src/main/kotlin/com/hexated/SoraStream.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
10 changes: 10 additions & 0 deletions SoraStream/src/main/kotlin/com/hexated/SoraStreamLite.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 7142755

Please sign in to comment.