This commit is contained in:
Diego Sánchez 2023-03-03 04:37:37 +00:00 committed by GitHub
commit 8218472492
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 6 deletions

View File

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 2 version = 3
cloudstream { cloudstream {

View File

@ -23,11 +23,14 @@ class MundoDonghuaProvider : MainAPI() {
TvType.Anime, TvType.Anime,
) )
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse { abstract class SpecialEpisodes {
abstract var docFinal = AbstractMap()
}
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse, SpecialEpisodes {
val urls = listOf( val urls = listOf(
Pair("$mainUrl/lista-donghuas", "Donghuas"), Pair("$mainUrl/lista-donghuas", "Donghuas"),
) )
val items = ArrayList<HomePageList>() val items = ArrayList<HomePageList>()
items.add( items.add(
HomePageList( HomePageList(
@ -41,6 +44,7 @@ class MundoDonghuaProvider : MainAPI() {
val epNumRemoveRegex = Regex("/" + epNum.toString() + "/.*") val epNumRemoveRegex = Regex("/" + epNum.toString() + "/.*")
val url = it.selectFirst("a")?.attr("href")?.replace(epRegex,"")?.replace("/ver/","/donghua/")?.replace(epNumRemoveRegex,"") val url = it.selectFirst("a")?.attr("href")?.replace(epRegex,"")?.replace("/ver/","/donghua/")?.replace(epNumRemoveRegex,"")
val dubstat = if (title.contains("Latino") || title.contains("Castellano")) DubStatus.Dubbed else DubStatus.Subbed val dubstat = if (title.contains("Latino") || title.contains("Castellano")) DubStatus.Dubbed else DubStatus.Subbed
override var docFinal = app.get(mainUrl, timeout = 120).document
newAnimeSearchResponse(title.replace(Regex("Episodio|(\\d+)"),"").trim(), fixUrl(url ?: "")) { newAnimeSearchResponse(title.replace(Regex("Episodio|(\\d+)"),"").trim(), fixUrl(url ?: "")) {
this.posterUrl = fixUrl(poster ?: "") this.posterUrl = fixUrl(poster ?: "")
addDubStatus(dubstat, epNum) addDubStatus(dubstat, epNum)
@ -91,7 +95,7 @@ class MundoDonghuaProvider : MainAPI() {
} }
} }
override suspend fun load(url: String): LoadResponse { override suspend fun load(url: String): LoadResponse, SpecialEpisodes {
val doc = app.get(url, timeout = 120).document val doc = app.get(url, timeout = 120).document
val poster = doc.selectFirst("head meta[property=og:image]")?.attr("content") ?: "" val poster = doc.selectFirst("head meta[property=og:image]")?.attr("content") ?: ""
val title = doc.selectFirst(".ls-title-serie")?.text() ?: "" val title = doc.selectFirst(".ls-title-serie")?.text() ?: ""
@ -102,16 +106,26 @@ class MundoDonghuaProvider : MainAPI() {
"Finalizada" -> ShowStatus.Completed "Finalizada" -> ShowStatus.Completed
else -> null else -> null
} }
val specialEpisodes = docFinal.select("div.sm-row.bg-white.pt-10.pr-20.pb-15.pl-20 div.item.col-lg-2.col-md-2.col-xs-4").mapNotNull {
val name = it.selectFirst("h5")?.text()?.replace("Episodio","-") ?: ""
val link = it.selectFirst("a")?.attr("href") ?: ""
if (name.contains(title, true)) {
Episode(fixUrl(link), name)
} else {
null
}
}.reversed()
val episodes = doc.select("ul.donghua-list a").map { val episodes = doc.select("ul.donghua-list a").map {
val name = it.selectFirst(".fs-16")?.text() val name = it.selectFirst(".fs-16")?.text()
val link = it.attr("href") val link = it.attr("href")
Episode(fixUrl(link), name) Episode(fixUrl(link), name)
}.reversed() }.reversed()
val episodesFinal = episodes + specialEpisodes
val typeinfo = doc.select("div.row div.col-md-6.pl-15 p.fc-dark").text() val typeinfo = doc.select("div.row div.col-md-6.pl-15 p.fc-dark").text()
val tvType = if (typeinfo.contains(Regex("Tipo.*Pel.cula"))) TvType.AnimeMovie else TvType.Anime val tvType = if (typeinfo.contains(Regex("Tipo.*Pel.cula"))) TvType.AnimeMovie else TvType.Anime
return newAnimeLoadResponse(title, url, tvType) { return newAnimeLoadResponse(title, url, tvType) {
posterUrl = poster posterUrl = poster
addEpisodes(DubStatus.Subbed, episodes) addEpisodes(DubStatus.Subbed, episodesFinal)
showStatus = status showStatus = status
plot = description plot = description
tags = genres tags = genres
@ -215,4 +229,4 @@ class MundoDonghuaProvider : MainAPI() {
} }
return true return true
} }
} }