diff --git a/src/ar/arabanime/build.gradle b/src/ar/arabanime/build.gradle index bb0df8e9cf..1318eb5e23 100644 --- a/src/ar/arabanime/build.gradle +++ b/src/ar/arabanime/build.gradle @@ -1,6 +1,8 @@ -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply plugin: 'kotlinx-serialization' +plugins { + alias(libs.plugins.android.application) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.kotlin.serialization) +} ext { extName = 'ArabAnime' diff --git a/src/ar/arabanime/src/eu/kanade/tachiyomi/animeextension/ar/arabanime/ArabAnime.kt b/src/ar/arabanime/src/eu/kanade/tachiyomi/animeextension/ar/arabanime/ArabAnime.kt index eb8ec4f46c..5f375111c8 100644 --- a/src/ar/arabanime/src/eu/kanade/tachiyomi/animeextension/ar/arabanime/ArabAnime.kt +++ b/src/ar/arabanime/src/eu/kanade/tachiyomi/animeextension/ar/arabanime/ArabAnime.kt @@ -47,6 +47,8 @@ class ArabAnime : ConfigurableAnimeSource, AnimeHttpSource() { } // ============================== Popular =============================== + override fun popularAnimeRequest(page: Int): Request = GET("$baseUrl/api?page=$page") + override fun popularAnimeParse(response: Response): AnimesPage { val responseJson = json.decodeFromString(response.body.string()) val animeList = responseJson.Shows.mapNotNull { @@ -63,60 +65,85 @@ class ArabAnime : ConfigurableAnimeSource, AnimeHttpSource() { return AnimesPage(animeList, hasNextPage) } - override fun popularAnimeRequest(page: Int): Request = GET("$baseUrl/api?page=$page") + // =============================== Latest =============================== + override fun latestUpdatesRequest(page: Int) = GET(baseUrl) - // ============================== Episodes ============================== - override fun episodeListParse(response: Response): List { - val showData = response.asJsoup().select("div#data").text().decodeBase64() - val episodesJson = json.decodeFromString(showData) - return episodesJson.EPS.map { - SEpisode.create().apply { - name = it.episode_name - episode_number = it.episode_number.toFloat() - setUrlWithoutDomain(it.`info-src`) + override fun latestUpdatesParse(response: Response): AnimesPage { + val latestEpisodes = response.use { it.asJsoup() }.select("div.as-episode") + val animeList = latestEpisodes.map { + SAnime.create().apply { + val ahref = it.selectFirst("a.as-info")!! + title = ahref.text() + val url = ahref.attr("href").replace("watch", "show").substringBeforeLast("/") + setUrlWithoutDomain(url) + + thumbnail_url = it.selectFirst("img")?.absUrl("src") } - }.reversed() + } + return AnimesPage(animeList, false) } - // ============================ Video Links ============================= - override fun videoListRequest(episode: SEpisode): Request = GET("$baseUrl/${episode.url}") + // =============================== Search =============================== + override fun searchAnimeRequest(page: Int, query: String, filters: AnimeFilterList): Request { + return if (query.isNotEmpty()) { + val body = FormBody.Builder().add("searchq", query).build() + POST("$baseUrl/searchq", body = body) + } else { + val type = filters.asQueryPart() + val status = filters.asQueryPart() + val order = filters.asQueryPart() + GET("$baseUrl/api?order=$order&type=$type&stat=$status&tags=&page=$page") + } + } - override fun videoListParse(response: Response): List