diff --git a/src/es/monoschinos/build.gradle b/src/es/monoschinos/build.gradle index b52059df9a..ee2433ec98 100644 --- a/src/es/monoschinos/build.gradle +++ b/src/es/monoschinos/build.gradle @@ -1,7 +1,7 @@ ext { extName = 'MonosChinos' extClass = '.MonosChinos' - extVersionCode = 31 + extVersionCode = 32 } apply from: "$rootDir/common.gradle" diff --git a/src/es/monoschinos/src/eu/kanade/tachiyomi/animeextension/es/monoschinos/MonosChinos.kt b/src/es/monoschinos/src/eu/kanade/tachiyomi/animeextension/es/monoschinos/MonosChinos.kt index 47c909a61b..f28a2636fb 100644 --- a/src/es/monoschinos/src/eu/kanade/tachiyomi/animeextension/es/monoschinos/MonosChinos.kt +++ b/src/es/monoschinos/src/eu/kanade/tachiyomi/animeextension/es/monoschinos/MonosChinos.kt @@ -25,7 +25,6 @@ import eu.kanade.tachiyomi.lib.voeextractor.VoeExtractor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.util.asJsoup import eu.kanade.tachiyomi.util.parallelCatchingFlatMapBlocking -import eu.kanade.tachiyomi.util.parseAs import okhttp3.FormBody import okhttp3.Request import okhttp3.Response @@ -38,7 +37,7 @@ class MonosChinos : ConfigurableAnimeSource, AnimeHttpSource() { override val name = "MonosChinos" - override val baseUrl = "https://monoschinos2.com" + override val baseUrl = "https://monoschinos2.net" override val id = 6957694006954649296 @@ -81,7 +80,7 @@ class MonosChinos : ConfigurableAnimeSource, AnimeHttpSource() { status = document.select(".lh-sm .ms-2").eachText().let { items -> when { items.any { it.contains("Finalizado") } -> SAnime.COMPLETED - items.any { it.contains("Estreno") } -> SAnime.ONGOING + items.any { it.contains("En emision") || it.contains("Estreno") } -> SAnime.ONGOING else -> SAnime.UNKNOWN } } @@ -89,12 +88,12 @@ class MonosChinos : ConfigurableAnimeSource, AnimeHttpSource() { return animeDetails } - override fun popularAnimeRequest(page: Int) = GET("$baseUrl/animes?p=$page", headers) + override fun popularAnimeRequest(page: Int) = GET("$baseUrl/animes?pag=$page", headers) override fun popularAnimeParse(response: Response): AnimesPage { val document = response.asJsoup() val elements = document.select(".ficha_efecto a") - val nextPage = document.select(".pagination [rel=\"next\"]").any() + val nextPage = document.select(".pagination [title=\"Siguiente página\"]").any() val animeList = elements.map { element -> SAnime.create().apply { title = element.selectFirst(".title_cap")!!.text() @@ -107,13 +106,13 @@ class MonosChinos : ConfigurableAnimeSource, AnimeHttpSource() { override fun latestUpdatesParse(response: Response) = popularAnimeParse(response) - override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/emision?p=$page", headers) + override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/animes?estado=en+emision&pag=$page", headers) override fun searchAnimeRequest(page: Int, query: String, filters: AnimeFilterList): Request { val params = MonosChinosFilters.getSearchParameters(filters) return when { - query.isNotBlank() -> GET("$baseUrl/buscar?q=$query", headers) - params.filter.isNotBlank() -> GET("$baseUrl/animes${params.getQuery()}&p=$page", headers) + query.isNotBlank() -> GET("$baseUrl/animes?buscar=$query&pag=$page", headers) + params.filter.isNotBlank() -> GET("$baseUrl/animes${params.getQuery()}&pag=$page", headers) else -> popularAnimeRequest(page) } } @@ -122,31 +121,50 @@ class MonosChinos : ConfigurableAnimeSource, AnimeHttpSource() { override fun episodeListParse(response: Response): List { val document = response.asJsoup() - val token = document.select("meta[name='csrf-token']").attr("content") - val capListLink = document.select(".caplist").attr("data-ajax") val referer = document.location() + val dt = document.select("#dt") - val detail = getEpisodeDetails(capListLink, token, referer) - val total = detail.eps.size - val perPage = detail.perpage ?: return emptyList() + val total = dt.attr("data-e").toInt() + val perPage = 50.0 val pages = (total / perPage).ceilPage() + val i = dt.attr("data-i") + val u = dt.attr("data-u") + var pageIdx = 1 return (1..pages).parallelCatchingFlatMapBlocking { - getEpisodePage(detail.paginateUrl ?: "", it, token, referer).caps.mapIndexed { idx, ep -> - val episodeNumber = (ep.episodio ?: (idx + 1)) - SEpisode.create().apply { - name = "Capítulo $episodeNumber" - episode_number = episodeNumber.toFloat() - setUrlWithoutDomain(ep.url ?: "") - } - } - }.reversed() + val formBody = FormBody.Builder() + .add("acc", "episodes") + .add("i", i) + .add("u", u) + .add("p", pageIdx.toString()) + .build() + + val request = Request.Builder() + .url("$baseUrl/ajax_pagination") + .post(formBody) + .header("accept", "application/json, text/javascript, */*; q=0.01") + .header("accept-language", "es-419,es;q=0.8") + .header("content-type", "application/x-www-form-urlencoded; charset=UTF-8") + .header("origin", baseUrl) + .header("referer", referer) + .header("x-requested-with", "XMLHttpRequest") + .build() + pageIdx++ + + client.newCall(request).execute().getEpisodes() + } } - private fun getEpisodeDetails(capListLink: String, token: String, referer: String): EpisodesDto { - val formBody = FormBody.Builder().add("_token", token).build() + override fun videoListParse(response: Response): List