From 8be06e492a7db534dcc2573a95700de8a0dcc250 Mon Sep 17 00:00:00 2001 From: hollow <35398794+hollowshiroyuki@users.noreply.github.com> Date: Mon, 10 Jun 2024 20:37:42 +0000 Subject: [PATCH] fix(fr/animesama): Latest page (#3323) --- src/fr/animesama/build.gradle | 2 +- .../animeextension/fr/animesama/AnimeSama.kt | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/fr/animesama/build.gradle b/src/fr/animesama/build.gradle index 3ba664a58c..e3cc5ca1f0 100644 --- a/src/fr/animesama/build.gradle +++ b/src/fr/animesama/build.gradle @@ -1,7 +1,7 @@ ext { extName = 'Anime-Sama' extClass = '.AnimeSama' - extVersionCode = 9 + extVersionCode = 10 } apply from: "$rootDir/common.gradle" diff --git a/src/fr/animesama/src/eu/kanade/tachiyomi/animeextension/fr/animesama/AnimeSama.kt b/src/fr/animesama/src/eu/kanade/tachiyomi/animeextension/fr/animesama/AnimeSama.kt index 3089c097bb..fa94d5d96d 100644 --- a/src/fr/animesama/src/eu/kanade/tachiyomi/animeextension/fr/animesama/AnimeSama.kt +++ b/src/fr/animesama/src/eu/kanade/tachiyomi/animeextension/fr/animesama/AnimeSama.kt @@ -19,6 +19,7 @@ import eu.kanade.tachiyomi.util.asJsoup import eu.kanade.tachiyomi.util.parallelCatchingFlatMap import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json +import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.Request import okhttp3.Response import uy.kohesive.injekt.Injekt @@ -64,9 +65,13 @@ class AnimeSama : ConfigurableAnimeSource, AnimeHttpSource() { // =============================== Latest =============================== override fun latestUpdatesParse(response: Response): AnimesPage { val animes = response.asJsoup() - val seasons = animes.select("h2:contains(derniers ajouts) + .scrollBarStyled > div").flatMap { - val animeUrl = it.getElementsByTag("a").attr("href") - fetchAnimeSeasons(animeUrl) + val seasons = animes.select("#containerAjoutsAnimes > div").flatMap { + val animeUrl = it.getElementsByTag("a").attr("href").toHttpUrl() + val url = animeUrl.newBuilder() + .removePathSegment(animeUrl.pathSize - 2) + .removePathSegment(animeUrl.pathSize - 3) + .build() + fetchAnimeSeasons(url.toString()) } return AnimesPage(seasons, false) }