From 4aa062b89f939ad878ee5341cb639278a917382f Mon Sep 17 00:00:00 2001 From: hexated <37908684+hexated@users.noreply.github.com> Date: Mon, 18 Dec 2023 06:16:58 +0700 Subject: [PATCH] Animasu: fix poster --- Animasu/build.gradle.kts | 2 +- Animasu/src/main/kotlin/com/hexated/Animasu.kt | 13 +++++++++++-- .../src/main/kotlin/com/hexated/AnimasuPlugin.kt | 1 + Animasu/src/main/kotlin/com/hexated/Extractors.kt | 6 ++++++ .../src/main/kotlin/com/hexated/SoraExtractor.kt | 5 ++--- .../src/main/kotlin/com/hexated/SoraStream.kt | 14 +++++++++----- .../src/main/kotlin/com/hexated/SoraStreamLite.kt | 2 +- 7 files changed, 31 insertions(+), 12 deletions(-) diff --git a/Animasu/build.gradle.kts b/Animasu/build.gradle.kts index c2504dae4..24d134e7a 100644 --- a/Animasu/build.gradle.kts +++ b/Animasu/build.gradle.kts @@ -1,5 +1,5 @@ // use an integer for version numbers -version = 8 +version = 9 cloudstream { diff --git a/Animasu/src/main/kotlin/com/hexated/Animasu.kt b/Animasu/src/main/kotlin/com/hexated/Animasu.kt index 4e726b6e6..2b1cdf7d1 100644 --- a/Animasu/src/main/kotlin/com/hexated/Animasu.kt +++ b/Animasu/src/main/kotlin/com/hexated/Animasu.kt @@ -79,7 +79,7 @@ class Animasu : MainAPI() { private fun Element.toSearchResult(): AnimeSearchResponse { val href = getProperAnimeLink(fixUrlNull(this.selectFirst("a")?.attr("href")).toString()) val title = this.select("div.tt").text().trim() - val posterUrl = fixUrlNull(this.selectFirst("img")?.attr("src")) + val posterUrl = fixUrlNull(this.selectFirst("img")?.getImageAttr()) val epNum = this.selectFirst("span.epx")?.text()?.filter { it.isDigit() }?.toIntOrNull() return newAnimeSearchResponse(title, href, TvType.Anime) { this.posterUrl = posterUrl @@ -98,7 +98,7 @@ class Animasu : MainAPI() { val document = app.get(url).document val title = document.selectFirst("div.infox h1")?.text().toString().replace("Sub Indo", "").trim() - val poster = document.selectFirst("div.bigcontent img")?.attr("src")?.replace("\n", "") + val poster = document.selectFirst("div.bigcontent img")?.getImageAttr() val table = document.selectFirst("div.infox div.spe") val type = getType(table?.selectFirst("span:contains(Jenis:)")?.ownText()) @@ -179,4 +179,13 @@ class Animasu : MainAPI() { ?: Qualities.Unknown.value } + 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") + } + } + } \ No newline at end of file diff --git a/Animasu/src/main/kotlin/com/hexated/AnimasuPlugin.kt b/Animasu/src/main/kotlin/com/hexated/AnimasuPlugin.kt index 8572dec60..5ef358415 100644 --- a/Animasu/src/main/kotlin/com/hexated/AnimasuPlugin.kt +++ b/Animasu/src/main/kotlin/com/hexated/AnimasuPlugin.kt @@ -12,5 +12,6 @@ class AnimasuPlugin: Plugin() { registerMainAPI(Animasu()) registerExtractorAPI(Archivd()) registerExtractorAPI(Newuservideo()) + registerExtractorAPI(Vidhidepro()) } } \ No newline at end of file diff --git a/Animasu/src/main/kotlin/com/hexated/Extractors.kt b/Animasu/src/main/kotlin/com/hexated/Extractors.kt index 0f40af8ce..dfd08840e 100644 --- a/Animasu/src/main/kotlin/com/hexated/Extractors.kt +++ b/Animasu/src/main/kotlin/com/hexated/Extractors.kt @@ -3,6 +3,7 @@ package com.hexated import com.fasterxml.jackson.annotation.JsonProperty import com.lagradost.cloudstream3.SubtitleFile import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.extractors.Filesim import com.lagradost.cloudstream3.utils.AppUtils import com.lagradost.cloudstream3.utils.ExtractorApi import com.lagradost.cloudstream3.utils.ExtractorLink @@ -99,4 +100,9 @@ class Newuservideo : ExtractorApi() { @JsonProperty("streams") val streams: ArrayList? = null, ) +} + +class Vidhidepro : Filesim() { + override val mainUrl = "https://vidhidepro.com" + override val name = "Vidhidepro" } \ No newline at end of file diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt b/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt index 8b3ca02d0..8e03dd99d 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt @@ -2256,10 +2256,9 @@ object SoraExtractor : SoraStream() { "$cinemaTvAPI/shows/play/$id-$slug-$year" } - val specialCookies = - "PHPSESSID=e555h63ilisoj2l6j7b5d4jb6p; _csrf=9597150e45f485ad9c4f2e06a2572534d8415337eda9d48d0ecfa25b73b6a9e1a%3A2%3A%7Bi%3A0%3Bs%3A5%3A%22_csrf%22%3Bi%3A1%3Bs%3A32%3A%222HcnegjGB0nX205FAUPb86fqMx9HWIF1%22%3B%7D; _ga=GA1.1.1195498587.1701871187; _ga_VZD7HJ3WK6=GS1.1.$unixTime.4.0.1.$unixTime.0.0.0" + val session = "PHPSESSID=ngr4cudjrimdnhkth30ssohs0n; _csrf=a6ffd7bb7654083fce6df528225a238d0e85aa1fb885dc7638c1259ec1ba0d5ca%3A2%3A%7Bi%3A0%3Bs%3A5%3A%22_csrf%22%3Bi%3A1%3Bs%3A32%3A%22mTTLiDLjxohs-CpKk0bjRH3HdYMB9uBV%22%3B%7D; _ga=GA1.1.1195498587.1701871187; _ga_VZD7HJ3WK6=GS1.1.$unixTime.4.0.1.$unixTime.0.0.0" val headers = mapOf( - "Cookie" to specialCookies, + "Cookie" to session, "Connection" to "keep-alive", "x-requested-with" to "XMLHttpRequest", ) diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt b/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt index 2e0fcb3cf..859c9037e 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt @@ -95,7 +95,7 @@ open class SoraStream : TmdbProvider() { const val flixonAPI = "https://flixon.lol" const val smashyStreamAPI = "https://embed.smashystream.com" const val watchSomuchAPI = "https://watchsomuch.tv" // sub only - var cinemaTvAPI = BuildConfig.CINEMATV_API + const val cinemaTvAPI = BuildConfig.CINEMATV_API const val nineTvAPI = "https://moviesapi.club" const val nowTvAPI = "https://myfilestorage.xyz" const val gokuAPI = "https://goku.sx" @@ -231,10 +231,12 @@ open class SoraStream : TmdbProvider() { val year = releaseDate?.split("-")?.first()?.toIntOrNull() val rating = res.vote_average.toString().toRatingInt() val genres = res.genres?.mapNotNull { it.name } - val isAnime = - genres?.contains("Animation") == true && (res.original_language == "zh" || res.original_language == "ja") + + val isCartoon = genres?.contains("Animation") ?: false + val isAnime = isCartoon && (res.original_language == "zh" || res.original_language == "ja") val isAsian = !isAnime && (res.original_language == "zh" || res.original_language == "ko") val isBollywood = res.production_countries?.any { it.name == "India" } ?: false + val keywords = res.keywords?.results?.mapNotNull { it.name }.orEmpty() .ifEmpty { res.keywords?.keywords?.mapNotNull { it.name } } @@ -277,7 +279,8 @@ open class SoraStream : TmdbProvider() { date = season.airDate, airedDate = res.releaseDate ?: res.firstAirDate, isAsian = isAsian, - isBollywood = isBollywood + isBollywood = isBollywood, + isCartoon = isCartoon ).toJson(), name = eps.name + if (isUpcoming(eps.airDate)) " - [UPCOMING]" else "", season = eps.seasonNumber, @@ -438,7 +441,7 @@ open class SoraStream : TmdbProvider() { ) }, { - if (!res.isAnime) invokeKimcartoon( + if (!res.isAnime && res.isCartoon) invokeKimcartoon( res.title, res.season, res.episode, @@ -755,6 +758,7 @@ open class SoraStream : TmdbProvider() { val airedDate: String? = null, val isAsian: Boolean = false, val isBollywood: Boolean = false, + val isCartoon: Boolean = false, ) data class Data( diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraStreamLite.kt b/SoraStream/src/main/kotlin/com/hexated/SoraStreamLite.kt index e1701bcb1..d4b25315e 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraStreamLite.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraStreamLite.kt @@ -145,7 +145,7 @@ class SoraStreamLite : SoraStream() { ) }, { - if (!res.isAnime) invokeKimcartoon( + if (!res.isAnime && res.isCartoon) invokeKimcartoon( res.title, res.season, res.episode,