mirror of
https://github.com/recloudstream/cloudstream-extensions.git
synced 2024-08-15 03:03:54 +00:00
Possibly added mal and anilist to DubbedAnime and Kawaiifu
This commit is contained in:
parent
588b53bd6c
commit
4947c457e6
3 changed files with 89 additions and 1 deletions
|
@ -18,7 +18,7 @@ import kotlin.math.pow
|
||||||
class AnimePaheProvider : MainAPI() {
|
class AnimePaheProvider : MainAPI() {
|
||||||
// credit to https://github.com/justfoolingaround/animdl/tree/master/animdl/core/codebase/providers/animepahe
|
// credit to https://github.com/justfoolingaround/animdl/tree/master/animdl/core/codebase/providers/animepahe
|
||||||
companion object {
|
companion object {
|
||||||
const val MAIN_URL = "https://animepahe.com"
|
const val MAIN_URL = "https://animepahe.ru"
|
||||||
|
|
||||||
var cookies: Map<String, String> = mapOf()
|
var cookies: Map<String, String> = mapOf()
|
||||||
private fun getType(t: String): TvType {
|
private fun getType(t: String): TvType {
|
||||||
|
|
|
@ -2,6 +2,8 @@ package com.lagradost
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.lagradost.cloudstream3.*
|
import com.lagradost.cloudstream3.*
|
||||||
|
import com.lagradost.cloudstream3.LoadResponse.Companion.addAniListId
|
||||||
|
import com.lagradost.cloudstream3.LoadResponse.Companion.addMalId
|
||||||
import com.lagradost.cloudstream3.APIHolder.unixTime
|
import com.lagradost.cloudstream3.APIHolder.unixTime
|
||||||
import com.lagradost.cloudstream3.APIHolder.unixTimeMS
|
import com.lagradost.cloudstream3.APIHolder.unixTimeMS
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
|
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
|
||||||
|
@ -253,6 +255,8 @@ class DubbedAnimeProvider : MainAPI() {
|
||||||
?.replace("Released: ", "")
|
?.replace("Released: ", "")
|
||||||
?.toIntOrNull()
|
?.toIntOrNull()
|
||||||
|
|
||||||
|
val (malId, anilistId, image, cover) = getTracker(title, "tv", year)
|
||||||
|
|
||||||
val episodes = document.select("a.epibloks").map {
|
val episodes = document.select("a.epibloks").map {
|
||||||
val epTitle = it.selectFirst("> div.inwel > span.isgrxx")?.text()
|
val epTitle = it.selectFirst("> div.inwel > span.isgrxx")?.text()
|
||||||
Episode(fixUrl(it.attr("href")), epTitle)
|
Episode(fixUrl(it.attr("href")), epTitle)
|
||||||
|
@ -262,9 +266,48 @@ class DubbedAnimeProvider : MainAPI() {
|
||||||
return newAnimeLoadResponse(title, url, TvType.Anime) {
|
return newAnimeLoadResponse(title, url, TvType.Anime) {
|
||||||
posterUrl = img
|
posterUrl = img
|
||||||
this.year = year
|
this.year = year
|
||||||
|
addMalId(malId)
|
||||||
|
addAniListId(anilistId?.toIntOrNull())
|
||||||
addEpisodes(DubStatus.Dubbed, episodes)
|
addEpisodes(DubStatus.Dubbed, episodes)
|
||||||
plot = descript
|
plot = descript
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private suspend fun getTracker(title: String?, type: String?, year: Int?): Tracker {
|
||||||
|
val res = app.get("https://api.consumet.org/meta/anilist/$title")
|
||||||
|
.parsedSafe<AniSearch>()?.results?.find { media ->
|
||||||
|
(media.title?.english.equals(title, true) || media.title?.romaji.equals(
|
||||||
|
title,
|
||||||
|
true
|
||||||
|
)) || (media.type.equals(type, true) && media.releaseDate == year)
|
||||||
|
}
|
||||||
|
return Tracker(res?.malId, res?.aniId, res?.image, res?.cover)
|
||||||
|
}
|
||||||
|
|
||||||
|
data class Tracker(
|
||||||
|
val malId: Int? = null,
|
||||||
|
val aniId: String? = null,
|
||||||
|
val image: String? = null,
|
||||||
|
val cover: String? = null,
|
||||||
|
)
|
||||||
|
|
||||||
|
data class Title(
|
||||||
|
@JsonProperty("romaji") val romaji: String? = null,
|
||||||
|
@JsonProperty("english") val english: String? = null,
|
||||||
|
)
|
||||||
|
|
||||||
|
data class Results(
|
||||||
|
@JsonProperty("id") val aniId: String? = null,
|
||||||
|
@JsonProperty("malId") val malId: Int? = null,
|
||||||
|
@JsonProperty("title") val title: Title? = null,
|
||||||
|
@JsonProperty("releaseDate") val releaseDate: Int? = null,
|
||||||
|
@JsonProperty("type") val type: String? = null,
|
||||||
|
@JsonProperty("image") val image: String? = null,
|
||||||
|
@JsonProperty("cover") val cover: String? = null,
|
||||||
|
)
|
||||||
|
|
||||||
|
data class AniSearch(
|
||||||
|
@JsonProperty("results") val results: ArrayList<Results>? = arrayListOf(),
|
||||||
|
|
||||||
|
)
|
||||||
}
|
}
|
|
@ -1,6 +1,9 @@
|
||||||
package com.lagradost
|
package com.lagradost
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.lagradost.cloudstream3.*
|
import com.lagradost.cloudstream3.*
|
||||||
|
import com.lagradost.cloudstream3.LoadResponse.Companion.addAniListId
|
||||||
|
import com.lagradost.cloudstream3.LoadResponse.Companion.addMalId
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.getQualityFromName
|
import com.lagradost.cloudstream3.utils.getQualityFromName
|
||||||
import org.jsoup.Jsoup
|
import org.jsoup.Jsoup
|
||||||
|
@ -95,6 +98,9 @@ class KawaiifuProvider : MainAPI() {
|
||||||
.joinToString("\n") { it.text() }
|
.joinToString("\n") { it.text() }
|
||||||
val year = url.split("/").filter { it.contains("-") }[0].split("-")[1].toIntOrNull()
|
val year = url.split("/").filter { it.contains("-") }[0].split("-")[1].toIntOrNull()
|
||||||
|
|
||||||
|
val (malId, anilistId, image, cover) = getTracker(title, "tv", year)
|
||||||
|
|
||||||
|
|
||||||
val episodesLink = soup.selectFirst("a[href*=\".html-episode\"]")?.attr("href")
|
val episodesLink = soup.selectFirst("a[href*=\".html-episode\"]")?.attr("href")
|
||||||
?: throw ErrorLoadingException("Error getting episode list")
|
?: throw ErrorLoadingException("Error getting episode list")
|
||||||
val episodes = Jsoup.parse(
|
val episodes = Jsoup.parse(
|
||||||
|
@ -112,6 +118,8 @@ class KawaiifuProvider : MainAPI() {
|
||||||
return newAnimeLoadResponse(title, url, TvType.Anime) {
|
return newAnimeLoadResponse(title, url, TvType.Anime) {
|
||||||
this.year = year
|
this.year = year
|
||||||
posterUrl = poster
|
posterUrl = poster
|
||||||
|
addMalId(malId)
|
||||||
|
addAniListId(anilistId?.toIntOrNull())
|
||||||
addEpisodes(DubStatus.Subbed, episodes)
|
addEpisodes(DubStatus.Subbed, episodes)
|
||||||
plot = description
|
plot = description
|
||||||
this.tags = tags
|
this.tags = tags
|
||||||
|
@ -171,4 +179,41 @@ class KawaiifuProvider : MainAPI() {
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
private suspend fun getTracker(title: String?, type: String?, year: Int?): Tracker {
|
||||||
|
val res = app.get("https://api.consumet.org/meta/anilist/$title")
|
||||||
|
.parsedSafe<AniSearch>()?.results?.find { media ->
|
||||||
|
(media.title?.english.equals(title, true) || media.title?.romaji.equals(
|
||||||
|
title,
|
||||||
|
true
|
||||||
|
)) || (media.type.equals(type, true) && media.releaseDate == year)
|
||||||
|
}
|
||||||
|
return Tracker(res?.malId, res?.aniId, res?.image, res?.cover)
|
||||||
|
}
|
||||||
|
|
||||||
|
data class Tracker(
|
||||||
|
val malId: Int? = null,
|
||||||
|
val aniId: String? = null,
|
||||||
|
val image: String? = null,
|
||||||
|
val cover: String? = null,
|
||||||
|
)
|
||||||
|
|
||||||
|
data class Title(
|
||||||
|
@JsonProperty("romaji") val romaji: String? = null,
|
||||||
|
@JsonProperty("english") val english: String? = null,
|
||||||
|
)
|
||||||
|
|
||||||
|
data class Results(
|
||||||
|
@JsonProperty("id") val aniId: String? = null,
|
||||||
|
@JsonProperty("malId") val malId: Int? = null,
|
||||||
|
@JsonProperty("title") val title: Title? = null,
|
||||||
|
@JsonProperty("releaseDate") val releaseDate: Int? = null,
|
||||||
|
@JsonProperty("type") val type: String? = null,
|
||||||
|
@JsonProperty("image") val image: String? = null,
|
||||||
|
@JsonProperty("cover") val cover: String? = null,
|
||||||
|
)
|
||||||
|
|
||||||
|
data class AniSearch(
|
||||||
|
@JsonProperty("results") val results: ArrayList<Results>? = arrayListOf(),
|
||||||
|
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue