mirror of
https://github.com/recloudstream/cloudstream-extensions.git
synced 2024-08-15 03:03:54 +00:00
Update AllAnimeProvider.kt
This commit is contained in:
parent
039b1d98b1
commit
caa4526f18
1 changed files with 14 additions and 2 deletions
|
@ -3,6 +3,7 @@ package com.lagradost
|
|||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.LoadResponse.Companion.addActors
|
||||
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
|
||||
import com.lagradost.cloudstream3.mvvm.safeApiCall
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsProviders
|
||||
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
|
||||
|
@ -55,8 +56,13 @@ class AllAnimeProvider : MainAPI() {
|
|||
@JsonProperty("availableEpisodes") val availableEpisodes: AvailableEpisodes?,
|
||||
@JsonProperty("availableEpisodesDetail") val availableEpisodesDetail: AvailableEpisodesDetail?,
|
||||
@JsonProperty("studios") val studios: List<String>?,
|
||||
@JsonProperty("genres") val genres: List<String>?,
|
||||
@JsonProperty("averageScore") val averageScore: Int?,
|
||||
@JsonProperty("description") val description: String?,
|
||||
@JsonProperty("status") val status: String?,
|
||||
@JsonProperty("banner") val banner : String?,
|
||||
@JsonProperty("episodeDuration") val episodeDuration : Int?,
|
||||
@JsonProperty("prevideos") val prevideos : List<String> = emptyList(),
|
||||
)
|
||||
|
||||
private data class AvailableEpisodes(
|
||||
|
@ -225,6 +231,7 @@ class AllAnimeProvider : MainAPI() {
|
|||
|
||||
rhino.evaluateString(scope, js, "JavaScript", 1, null)
|
||||
val jsEval = scope.get("returnValue", scope) ?: return null
|
||||
|
||||
val showData = parseJson<Edges>(jsEval as String)
|
||||
|
||||
val title = showData.name
|
||||
|
@ -256,7 +263,7 @@ class AllAnimeProvider : MainAPI() {
|
|||
Pair(Actor(name, img), role)
|
||||
}
|
||||
|
||||
// bruh, they use graphql
|
||||
// bruh, they use graphql and bruh it is fucked
|
||||
//val recommendations = soup.select("#suggesction > div > div.p > .swipercard")?.mapNotNull {
|
||||
// val recTitle = it?.selectFirst(".showname > a") ?: return@mapNotNull null
|
||||
// val recName = recTitle.text() ?: return@mapNotNull null
|
||||
|
@ -267,7 +274,12 @@ class AllAnimeProvider : MainAPI() {
|
|||
|
||||
return newAnimeLoadResponse(title, url, TvType.Anime) {
|
||||
posterUrl = poster
|
||||
backgroundPosterUrl = showData.banner
|
||||
rating = showData.averageScore?.times(100)
|
||||
tags = showData.genres
|
||||
year = showData.airedStart?.year
|
||||
duration = showData.episodeDuration?.div(60_000)
|
||||
addTrailer(showData.prevideos.filter { it.isNotBlank() }.map { "https://www.youtube.com/watch?v=$it" })
|
||||
|
||||
addEpisodes(DubStatus.Subbed, episodes.first)
|
||||
addEpisodes(DubStatus.Dubbed, episodes.second)
|
||||
|
|
Loading…
Reference in a new issue