mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
NineAnime Recommendations (#725)
This commit is contained in:
parent
75472f5847
commit
ff868fe054
1 changed files with 35 additions and 12 deletions
|
@ -190,12 +190,9 @@ class NineAnimeProvider : MainAPI() {
|
||||||
)
|
)
|
||||||
|
|
||||||
override suspend fun load(url: String): LoadResponse? {
|
override suspend fun load(url: String): LoadResponse? {
|
||||||
val urlclean = url.substringAfter("watch/")
|
|
||||||
val regexID = Regex("(\\.[a-zA-Z0-9]{0,8}[a-zA-Z0-9_-]+)")
|
|
||||||
val animeid = regexID.find(urlclean)?.value?.replace(".", "") ?: return null
|
|
||||||
val animeidencoded = encode(getVrf(animeid) ?: return null)
|
|
||||||
|
|
||||||
val doc = app.get(url).document
|
val doc = app.get(url).document
|
||||||
|
val animeid = doc.selectFirst("div.player-wrapper.watchpage").attr("data-id") ?: return null
|
||||||
|
val animeidencoded = encode(getVrf(animeid) ?: return null)
|
||||||
val poster = doc.selectFirst("aside.main div.thumb div img").attr("src")
|
val poster = doc.selectFirst("aside.main div.thumb div img").attr("src")
|
||||||
val title = doc.selectFirst(".info .title").text()
|
val title = doc.selectFirst(".info .title").text()
|
||||||
val description = doc.selectFirst("div.info p").text().replace("Ver menos", "").trim()
|
val description = doc.selectFirst("div.info p").text().replace("Ver menos", "").trim()
|
||||||
|
@ -205,14 +202,42 @@ class NineAnimeProvider : MainAPI() {
|
||||||
).mapped<Response>().html
|
).mapped<Response>().html
|
||||||
)?.select("ul.episodes li a")?.mapNotNull {
|
)?.select("ul.episodes li a")?.mapNotNull {
|
||||||
val link = it?.attr("href") ?: return@mapNotNull null
|
val link = it?.attr("href") ?: return@mapNotNull null
|
||||||
val epnum = it.attr("data-base")?.toIntOrNull()
|
val name = "Episode ${it.text()}"
|
||||||
AnimeEpisode(link, episode = epnum)
|
AnimeEpisode(link, name)
|
||||||
} ?: return null
|
} ?: return null
|
||||||
|
|
||||||
return newAnimeLoadResponse(title, url, TvType.Anime) {
|
|
||||||
|
val recommendations =
|
||||||
|
doc.select("div.container aside.main section div.body ul.anime-list li")?.mapNotNull { element ->
|
||||||
|
val recTitle = element.select("a.name").text() ?: return@mapNotNull null
|
||||||
|
val image = element.select("a.poster img")?.attr("src")
|
||||||
|
val recUrl = fixUrl(element.select("a").attr("href"))
|
||||||
|
AnimeSearchResponse(
|
||||||
|
recTitle,
|
||||||
|
fixUrl(recUrl),
|
||||||
|
this.name,
|
||||||
|
TvType.Anime,
|
||||||
|
image,
|
||||||
|
dubStatus =
|
||||||
|
if (recTitle.contains("(DUB)") || recTitle.contains("(Dub)")) EnumSet.of(
|
||||||
|
DubStatus.Dubbed
|
||||||
|
) else EnumSet.of(DubStatus.Subbed),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
val infodoc = doc.selectFirst("div.info .meta .col1").text()
|
||||||
|
val tvType = if (infodoc.contains("Movie")) TvType.AnimeMovie else TvType.Anime
|
||||||
|
val status =
|
||||||
|
if (infodoc.contains("Completed")) ShowStatus.Completed
|
||||||
|
else if (infodoc.contains("Airing")) ShowStatus.Ongoing
|
||||||
|
else null
|
||||||
|
val tags = doc.select("div.info .meta .col1 div:contains(Genre) a").map { it.text() }
|
||||||
|
return newAnimeLoadResponse(title, url, tvType) {
|
||||||
posterUrl = poster
|
posterUrl = poster
|
||||||
addEpisodes(DubStatus.Subbed, episodes)
|
addEpisodes(DubStatus.Subbed, episodes)
|
||||||
plot = description
|
plot = description
|
||||||
|
this.recommendations = recommendations
|
||||||
|
showStatus = status
|
||||||
|
this.tags = tags
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,10 +259,8 @@ class NineAnimeProvider : MainAPI() {
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit
|
||||||
): Boolean {
|
): Boolean {
|
||||||
val urlclean = data.substringAfter("watch/")
|
val document = app.get(data).document
|
||||||
val regexID = Regex("(\\.[a-zA-Z0-9]{0,8}[a-zA-Z0-9_-]+)")
|
val animeid = document.selectFirst("div.player-wrapper.watchpage").attr("data-id") ?: return false
|
||||||
val animeid = regexID.find(urlclean)?.value?.replace(".", "") ?: return false
|
|
||||||
|
|
||||||
val animeidencoded = encode(getVrf(animeid) ?: return false)
|
val animeidencoded = encode(getVrf(animeid) ?: return false)
|
||||||
|
|
||||||
Jsoup.parse(
|
Jsoup.parse(
|
||||||
|
|
Loading…
Reference in a new issue