From e86091ab7180fa363b480721e6285bddca27e313 Mon Sep 17 00:00:00 2001 From: Edgard Date: Fri, 31 May 2024 09:34:58 -0300 Subject: [PATCH] chore: Some fixes for pt/doramogo --- src/pt/doramogo/build.gradle | 3 +- .../animeextension/pt/doramogo/Doramogo.kt | 78 +++++++------------ .../pt/doramogo/DoramogoFilters.kt | 40 +++++++++- .../doramogo/extractors/DoramogoExtractor.kt | 1 - 4 files changed, 70 insertions(+), 52 deletions(-) diff --git a/src/pt/doramogo/build.gradle b/src/pt/doramogo/build.gradle index c98bce4224..c38a2e34ba 100644 --- a/src/pt/doramogo/build.gradle +++ b/src/pt/doramogo/build.gradle @@ -9,6 +9,7 @@ apply from: "$rootDir/common.gradle" dependencies { implementation(project(':lib:dailymotion-extractor')) implementation(project(":lib:googledrive-extractor")) + implementation(project(":lib:okru-extractor")) implementation(project(":lib:playlist-utils")) implementation("dev.datlag.jsunpacker:jsunpacker:1.0.1") -} \ No newline at end of file +} diff --git a/src/pt/doramogo/src/eu/kanade/tachiyomi/animeextension/pt/doramogo/Doramogo.kt b/src/pt/doramogo/src/eu/kanade/tachiyomi/animeextension/pt/doramogo/Doramogo.kt index df33775571..58064616da 100644 --- a/src/pt/doramogo/src/eu/kanade/tachiyomi/animeextension/pt/doramogo/Doramogo.kt +++ b/src/pt/doramogo/src/eu/kanade/tachiyomi/animeextension/pt/doramogo/Doramogo.kt @@ -9,18 +9,16 @@ import eu.kanade.tachiyomi.animesource.model.Video import eu.kanade.tachiyomi.animesource.online.ParsedAnimeHttpSource import eu.kanade.tachiyomi.lib.dailymotionextractor.DailymotionExtractor import eu.kanade.tachiyomi.lib.googledriveextractor.GoogleDriveExtractor +import eu.kanade.tachiyomi.lib.okruextractor.OkruExtractor import eu.kanade.tachiyomi.lib.playlistutils.PlaylistUtils import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.awaitSuccess import eu.kanade.tachiyomi.util.asJsoup import eu.kanade.tachiyomi.util.parallelCatchingFlatMapBlocking -import eu.kanade.tachiyomi.util.parseAs -import kotlinx.serialization.Serializable import okhttp3.HttpUrl import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.Request import okhttp3.Response -import org.jsoup.Jsoup import org.jsoup.nodes.Document import org.jsoup.nodes.Element @@ -28,7 +26,7 @@ class Doramogo : ParsedAnimeHttpSource() { override val name = "Doramogo" - override val baseUrl = "https://doramogo.com/" + override val baseUrl = "https://doramogo.com" override val lang = "pt-BR" @@ -77,52 +75,25 @@ class Doramogo : ParsedAnimeHttpSource() { return AnimesPage(listOf(details), false) } - @Serializable - data class SearchResponseDto( - val results: List, - val page: Int, - val total_page: Int = 1, - ) - - private val searchToken by lazy { - client.newCall(GET("$baseUrl/lista-de-animes", headers)).execute() - .asJsoup() - .selectFirst("div.menu_filter_box")!! - .attr("data-secury") - } - override fun getFilterList() = DoramogoFilters.FILTER_LIST override fun searchAnimeRequest(page: Int, query: String, filters: AnimeFilterList): Request { val params = DoramogoFilters.getSearchParameters(filters) - val url = "$baseUrl/search/$query".toHttpUrl().newBuilder() + val url = "$baseUrl/search".toHttpUrl().newBuilder() + .addPathSegment(query) .addIfNotBlank("filter_audio", params.audio) .addIfNotBlank("filter_genre", params.genre) .build() - .toString() return GET(url, headers = headers) } - override fun searchAnimeParse(response: Response): AnimesPage { - return runCatching { - val data = response.parseAs() - val animes = data.results.map(Jsoup::parse) - .mapNotNull { it.selectFirst(searchAnimeSelector()) } - .map(::searchAnimeFromElement) - val hasNext = data.total_page > data.page - AnimesPage(animes, hasNext) - }.getOrElse { AnimesPage(emptyList(), false) } - } - override fun searchAnimeSelector() = popularAnimeSelector() override fun searchAnimeFromElement(element: Element) = popularAnimeFromElement(element) - override fun searchAnimeNextPageSelector(): String? { - throw UnsupportedOperationException() - } + override fun searchAnimeNextPageSelector() = null // =========================== Anime Details ============================ override fun animeDetailsParse(document: Document) = SAnime.create().apply { @@ -152,32 +123,26 @@ class Doramogo : ParsedAnimeHttpSource() { override fun videoListParse(response: Response): List