Skip to content

Commit

Permalink
Animasu: fix poster
Browse files Browse the repository at this point in the history
  • Loading branch information
hexated committed Dec 17, 2023
1 parent 0db99c3 commit 4aa062b
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Animasu/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// use an integer for version numbers
version = 8
version = 9


cloudstream {
Expand Down
13 changes: 11 additions & 2 deletions Animasu/src/main/kotlin/com/hexated/Animasu.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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())
Expand Down Expand Up @@ -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")
}
}

}
1 change: 1 addition & 0 deletions Animasu/src/main/kotlin/com/hexated/AnimasuPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ class AnimasuPlugin: Plugin() {
registerMainAPI(Animasu())
registerExtractorAPI(Archivd())
registerExtractorAPI(Newuservideo())
registerExtractorAPI(Vidhidepro())
}
}
6 changes: 6 additions & 0 deletions Animasu/src/main/kotlin/com/hexated/Extractors.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -99,4 +100,9 @@ class Newuservideo : ExtractorApi() {
@JsonProperty("streams") val streams: ArrayList<Streams>? = null,
)

}

class Vidhidepro : Filesim() {
override val mainUrl = "https://vidhidepro.com"
override val name = "Vidhidepro"
}
5 changes: 2 additions & 3 deletions SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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",
)
Expand Down
14 changes: 9 additions & 5 deletions SoraStream/src/main/kotlin/com/hexated/SoraStream.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 } }

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -438,7 +441,7 @@ open class SoraStream : TmdbProvider() {
)
},
{
if (!res.isAnime) invokeKimcartoon(
if (!res.isAnime && res.isCartoon) invokeKimcartoon(
res.title,
res.season,
res.episode,
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion SoraStream/src/main/kotlin/com/hexated/SoraStreamLite.kt
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class SoraStreamLite : SoraStream() {
)
},
{
if (!res.isAnime) invokeKimcartoon(
if (!res.isAnime && res.isCartoon) invokeKimcartoon(
res.title,
res.season,
res.episode,
Expand Down

0 comments on commit 4aa062b

Please sign in to comment.