diff --git a/src/es/veohentai/build.gradle b/src/es/veohentai/build.gradle new file mode 100644 index 00000000..c58a952b --- /dev/null +++ b/src/es/veohentai/build.gradle @@ -0,0 +1,8 @@ +ext { + extName = 'VeoHentai' + extClass = '.VeoHentai' + extVersionCode = 1 + isNsfw = true +} + +apply from: "$rootDir/common.gradle" \ No newline at end of file diff --git a/src/es/veohentai/res/mipmap-hdpi/ic_launcher.png b/src/es/veohentai/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 00000000..f9806b8c Binary files /dev/null and b/src/es/veohentai/res/mipmap-hdpi/ic_launcher.png differ diff --git a/src/es/veohentai/res/mipmap-mdpi/ic_launcher.png b/src/es/veohentai/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 00000000..149425a8 Binary files /dev/null and b/src/es/veohentai/res/mipmap-mdpi/ic_launcher.png differ diff --git a/src/es/veohentai/res/mipmap-xhdpi/ic_launcher.png b/src/es/veohentai/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 00000000..e6b4f071 Binary files /dev/null and b/src/es/veohentai/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/src/es/veohentai/res/mipmap-xxhdpi/ic_launcher.png b/src/es/veohentai/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 00000000..01f970e4 Binary files /dev/null and b/src/es/veohentai/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/src/es/veohentai/res/mipmap-xxxhdpi/ic_launcher.png b/src/es/veohentai/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 00000000..16a6bea4 Binary files /dev/null and b/src/es/veohentai/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/src/es/veohentai/src/eu/kanade/tachiyomi/animeextension/es/veohentai/VeoHentai.kt b/src/es/veohentai/src/eu/kanade/tachiyomi/animeextension/es/veohentai/VeoHentai.kt new file mode 100644 index 00000000..134965c0 --- /dev/null +++ b/src/es/veohentai/src/eu/kanade/tachiyomi/animeextension/es/veohentai/VeoHentai.kt @@ -0,0 +1,259 @@ +package eu.kanade.tachiyomi.animeextension.es.veohentai + +import android.app.Application +import android.content.SharedPreferences +import androidx.preference.ListPreference +import androidx.preference.PreferenceScreen +import eu.kanade.tachiyomi.animesource.ConfigurableAnimeSource +import eu.kanade.tachiyomi.animesource.model.AnimeFilter +import eu.kanade.tachiyomi.animesource.model.AnimeFilterList +import eu.kanade.tachiyomi.animesource.model.AnimesPage +import eu.kanade.tachiyomi.animesource.model.SAnime +import eu.kanade.tachiyomi.animesource.model.SEpisode +import eu.kanade.tachiyomi.animesource.model.Track +import eu.kanade.tachiyomi.animesource.model.Video +import eu.kanade.tachiyomi.animesource.online.AnimeHttpSource +import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.util.asJsoup +import okhttp3.HttpUrl.Companion.toHttpUrl +import okhttp3.Request +import okhttp3.Response +import uy.kohesive.injekt.Injekt +import uy.kohesive.injekt.api.get + +open class VeoHentai : ConfigurableAnimeSource, AnimeHttpSource() { + + override val name = "VeoHentai" + + override val baseUrl = "https://veohentai.com" + + override val lang = "es" + + override val supportsLatest = true + + private val preferences: SharedPreferences by lazy { + Injekt.get().getSharedPreferences("source_$id", 0x0000) + } + + companion object { + private const val PREF_QUALITY_KEY = "preferred_quality" + private const val PREF_QUALITY_DEFAULT = "1080" + private val QUALITY_LIST = arrayOf("1080", "720", "480", "360") + + private const val PREF_SERVER_KEY = "preferred_server" + private const val PREF_SERVER_DEFAULT = "VeoHentai" + private val SERVER_LIST = arrayOf("VeoHentai") + } + + override fun animeDetailsParse(response: Response): SAnime { + val document = response.asJsoup() + val animeDetails = SAnime.create().apply { + title = document.selectFirst(".pb-2 h1")?.text()?.trim() ?: "" + status = SAnime.UNKNOWN + description = document.select(".entry-content p").joinToString { it.text() } + genre = document.select(".tags a").joinToString { it.text() } + thumbnail_url = document.selectFirst("#thumbnail-post img")?.getImageUrl() + document.select(".gap-4 div").map { it.text() }.map { textContent -> + when { + "Marca" in textContent -> author = textContent.substringAfter("Marca").trim() + } + } + } + return animeDetails + } + + override fun popularAnimeRequest(page: Int) = GET("$baseUrl/mas-visitados/page/$page", headers) + + override fun popularAnimeParse(response: Response): AnimesPage { + val document = response.asJsoup() + val elements = document.select(".gap-6 a") + val nextPage = document.select(".nav-links a:contains(Next)").any() + val animeList = elements.map { element -> + SAnime.create().apply { + title = element.selectFirst("h2")?.text()?.trim() ?: "" + thumbnail_url = element.selectFirst("img:not([class*=cover])")?.getImageUrl() + setUrlWithoutDomain(element.attr("abs:href")) + } + } + return AnimesPage(animeList, nextPage) + } + + override fun latestUpdatesParse(response: Response) = popularAnimeParse(response) + + override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/page/$page", headers) + + override fun searchAnimeRequest(page: Int, query: String, filters: AnimeFilterList): Request { + val filterList = if (filters.isEmpty()) getFilterList() else filters + val genreFilter = filterList.find { it is GenreFilter } as GenreFilter + + return when { + query.isNotBlank() -> GET("$baseUrl/page/$page/?s=$query", headers) + genreFilter.state != 0 -> GET("$baseUrl/${genreFilter.toUriPart()}/page/$page", headers) + else -> popularAnimeRequest(page) + } + } + + override fun searchAnimeParse(response: Response) = popularAnimeParse(response) + + override fun episodeListParse(response: Response): List { + val document = response.asJsoup() + return listOf( + SEpisode.create().apply { + episode_number = 1f + name = "Capítulo" + setUrlWithoutDomain(document.location()) + }, + ) + } + + override fun videoListParse(response: Response): List