diff --git a/AnimeONProvider/build.gradle.kts b/AnimeONProvider/build.gradle.kts index 57a2d87..d482a39 100644 --- a/AnimeONProvider/build.gradle.kts +++ b/AnimeONProvider/build.gradle.kts @@ -1,5 +1,5 @@ // use an integer for version numbers -version = 4 +version = 5 dependencies{ implementation("com.google.code.gson:gson:2.9.0") diff --git a/AnimeONProvider/src/main/kotlin/com/lagradost/AnimeONProvider.kt b/AnimeONProvider/src/main/kotlin/com/lagradost/AnimeONProvider.kt index 012b6e7..c22ec3b 100644 --- a/AnimeONProvider/src/main/kotlin/com/lagradost/AnimeONProvider.kt +++ b/AnimeONProvider/src/main/kotlin/com/lagradost/AnimeONProvider.kt @@ -152,7 +152,6 @@ class AnimeONProvider : MainAPI() { ) ) } - return if (tvType == TvType.Anime || tvType == TvType.OVA) { newAnimeLoadResponse( animeJSON.titleUa, @@ -167,20 +166,25 @@ class AnimeONProvider : MainAPI() { this.showStatus = showStatus this.duration = extractIntFromString(animeJSON.episodeTime) this.year = animeJSON.releaseDate - this.backgroundPosterUrl = posterApi.format(animeJSON.backgroundImage) this.rating = animeJSON.rating.toString().toRatingInt() addEpisodes(DubStatus.Dubbed, episodes) addMalId(animeJSON.malId) } } else { - newMovieLoadResponse(animeJSON.titleUa, "$mainUrl/anime/${animeJSON.id}", tvType, "${animeJSON.titleUa}, ${animeJSON.player[0].url}") { + var backgroundImage = animeJSON.backgroundImage + if(backgroundImage.isNullOrBlank()){ + backgroundImage = posterApi.format(animeJSON.poster) + } else { + backgroundImage = posterApi.format(animeJSON.backgroundImage) + } + newMovieLoadResponse(animeJSON.titleUa, "$mainUrl/anime/${animeJSON.id}", tvType, "${animeJSON.id}") { this.posterUrl = posterApi.format(animeJSON.poster) this.tags = animeJSON.genres.map { it.name } this.plot = animeJSON.description addTrailer(animeJSON.trailer) this.duration = extractIntFromString(animeJSON.episodeTime) this.year = animeJSON.releaseDate - this.backgroundPosterUrl = posterApi.format(animeJSON.backgroundImage) + this.backgroundPosterUrl = backgroundImage this.rating = animeJSON.rating.toString().toRatingInt() addMalId(animeJSON.malId) } @@ -196,17 +200,27 @@ class AnimeONProvider : MainAPI() { callback: (ExtractorLink) -> Unit ): Boolean { val dataList = data.split(", ") - val fundubs = Gson().fromJson>(app.get("${apiUrl}/player/fundubs/${dataList[0]}").text, listFundub) - fundubs.map { dub -> - Gson().fromJson>(app.get("${apiUrl}/player/episodes/${dub.player[0].id}/${dub.fundub.id}").text, listFundubEpisodes).filter{ it.episode == dataList[1].toIntOrNull() }.map { epd -> // Episode - M3u8Helper.generateM3u8( - source = "${dub.fundub.name} (${dub.player[0].name})", - streamUrl = getM3U(app.get("${apiUrl}/player/episode/${epd.id}").parsedSafe()!!.videoUrl), - referer = "https://animeon.club" - ).forEach(callback) + if(dataList.size == 2){ + fundubs.map { dub -> + Gson().fromJson>(app.get("${apiUrl}/player/episodes/${dub.player[0].id}/${dub.fundub.id}").text, listFundubEpisodes).filter{ it.episode == dataList[1].toIntOrNull() }.map { epd -> // Episode + M3u8Helper.generateM3u8( + source = "${dub.fundub.name} (${dub.player[0].name})", + streamUrl = getM3U(app.get("${apiUrl}/player/episode/${epd.id}").parsedSafe()!!.videoUrl), + referer = "https://animeon.club" + ).forEach(callback) + } } + return true + } + + fundubs.map { dub -> + M3u8Helper.generateM3u8( + source = "${dub.fundub.name} (${dub.player[0].name})", + streamUrl = getM3U(app.get("${apiUrl}/player/${dub.player[0].id}/${dub.fundub.id}").parsedSafe()!!.videoUrl), + referer = "https://animeon.club" + ).forEach(callback) } return true