Animasu: fix poster

This commit is contained in:
hexated 2023-12-18 06:16:58 +07:00
parent 0db99c3205
commit 4aa062b89f
7 changed files with 31 additions and 12 deletions

View file

@ -1,5 +1,5 @@
// use an integer for version numbers
version = 8
version = 9
cloudstream {

View file

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

View file

@ -12,5 +12,6 @@ class AnimasuPlugin: Plugin() {
registerMainAPI(Animasu())
registerExtractorAPI(Archivd())
registerExtractorAPI(Newuservideo())
registerExtractorAPI(Vidhidepro())
}
}

View file

@ -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<Streams>? = null,
)
}
class Vidhidepro : Filesim() {
override val mainUrl = "https://vidhidepro.com"
override val name = "Vidhidepro"
}

View file

@ -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",
)

View file

@ -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(

View file

@ -145,7 +145,7 @@ class SoraStreamLite : SoraStream() {
)
},
{
if (!res.isAnime) invokeKimcartoon(
if (!res.isAnime && res.isCartoon) invokeKimcartoon(
res.title,
res.season,
res.episode,