unimay: Fix, some changes in models

This commit is contained in:
CakesTwix 2024-01-09 15:22:27 +02:00
parent 8b1005d159
commit 99331931ee
Signed by: CakesTwix
GPG key ID: 7B11051D5CE19825
2 changed files with 17 additions and 84 deletions

View file

@ -20,7 +20,6 @@ import com.lagradost.cloudstream3.newAnimeSearchResponse
import com.lagradost.cloudstream3.newHomePageResponse
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.M3u8Helper
import com.lagradost.cloudstream3.utils.Qualities
import com.lagradost.models.Releases
import com.lagradost.models.SearchModel
@ -38,7 +37,7 @@ class UnimayProvider : MainAPI() {
)
private val apiUrl = "https://api.unimay.media"
private val findUrl = "$apiUrl/api/release/search/?title="
private val findUrl = "$apiUrl/v1/release/search?title="
private val imagesUrl = "$apiUrl/storage/images/"
// Sections
@ -72,7 +71,8 @@ class UnimayProvider : MainAPI() {
// Detailed information
override suspend fun load(url: String): LoadResponse {
val anime = app.get("$apiUrl/api/release/${url.substringAfterLast("/")}").parsedSafe<SearchModel>()!!
// Log.d("CakesTwix-Debug", url)
val anime = app.get(url).parsedSafe<SearchModel>()!!
// val anime = Gson().fromJson(app.get("$apiUrl/api/release/${url.substringAfterLast("/")}").text, SearchModel::class.java)
val showStatus = when(anime.statusCode){
@ -138,23 +138,6 @@ class UnimayProvider : MainAPI() {
return true
}
if (episode.sd != null) {
callback(ExtractorLink(episode.sd,"Unimay", episode.sd, "https://www.unimay.media",
Qualities.P480.value, false))
}
if (episode.hd != null) {
callback(ExtractorLink(episode.hd,"Unimay", episode.hd, "https://www.unimay.media",
Qualities.P720.value, false))
}
if (episode.fhd != null) {
callback(ExtractorLink(episode.fhd,"Unimay", episode.fhd, "https://www.unimay.media",
Qualities.P1080.value, false))
}
if (episode.qhd != null) {
callback(ExtractorLink(episode.qhd,"Unimay", episode.qhd, "https://www.unimay.media",
Qualities.P2160.value, false))
}
return true
}
}

View file

@ -2,79 +2,29 @@ package com.lagradost.models
data class SearchModel (
val id : Int,
val aniListId : Int,
val episodes : Int,
val episodeLength : Int,
val year : Int,
val restricted : Boolean,
val active : Boolean,
val announce : String,
val code : String,
val tgCode : String,
val cdnCode : String,
val year : Int,
val description : String,
val lastUpdate : Long,
val name : String,
val engName : String,
// https://api.unimay.media/api/release/suzume-locking-up-the-doors
// val trailerPlaylist : String?,
val timestamp : Long,
val season : String,
val type : String,
val posterId : Int,
val imageId : Int,
val genres : List<String>,
val engName : String,
// val translators : List<Translators>,
val playlist : List<Playlist>,
val playlistSize : Int,
val actors : List<Actors>,
val translators : List<Translators>,
val soundmans : List<Soundmans>,
val genresInString : String,
val statusCode : Int
)
data class Actors (
val id : Int,
val firstName : String,
val lastName : String,
val nickName : String,
val city : String,
val avtarId : Int
val genres : List<String>,
val aniListId : Int,
val imageId : Int,
val name : String,
val posterId : Int,
val statusCode : Int,
val episodeLength : Int,
)
data class Playlist (
// val id : Int,
val number : Int,
val preview : Int,
val title : String,
val preview : String?,
val previewId : Int?,
val sd : String?,
val hd : String?,
val fhd : String?,
val qhd : String?,
val playlist : String?,
val hidden : Boolean
val number : Int,
val previewId : Int,
val playlist : String,
)
data class Soundmans (
val id : Int,
val firstName : String,
val lastName : String,
val nickName : String,
val city : String,
val avtarId : Int
)
data class Translators (
val id : Int,
val firstName : String,
val lastName : String,
val nickName : String,
val city : String,
val avtarId : Int
)