From 985c5195aff0c6bb81ed69195c714383a1c1bf4d Mon Sep 17 00:00:00 2001 From: Guaxinim5573 Date: Fri, 22 Sep 2023 23:56:24 -0300 Subject: [PATCH 1/3] Fix AnimesDigital not parsing all episodes from animes with more than 25 episodes --- .../pt/animesdigital/AnimesDigital.kt | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/pt/animesdigital/src/eu/kanade/tachiyomi/animeextension/pt/animesdigital/AnimesDigital.kt b/src/pt/animesdigital/src/eu/kanade/tachiyomi/animeextension/pt/animesdigital/AnimesDigital.kt index 5fa82b0c31..6d97dff46e 100644 --- a/src/pt/animesdigital/src/eu/kanade/tachiyomi/animeextension/pt/animesdigital/AnimesDigital.kt +++ b/src/pt/animesdigital/src/eu/kanade/tachiyomi/animeextension/pt/animesdigital/AnimesDigital.kt @@ -57,7 +57,22 @@ class AnimesDigital : ConfigurableAnimeSource, ParsedAnimeHttpSource() { // ============================== Episodes ============================== override fun episodeListParse(response: Response): List { val doc = getRealDoc(response.asJsoup()) - return doc.select(episodeListSelector()).map(::episodeFromElement) + val pagination = doc.selectFirst("ul.content-pagination") + return if (pagination != null) { + val episodes = emptyList().toMutableList() + episodes += doc.select(episodeListSelector()).map(::episodeFromElement) + val lastPage = doc.selectFirst("ul.content-pagination > li:nth-last-child(2) > span")!!.text().toInt() + for (i in 2..lastPage) { + val request = Request.Builder() + .url(response.request.url.toString() + "/page/$i") + .addHeader("Referer", baseUrl) + .build() + val res = client.newCall(request).execute() + val pageDoc = getRealDoc(res.asJsoup()) + episodes += pageDoc.select(episodeListSelector()).map(::episodeFromElement) + } + episodes + } else doc.select(episodeListSelector()).map(::episodeFromElement) } override fun episodeFromElement(element: Element) = SEpisode.create().apply { From 28b3723a20eaf4faeccf79deed8cc4d386667c36 Mon Sep 17 00:00:00 2001 From: Guaxinim5573 Date: Fri, 22 Sep 2023 23:58:45 -0300 Subject: [PATCH 2/3] Update AnimesDigital version --- src/pt/animesdigital/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pt/animesdigital/build.gradle b/src/pt/animesdigital/build.gradle index 9a6f3ef16c..051efdcbd3 100644 --- a/src/pt/animesdigital/build.gradle +++ b/src/pt/animesdigital/build.gradle @@ -8,7 +8,7 @@ ext { extName = 'Animes Digital' pkgNameSuffix = 'pt.animesdigital' extClass = '.AnimesDigital' - extVersionCode = 1 + extVersionCode = 2 libVersion = '13' } From 86611236695454eb59577003832e6c4c1bae88d4 Mon Sep 17 00:00:00 2001 From: Guaxinim5573 Date: Sat, 23 Sep 2023 04:03:23 -0300 Subject: [PATCH 3/3] Apply suggested changes --- .../animeextension/pt/animesdigital/AnimesDigital.kt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/pt/animesdigital/src/eu/kanade/tachiyomi/animeextension/pt/animesdigital/AnimesDigital.kt b/src/pt/animesdigital/src/eu/kanade/tachiyomi/animeextension/pt/animesdigital/AnimesDigital.kt index 6d97dff46e..417879f6c8 100644 --- a/src/pt/animesdigital/src/eu/kanade/tachiyomi/animeextension/pt/animesdigital/AnimesDigital.kt +++ b/src/pt/animesdigital/src/eu/kanade/tachiyomi/animeextension/pt/animesdigital/AnimesDigital.kt @@ -59,16 +59,13 @@ class AnimesDigital : ConfigurableAnimeSource, ParsedAnimeHttpSource() { val doc = getRealDoc(response.asJsoup()) val pagination = doc.selectFirst("ul.content-pagination") return if (pagination != null) { - val episodes = emptyList().toMutableList() + val episodes = mutableListOf() episodes += doc.select(episodeListSelector()).map(::episodeFromElement) val lastPage = doc.selectFirst("ul.content-pagination > li:nth-last-child(2) > span")!!.text().toInt() for (i in 2..lastPage) { - val request = Request.Builder() - .url(response.request.url.toString() + "/page/$i") - .addHeader("Referer", baseUrl) - .build() + val request = GET(doc.location() + "/page/$i", headers) val res = client.newCall(request).execute() - val pageDoc = getRealDoc(res.asJsoup()) + val pageDoc = res.use { it.asJsoup() } episodes += pageDoc.select(episodeListSelector()).map(::episodeFromElement) } episodes