From c9bab3ff85b3c673bc8f72dcd7a2b75410e9403f Mon Sep 17 00:00:00 2001 From: imper1aldev Date: Wed, 4 Oct 2023 14:07:31 -0600 Subject: [PATCH] Updates --- .../com/lagradost/AnimefenixProvider.kt | 2 +- HentaiLAProvider/build.gradle.kts | 25 ++++ HentaiLAProvider/src/main/AndroidManifest.xml | 2 + .../kotlin/com/lagradost/HentaiLAProvider.kt | 112 ++++++++++++++++++ .../com/lagradost/HentaiLAProviderPlugin.kt | 14 +++ .../kotlin/com/lagradost/YomirollProvider.kt | 4 +- settings.gradle.kts | 2 +- 7 files changed, 157 insertions(+), 4 deletions(-) create mode 100644 HentaiLAProvider/build.gradle.kts create mode 100644 HentaiLAProvider/src/main/AndroidManifest.xml create mode 100644 HentaiLAProvider/src/main/kotlin/com/lagradost/HentaiLAProvider.kt create mode 100644 HentaiLAProvider/src/main/kotlin/com/lagradost/HentaiLAProviderPlugin.kt diff --git a/AnimefenixProvider/src/main/kotlin/com/lagradost/AnimefenixProvider.kt b/AnimefenixProvider/src/main/kotlin/com/lagradost/AnimefenixProvider.kt index 203fa8d..a5b8ff8 100644 --- a/AnimefenixProvider/src/main/kotlin/com/lagradost/AnimefenixProvider.kt +++ b/AnimefenixProvider/src/main/kotlin/com/lagradost/AnimefenixProvider.kt @@ -12,7 +12,7 @@ import java.util.* class AnimefenixProvider:MainAPI() { - override var mainUrl = "https://animefenix.com" + override var mainUrl = "https://animefenix.tv" override var name = "Animefenix" override var lang = "es" override val hasMainPage = true diff --git a/HentaiLAProvider/build.gradle.kts b/HentaiLAProvider/build.gradle.kts new file mode 100644 index 0000000..57aa0e4 --- /dev/null +++ b/HentaiLAProvider/build.gradle.kts @@ -0,0 +1,25 @@ +// use an integer for version numbers +version = 1 + + +cloudstream { + language = "es" + // All of these properties are optional, you can safely remove them + + // description = "Lorem Ipsum" + // authors = listOf("Cloudburst") + + /** + * Status int as the following: + * 0: Down + * 1: Ok + * 2: Slow + * 3: Beta only + * */ + status = 1 // will be 3 if unspecified + tvTypes = listOf( + "Anime", "AnimeMovie", "OVA" + ) + + iconUrl = "https://www.google.com/s2/favicons?domain=www.zonevipz.com&sz=%size%" +} \ No newline at end of file diff --git a/HentaiLAProvider/src/main/AndroidManifest.xml b/HentaiLAProvider/src/main/AndroidManifest.xml new file mode 100644 index 0000000..29aec9d --- /dev/null +++ b/HentaiLAProvider/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/HentaiLAProvider/src/main/kotlin/com/lagradost/HentaiLAProvider.kt b/HentaiLAProvider/src/main/kotlin/com/lagradost/HentaiLAProvider.kt new file mode 100644 index 0000000..1605d2f --- /dev/null +++ b/HentaiLAProvider/src/main/kotlin/com/lagradost/HentaiLAProvider.kt @@ -0,0 +1,112 @@ +package com.lagradost + +import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.Qualities +import java.util.* + +class HentaiLAProvider : MainAPI() { + + override var mainUrl = "https://hentaila.tv" + override var name = "HentaiLA" + override var lang = "es" + override val hasMainPage = true + override val hasChromecastSupport = true + override val hasDownloadSupport = true + + override val supportedTypes = setOf( + TvType.Anime, TvType.AnimeMovie, TvType.OVA + ) + + override val mainPage = mainPageOf( + Pair("$mainUrl/page/%d/?m_orderby=latest", "Recientes"), + Pair("$mainUrl/page/%d/?m_orderby=rating", "Populares") + ) + + override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse { + val items = ArrayList() + val soup = app.get(String.format(request.data, page)).document + val hasNextPage = soup.select(".wp-pagenavi a.nextpostslink").any() + + val home = soup.select(".item_card").map { + val title = it.selectFirst("a .card__title")!!.text() + val poster = it.selectFirst("a img")!!.attr("abs:src") + AnimeSearchResponse( + title, + fixUrl(it.selectFirst("a")!!.attr("abs:href")), + this.name, + TvType.Anime, + poster, + null, + EnumSet.of(DubStatus.Subbed) + ) + } + + items.add(HomePageList(request.name, home)) + if (items.size <= 0) throw ErrorLoadingException() + return HomePageResponse(items, hasNextPage) + } + + override suspend fun search(query: String): List { + val soup = app.get("$mainUrl/?s=$query").document + return soup.select(".item_card").map { + val title = it.selectFirst("a .card__title")!!.text() + val poster = it.selectFirst("a img")!!.attr("abs:src") + AnimeSearchResponse( + title, + fixUrl(it.selectFirst("a")!!.attr("abs:href")), + this.name, + TvType.Anime, + poster, + null, + EnumSet.of(DubStatus.Subbed) + ) + } + } + + override suspend fun load(url: String): LoadResponse? { + // Gets the url returned from searching. + val soup = app.get(url).document + val title = soup.selectFirst(".hentai_cover img")!!.attr("alt").substringBefore("cover").trim() + val description = soup.selectFirst("div.vraven_expand > div.vraven_text.single > p")!!.text() + + val episodes = soup.select(".hentai__episodes .hentai__chapter").map { + val href = it.select("a").attr("abs:href") + val poster = it.select("a img").attr("abs:src") + val noEpisode = it.select("a").text().filter { it.isDigit() }.toFloat() + + Episode(href, episode = noEpisode.toInt(), posterUrl = poster) + } + + return newAnimeLoadResponse(title, url, TvType.Anime) { + posterUrl = soup.selectFirst(".hentai_cover img")!!.attr("abs:src") + addEpisodes(DubStatus.Subbed, episodes) + showStatus = ShowStatus.Completed + plot = description + } + } + + override suspend fun loadLinks( + data: String, + isCasting: Boolean, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ): Boolean { + app.get(data).document.select("script").apmap { script -> + if (script.data().contains("window.hola_player({")) { + script.data().substringAfter("sources: [{src: \"").substringBefore("\",").let { url -> + callback.invoke( + ExtractorLink( + this.name, + this.name, + url, + referer = "", + quality = Qualities.P720.value + ) + ) + } + } + } + return true + } +} \ No newline at end of file diff --git a/HentaiLAProvider/src/main/kotlin/com/lagradost/HentaiLAProviderPlugin.kt b/HentaiLAProvider/src/main/kotlin/com/lagradost/HentaiLAProviderPlugin.kt new file mode 100644 index 0000000..6ce7ad1 --- /dev/null +++ b/HentaiLAProvider/src/main/kotlin/com/lagradost/HentaiLAProviderPlugin.kt @@ -0,0 +1,14 @@ + +package com.lagradost + +import com.lagradost.cloudstream3.plugins.CloudstreamPlugin +import com.lagradost.cloudstream3.plugins.Plugin +import android.content.Context + +@CloudstreamPlugin +class HentaiLAProviderPlugin: Plugin() { + override fun load(context: Context) { + // All providers should be added in this manner. Please don't edit the providers list directly. + registerMainAPI(HentaiLAProvider()) + } +} \ No newline at end of file diff --git a/YomirollProvider/src/main/kotlin/com/lagradost/YomirollProvider.kt b/YomirollProvider/src/main/kotlin/com/lagradost/YomirollProvider.kt index b69c5a0..9c06f1e 100644 --- a/YomirollProvider/src/main/kotlin/com/lagradost/YomirollProvider.kt +++ b/YomirollProvider/src/main/kotlin/com/lagradost/YomirollProvider.kt @@ -213,7 +213,7 @@ class YomirollProvider : MainAPI() { private suspend fun getEpisodes(seasonData: SeasonResult.Season): List { val episodes = app.get( "$crApiUrl/cms/seasons/${seasonData.id}/episodes", - headers = getCrunchyrollToken() + interceptor = tokenInterceptor ).parsed() return episodes.data.sortedBy { it.episode_number }.mapNotNull EpisodeMap@{ ep -> Episode( @@ -281,7 +281,7 @@ class YomirollProvider : MainAPI() { val (mediaId, audioL) = it val streams = app.get( "https://beta-api.crunchyroll.com/content/v2/cms/videos/$mediaId/streams", - headers = getCrunchyrollToken(), + interceptor = tokenInterceptor, timeout = 20000 ).parsedSafe() diff --git a/settings.gradle.kts b/settings.gradle.kts index d071db1..4e27105 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -5,7 +5,7 @@ rootProject.name = "CloudstreamPlugins" // Plugins are included like this val disabled = listOf( - "AnimefenixProvider" + // "AnimefenixProvider" ) File(rootDir, ".").eachDir { dir ->