mirror of
https://github.com/recloudstream/cloudstream-extensions.git
synced 2024-08-15 03:03:54 +00:00
possibly added mal sync
This commit is contained in:
parent
4f6d984d6a
commit
127f77131b
1 changed files with 40 additions and 0 deletions
|
|
@ -218,6 +218,7 @@ class AllAnimeProvider : MainAPI() {
|
||||||
|
|
||||||
val html = app.get(url).text
|
val html = app.get(url).text
|
||||||
val soup = Jsoup.parse(html)
|
val soup = Jsoup.parse(html)
|
||||||
|
val (malId, anilistId, image, cover) = getTracker(title, typeCheck, year)
|
||||||
|
|
||||||
val script = soup.select("script").firstOrNull {
|
val script = soup.select("script").firstOrNull {
|
||||||
it.html().contains("window.__NUXT__")
|
it.html().contains("window.__NUXT__")
|
||||||
|
|
@ -417,6 +418,45 @@ class AllAnimeProvider : MainAPI() {
|
||||||
).path),
|
).path),
|
||||||
Qualities.P1080.value,
|
Qualities.P1080.value,
|
||||||
false
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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…
Add table
Add a link
Reference in a new issue