Skip to content

Commit

Permalink
anime/indo: optimize detail page and domain
Browse files Browse the repository at this point in the history
  • Loading branch information
tuiodongme committed Sep 11, 2023
1 parent c6f89db commit 7dabff1
Show file tree
Hide file tree
Showing 22 changed files with 143 additions and 69 deletions.
2 changes: 1 addition & 1 deletion Animasu/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// use an integer for version numbers
version = 2
version = 3


cloudstream {
Expand Down
17 changes: 12 additions & 5 deletions Animasu/src/main/kotlin/com/hexated/Animasu.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package com.hexated

import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addAniListId
import com.lagradost.cloudstream3.LoadResponse.Companion.addMalId
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
import com.lagradost.cloudstream3.utils.*
import org.jsoup.Jsoup
import org.jsoup.nodes.Element

class Animasu : MainAPI() {
override var mainUrl = "https://animasu.cc"
override var mainUrl = "https://animasu.uno"
override var name = "Animasu"
override val hasMainPage = true
override var lang = "id"
Expand Down Expand Up @@ -99,25 +101,30 @@ class Animasu : MainAPI() {
val poster = document.selectFirst("div.bigcontent img")?.attr("src")?.replace("\n", "")

val table = document.selectFirst("div.infox div.spe")
val type = table?.selectFirst("span:contains(Jenis:)")?.ownText()
val type = getType(table?.selectFirst("span:contains(Jenis:)")?.ownText())
val year = table?.selectFirst("span:contains(Rilis:)")?.ownText()?.substringAfterLast(",")?.trim()?.toIntOrNull()
val status = table?.selectFirst("span:contains(Status:) font")?.text()
val trailer = document.selectFirst("div.trailer iframe")?.attr("src")
val episodes = document.select("ul#daftarepisode > li").map {
val link = fixUrl(it.selectFirst("a")!!.attr("href"))
val name = it.selectFirst("a")?.text() ?: ""
val episode = Regex("Episode\\s?(\\d+)").find(name)?.groupValues?.getOrNull(0)?.toIntOrNull()
Episode(link, name, episode = episode)
Episode(link, episode = episode)
}.reversed()

return newAnimeLoadResponse(title, url, getType(type)) {
posterUrl = poster
val tracker = APIHolder.getTracker(listOf(title),TrackerType.getTypes(type),year,true)

return newAnimeLoadResponse(title, url, type) {
posterUrl = tracker?.image ?: poster
backgroundPosterUrl = tracker?.cover
this.year = year
addEpisodes(DubStatus.Subbed, episodes)
showStatus = getStatus(status)
plot = document.select("div.sinopsis p").text()
this.tags = table?.select("span:contains(Genre:) a")?.map { it.text() }
addTrailer(trailer)
addMalId(tracker?.malId)
addAniListId(tracker?.aniId?.toIntOrNull())
}
}

Expand Down
2 changes: 1 addition & 1 deletion AnimeIndoProvider/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// use an integer for version numbers
version = 13
version = 14


cloudstream {
Expand Down
17 changes: 12 additions & 5 deletions AnimeIndoProvider/src/main/kotlin/com/hexated/AnimeIndoProvider.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.hexated

import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addAniListId
import com.lagradost.cloudstream3.LoadResponse.Companion.addMalId
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.httpsify
Expand Down Expand Up @@ -113,8 +115,8 @@ class AnimeIndoProvider : MainAPI() {
?.trim() ?: return null
val poster = document.selectFirst("div.thumb > img[itemprop=image]")?.attr("src")
val tags = document.select("div.genxed > a").map { it.text() }
val type = document.selectFirst("div.info-content > div.spe > span:contains(Type:)")?.ownText()
?.trim()?.lowercase() ?: "tv"
val type = getType(document.selectFirst("div.info-content > div.spe > span:contains(Type:)")?.ownText()
?.trim()?.lowercase() ?: "tv")
val year = document.selectFirst("div.info-content > div.spe > span:contains(Released:)")?.ownText()?.let {
Regex("\\d,\\s(\\d*)").find(it)?.groupValues?.get(1)?.toIntOrNull()
}
Expand All @@ -126,23 +128,28 @@ class AnimeIndoProvider : MainAPI() {
val header = it.selectFirst("span.lchx > a") ?: return@mapNotNull null
val episode = header.text().trim().replace("Episode", "").trim().toIntOrNull()
val link = fixUrl(header.attr("href"))
Episode(link, header.text(), episode = episode)
Episode(link, episode = episode)
}.reversed()

val recommendations = document.select("div.relat div.animposx").mapNotNull {
it.toSearchResult()
}

return newAnimeLoadResponse(title, url, getType(type)) {
val tracker = APIHolder.getTracker(listOf(title),TrackerType.getTypes(type),year,true)

return newAnimeLoadResponse(title, url, type) {
engName = title
posterUrl = poster
posterUrl = tracker?.image ?: poster
backgroundPosterUrl = tracker?.cover
this.year = year
addEpisodes(DubStatus.Subbed, episodes)
showStatus = status
plot = description
this.tags = tags
this.recommendations = recommendations
addTrailer(trailer)
addMalId(tracker?.malId)
addAniListId(tracker?.aniId?.toIntOrNull())
}
}

Expand Down
2 changes: 1 addition & 1 deletion AnimeSailProvider/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// use an integer for version numbers
version = 9
version = 10


cloudstream {
Expand Down
15 changes: 11 additions & 4 deletions AnimeSailProvider/src/main/kotlin/com/hexated/AnimeSailProvider.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.hexated

import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addAniListId
import com.lagradost.cloudstream3.LoadResponse.Companion.addMalId
import com.lagradost.cloudstream3.mvvm.safeApiCall
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.ExtractorLinkType
Expand Down Expand Up @@ -108,25 +110,30 @@ class AnimeSailProvider : MainAPI() {
val title = document.selectFirst("h1.entry-title")?.text().toString()
.replace("Subtitle Indonesia", "").trim()
val poster = document.selectFirst("div.entry-content > img")?.attr("src")
val type = document.select("tbody th:contains(Tipe)").next().text().lowercase()
val type = getType(document.select("tbody th:contains(Tipe)").next().text().lowercase())
val year = document.select("tbody th:contains(Dirilis)").next().text().trim().toIntOrNull()

val episodes = document.select("ul.daftar > li").map {
val link = fixUrl(it.select("a").attr("href"))
val name = it.select("a").text()
val episode = Regex("Episode\\s?(\\d+)").find(name)?.groupValues?.getOrNull(0)?.toIntOrNull()
Episode(link, name, episode = episode)
Episode(link, episode = episode)
}.reversed()

return newAnimeLoadResponse(title, url, getType(type)) {
posterUrl = poster
val tracker = APIHolder.getTracker(listOf(title),TrackerType.getTypes(type),year,true)

return newAnimeLoadResponse(title, url, type) {
posterUrl = tracker?.image ?: poster
backgroundPosterUrl = tracker?.cover
this.year = year
addEpisodes(DubStatus.Subbed, episodes)
showStatus =
getStatus(document.select("tbody th:contains(Status)").next().text().trim())
plot = document.selectFirst("div.entry-content > p")?.text()
this.tags =
document.select("tbody th:contains(Genre)").next().select("a").map { it.text() }
addMalId(tracker?.malId)
addAniListId(tracker?.aniId?.toIntOrNull())
}
}

Expand Down
2 changes: 1 addition & 1 deletion KuramanimeProvider/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// use an integer for version numbers
version = 14
version = 15


cloudstream {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.hexated

import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addAniListId
import com.lagradost.cloudstream3.LoadResponse.Companion.addMalId
import com.lagradost.cloudstream3.mvvm.safeApiCall
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.Qualities
Expand Down Expand Up @@ -106,7 +108,6 @@ class KuramanimeProvider : MainAPI() {
document.select("div.anime__details__widget > div > div:nth-child(1) > ul > li:nth-child(3)")
.text().trim().replace("Status: ", "")
)
val type = document.selectFirst("div.col-lg-6.col-md-6 ul li:contains(Tipe:) a")?.text()?.lowercase() ?: "tv"
val description = document.select(".anime__details__text > p").text().trim()

val episodes = mutableListOf<Episode>()
Expand All @@ -119,31 +120,36 @@ class KuramanimeProvider : MainAPI() {
val episode = Regex("(\\d+[.,]?\\d*)").find(name)?.groupValues?.getOrNull(0)
?.toIntOrNull()
val link = it.attr("href")
Episode(link, name, episode = episode)
Episode(link, episode = episode)
}
if(eps.isEmpty()) break else episodes.addAll(eps)
}

val type = getType(document.selectFirst("div.col-lg-6.col-md-6 ul li:contains(Tipe:) a")?.text()?.lowercase() ?: "tv", episodes.size)
val recommendations = document.select("div#randomList > a").mapNotNull {
val epHref = it.attr("href")
val epTitle = it.select("h5.sidebar-title-h5.px-2.py-2").text()
val epPoster = it.select(".product__sidebar__view__item.set-bg").attr("data-setbg")

newAnimeSearchResponse(epTitle, epHref, TvType.Anime) {
this.posterUrl = epPoster
addDubStatus(dubExist = false, subExist = true)
}
}

return newAnimeLoadResponse(title, url, getType(type, episodes.size)) {
val tracker = APIHolder.getTracker(listOf(title),TrackerType.getTypes(type),year,true)

return newAnimeLoadResponse(title, url, type) {
engName = title
posterUrl = poster
posterUrl = tracker?.image ?: poster
backgroundPosterUrl = tracker?.cover
this.year = year
addEpisodes(DubStatus.Subbed, episodes)
showStatus = status
plot = description
this.tags = tags
this.recommendations = recommendations
addMalId(tracker?.malId)
addAniListId(tracker?.aniId?.toIntOrNull())
}

}
Expand Down
2 changes: 1 addition & 1 deletion KuronimeProvider/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// use an integer for version numbers
version = 15
version = 16


cloudstream {
Expand Down
17 changes: 12 additions & 5 deletions KuronimeProvider/src/main/kotlin/com/hexated/KuronimeProvider.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package com.hexated

import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addAniListId
import com.lagradost.cloudstream3.LoadResponse.Companion.addMalId
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
import com.lagradost.cloudstream3.extractors.helper.AesHelper
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
Expand Down Expand Up @@ -130,8 +132,8 @@ class KuronimeProvider : MainAPI() {
val poster = document.selectFirst("div.l[itemprop=image] > img")?.attr("data-src")
val tags = document.select(".infodetail > ul > li:nth-child(2) > a").map { it.text() }
val type =
document.selectFirst(".infodetail > ul > li:nth-child(7)")?.ownText()?.removePrefix(":")
?.lowercase()?.trim() ?: "tv"
getType(document.selectFirst(".infodetail > ul > li:nth-child(7)")?.ownText()?.removePrefix(":")
?.lowercase()?.trim() ?: "tv")

val trailer = document.selectFirst("div.tply iframe")?.attr("data-src")
val year = Regex("\\d, (\\d*)").find(
Expand All @@ -148,18 +150,23 @@ class KuronimeProvider : MainAPI() {
val name = it.selectFirst("a")?.text() ?: return@mapNotNull null
val episode =
Regex("(\\d+[.,]?\\d*)").find(name)?.groupValues?.getOrNull(0)?.toIntOrNull()
Episode(link, name, episode = episode)
Episode(link, episode = episode)
}.reversed()

return newAnimeLoadResponse(title, url, getType(type)) {
val tracker = APIHolder.getTracker(listOf(title),TrackerType.getTypes(type),year,true)

return newAnimeLoadResponse(title, url, type) {
engName = title
posterUrl = poster
posterUrl = tracker?.image ?: poster
backgroundPosterUrl = tracker?.cover
this.year = year
addEpisodes(DubStatus.Subbed, episodes)
showStatus = status
plot = description
addTrailer(trailer)
this.tags = tags
addMalId(tracker?.malId)
addAniListId(tracker?.aniId?.toIntOrNull())
}
}

Expand Down
2 changes: 1 addition & 1 deletion NeonimeProvider/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// use an integer for version numbers
version = 7
version = 8


cloudstream {
Expand Down
19 changes: 14 additions & 5 deletions NeonimeProvider/src/main/kotlin/com/hexated/NeonimeProvider.kt
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
package com.hexated

import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addAniListId
import com.lagradost.cloudstream3.LoadResponse.Companion.addMalId
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.loadExtractor
import org.jsoup.nodes.Element
import java.net.URI

class NeonimeProvider : MainAPI() {
override var mainUrl = "https://neonime.fun"
override var mainUrl = "https://neonime.ink"
private var baseUrl = mainUrl
override var name = "Neonime"
override val hasQuickSearch = false
Expand Down Expand Up @@ -120,13 +122,17 @@ class NeonimeProvider : MainAPI() {
val mPoster = document.selectFirst(".sbox > .imagen > .fix > img[itemprop = image]")?.attr("data-src")
val mTrailer = document.selectFirst("div.youtube_id iframe")?.attr("data-wpfc-original-src")?.substringAfterLast("html#")?.let{ "https://www.youtube.com/embed/$it"}
val year = document.selectFirst("a[href*=release-year]")!!.text().toIntOrNull()
val tracker = APIHolder.getTracker(listOf(mTitle),TrackerType.getTypes(TvType.Movie),year,true)
return newMovieLoadResponse(name = mTitle, url = url, type = TvType.Movie, dataUrl = url) {
posterUrl = mPoster
posterUrl = tracker?.image ?: mPoster
backgroundPosterUrl = tracker?.cover
this.year = year
plot = document.select("div[itemprop = description]").text().trim()
rating = document.select("span[itemprop = ratingValue]").text().toIntOrNull()
tags = document.select("p.meta_dd > a").map { it.text() }
addTrailer(mTrailer)
addMalId(tracker?.malId)
addAniListId(tracker?.aniId?.toIntOrNull())
}
}
else {
Expand All @@ -138,18 +144,21 @@ class NeonimeProvider : MainAPI() {
val link = fixUrl(it.selectFirst(".episodiotitle > a")!!.attr("href"))
val name = it.selectFirst(".episodiotitle > a")?.ownText().toString()
val episode = Regex("(\\d+[.,]?\\d*)").find(name)?.groupValues?.getOrNull(0)?.toIntOrNull()
Episode(link, name, episode = episode)
Episode(link, episode = episode)
}.reversed()

val tracker = APIHolder.getTracker(listOf(title),TrackerType.getTypes(TvType.Anime),year,true)
return newAnimeLoadResponse(title, url, TvType.Anime) {
engName = title
posterUrl = poster
posterUrl = tracker?.image ?: poster
backgroundPosterUrl = tracker?.cover
this.year = year
addEpisodes(DubStatus.Subbed, episodes)
showStatus = getStatus(document.select("div.metadatac > span").last()!!.text().trim())
plot = document.select("div[itemprop = description] > p").text().trim()
tags = document.select("#info a[href*=\"-genre/\"]").map { it.text() }
addTrailer(trailer)
addMalId(tracker?.malId)
addAniListId(tracker?.aniId?.toIntOrNull())
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Nimegami/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// use an integer for version numbers
version = 4
version = 5


cloudstream {
Expand Down
Loading

0 comments on commit 7dabff1

Please sign in to comment.