diff --git a/src/es/animejl/build.gradle b/src/es/animejl/build.gradle new file mode 100644 index 0000000000..c203fa8001 --- /dev/null +++ b/src/es/animejl/build.gradle @@ -0,0 +1,20 @@ +ext { + extName = 'Animejl' + extClass = '.Animejl' + extVersionCode = 1 + isNsfw = true +} + +apply from: "$rootDir/common.gradle" + +dependencies { + implementation(project(':lib:yourupload-extractor')) + implementation(project(':lib:streamtape-extractor')) + implementation(project(':lib:okru-extractor')) + implementation(project(':lib:voe-extractor')) + implementation(project(':lib:streamwish-extractor')) + implementation(project(':lib:streamhidevid-extractor')) + implementation(project(':lib:universal-extractor')) + implementation(project(':lib:uqload-extractor')) + implementation(project(':lib:mp4upload-extractor')) +} \ No newline at end of file diff --git a/src/es/animejl/res/mipmap-hdpi/ic_launcher.png b/src/es/animejl/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000000..e095a591dd Binary files /dev/null and b/src/es/animejl/res/mipmap-hdpi/ic_launcher.png differ diff --git a/src/es/animejl/res/mipmap-mdpi/ic_launcher.png b/src/es/animejl/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000000..fae29dd5b6 Binary files /dev/null and b/src/es/animejl/res/mipmap-mdpi/ic_launcher.png differ diff --git a/src/es/animejl/res/mipmap-xhdpi/ic_launcher.png b/src/es/animejl/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000000..b4da302929 Binary files /dev/null and b/src/es/animejl/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/src/es/animejl/res/mipmap-xxhdpi/ic_launcher.png b/src/es/animejl/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000000..a5a6f04959 Binary files /dev/null and b/src/es/animejl/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/src/es/animejl/res/mipmap-xxxhdpi/ic_launcher.png b/src/es/animejl/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000000..fe3ab3284d Binary files /dev/null and b/src/es/animejl/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/src/es/animejl/src/eu/kanade/tachiyomi/animeextension/es/animejl/Animejl.kt b/src/es/animejl/src/eu/kanade/tachiyomi/animeextension/es/animejl/Animejl.kt new file mode 100644 index 0000000000..055b95edab --- /dev/null +++ b/src/es/animejl/src/eu/kanade/tachiyomi/animeextension/es/animejl/Animejl.kt @@ -0,0 +1,244 @@ +package eu.kanade.tachiyomi.animeextension.es.animejl + +import android.app.Application +import android.content.SharedPreferences +import android.util.Log +import androidx.preference.ListPreference +import androidx.preference.PreferenceScreen +import eu.kanade.tachiyomi.animesource.ConfigurableAnimeSource +import eu.kanade.tachiyomi.animesource.model.AnimeFilterList +import eu.kanade.tachiyomi.animesource.model.SAnime +import eu.kanade.tachiyomi.animesource.model.SEpisode +import eu.kanade.tachiyomi.animesource.model.Video +import eu.kanade.tachiyomi.animesource.online.ParsedAnimeHttpSource +import eu.kanade.tachiyomi.lib.mp4uploadextractor.Mp4uploadExtractor +import eu.kanade.tachiyomi.lib.okruextractor.OkruExtractor +import eu.kanade.tachiyomi.lib.streamhidevidextractor.StreamHideVidExtractor +import eu.kanade.tachiyomi.lib.streamtapeextractor.StreamTapeExtractor +import eu.kanade.tachiyomi.lib.streamwishextractor.StreamWishExtractor +import eu.kanade.tachiyomi.lib.universalextractor.UniversalExtractor +import eu.kanade.tachiyomi.lib.uqloadextractor.UqloadExtractor +import eu.kanade.tachiyomi.lib.voeextractor.VoeExtractor +import eu.kanade.tachiyomi.lib.youruploadextractor.YourUploadExtractor +import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.util.asJsoup +import okhttp3.Request +import okhttp3.Response +import org.jsoup.nodes.Document +import org.jsoup.nodes.Element +import uy.kohesive.injekt.Injekt +import uy.kohesive.injekt.api.get +import kotlin.Exception + +class Animejl : ConfigurableAnimeSource, ParsedAnimeHttpSource() { + + override val name = "Animejl" + + override val baseUrl = "https://www.anime-jl.net" + + 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 = "720" + private val QUALITY_LIST = arrayOf("1080", "720", "480", "360") + + private const val PREF_SERVER_KEY = "preferred_server" + private const val PREF_SERVER_DEFAULT = "StreamWish" + private val SERVER_LIST = arrayOf("StreamWish", "YourUpload", "Okru", "StreamTape", "StreamHideVid", "Voe", "Uqload", "Mp4upload") + } + + override fun popularAnimeSelector(): String = "div.Container ul.ListAnimes li article" + + override fun popularAnimeRequest(page: Int): Request = + GET("$baseUrl/animes?order=rating&page=$page") + + override fun popularAnimeFromElement(element: Element): SAnime { + val anime = SAnime.create() + anime.setUrlWithoutDomain(element.select("div.Description a.Button").attr("abs:href")) + anime.title = element.select("a h3").text() + anime.thumbnail_url = element.select("a div.Image figure img").attr("src").replace("/storage", "$baseUrl/storage") + anime.description = element.select("div.Description p:eq(2)").text().removeSurrounding("\"") + return anime + } + + override fun popularAnimeNextPageSelector(): String = "ul.pagination li a[rel=\"next\"]" + + override fun episodeListParse(response: Response): List { + val document = response.asJsoup() + val episodeList = mutableListOf() + + val script = document.select("script:containsData(var episodes =)").firstOrNull()?.data() ?: return emptyList() + + val episodesPattern = Regex("var episodes = (\\[.*?\\]);", RegexOption.DOT_MATCHES_ALL) + val episodesMatch = episodesPattern.find(script) ?: return emptyList() + val episodesString = episodesMatch.groupValues[1] + + val animeInfoPattern = Regex("var anime_info = \\[(.*?)\\];") + val animeInfoMatch = animeInfoPattern.find(script) ?: return emptyList() + val animeInfo = animeInfoMatch.groupValues[1].split(",").map { it.trim('"') } + + val animeSlug = animeInfo.getOrNull(2) ?: "" + val animeId = animeInfo.getOrNull(0) ?: "" + val episodePattern = Regex("\\[(\\d+),\"(.*?)\",\"(.*?)\",\"(.*?)\"\\]") + val episodeMatches = episodePattern.findAll(episodesString) + + episodeMatches.forEach { match -> + try { + val episodeNumber = match.groupValues[1].toIntOrNull() ?: 0 + val url = "$baseUrl/anime/$animeId/$animeSlug/episodio-$episodeNumber" + val episode = SEpisode.create() + episode.setUrlWithoutDomain(url) + episode.episode_number = episodeNumber.toFloat() + episode.name = "Episodio $episodeNumber" + episodeList.add(episode) + } catch (e: Exception) { + Log.e("Animejl", "Error processing episode: ${e.message}") + } + } + + return episodeList.sortedByDescending { it.episode_number } + } + + override fun episodeListSelector() = "uwu" + + override fun episodeFromElement(element: Element) = throw UnsupportedOperationException() + + /*--------------------------------Video extractors------------------------------------*/ + private val streamTapeExtractor by lazy { StreamTapeExtractor(client) } + private val okruExtractor by lazy { OkruExtractor(client) } + private val yourUploadExtractor by lazy { YourUploadExtractor(client) } + private val streamWishExtractor by lazy { StreamWishExtractor(client, headers) } + private val universalExtractor by lazy { UniversalExtractor(client) } + private val streamHideVidExtractor by lazy { StreamHideVidExtractor(client) } + private val voeExtractor by lazy { VoeExtractor(client) } + private val uqloadExtractor by lazy { UqloadExtractor(client) } + private val mp4uploadExtractor by lazy { Mp4uploadExtractor(client) } + + override fun videoListParse(response: Response): List