fixed wrong episode in indonime providers

This commit is contained in:
hexated 2023-01-31 09:33:17 +07:00
parent 5685ca6d25
commit a6e5375cad
12 changed files with 41 additions and 38 deletions

View file

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 6 version = 7
cloudstream { cloudstream {

View file

@ -106,7 +106,7 @@ class AnimeIndoProvider : MainAPI() {
val posterUrl = this.select("img[itemprop=image]").attr("src").toString() val posterUrl = this.select("img[itemprop=image]").attr("src").toString()
val type = getType(this.select("div.type").text().trim()) val type = getType(this.select("div.type").text().trim())
val epNum = val epNum =
this.selectFirst("span.episode")?.ownText()?.replace(Regex("[^0-9]"), "")?.trim() this.selectFirst("span.episode")?.ownText()?.replace(Regex("\\D"), "")?.trim()
?.toIntOrNull() ?.toIntOrNull()
return newAnimeSearchResponse(title, href, type) { return newAnimeSearchResponse(title, href, type) {
this.posterUrl = posterUrl this.posterUrl = posterUrl
@ -116,18 +116,22 @@ class AnimeIndoProvider : MainAPI() {
} }
override suspend fun search(query: String): List<SearchResponse> { override suspend fun search(query: String): List<SearchResponse> {
val link = "$mainUrl/?s=$query" val anime = mutableListOf<SearchResponse>()
val document = request(link).document (1..2).forEach { page ->
val link = "$mainUrl/page/$page/?s=$query"
return document.select(".site-main.relat > article").map { val document = request(link).document
val title = it.selectFirst("div.title > h2")!!.ownText().trim() val media = document.select(".site-main.relat > article").mapNotNull {
val href = it.selectFirst("a")!!.attr("href") val title = it.selectFirst("div.title > h2")!!.ownText().trim()
val posterUrl = it.selectFirst("img")!!.attr("src").toString() val href = it.selectFirst("a")!!.attr("href")
val type = getType(it.select("div.type").text().trim()) val posterUrl = it.selectFirst("img")!!.attr("src").toString()
newAnimeSearchResponse(title, href, type) { val type = getType(it.select("div.type").text().trim())
this.posterUrl = posterUrl newAnimeSearchResponse(title, href, type) {
this.posterUrl = posterUrl
}
} }
if(media.isNotEmpty()) anime.addAll(media)
} }
return anime
} }
override suspend fun load(url: String): LoadResponse? { override suspend fun load(url: String): LoadResponse? {
@ -140,7 +144,7 @@ class AnimeIndoProvider : MainAPI() {
val type = document.selectFirst("div.info-content > div.spe > span:contains(Type:)")?.ownText() val type = document.selectFirst("div.info-content > div.spe > span:contains(Type:)")?.ownText()
?.trim()?.lowercase() ?: "tv" ?.trim()?.lowercase() ?: "tv"
val year = document.selectFirst("div.info-content > div.spe > span:contains(Released:)")?.ownText()?.let { val year = document.selectFirst("div.info-content > div.spe > span:contains(Released:)")?.ownText()?.let {
Regex("\\d,\\s([0-9]*)").find(it)?.groupValues?.get(1)?.toIntOrNull() Regex("\\d,\\s(\\d*)").find(it)?.groupValues?.get(1)?.toIntOrNull()
} }
val status = getStatus(document.selectFirst("div.info-content > div.spe > span:nth-child(1)")!!.ownText().trim()) val status = getStatus(document.selectFirst("div.info-content > div.spe > span:nth-child(1)")!!.ownText().trim())
val description = document.select("div[itemprop=description] > p").text() val description = document.select("div[itemprop=description] > p").text()
@ -151,7 +155,7 @@ class AnimeIndoProvider : MainAPI() {
val header = it.selectFirst("span.lchx > a") ?: return@mapNotNull null val header = it.selectFirst("span.lchx > a") ?: return@mapNotNull null
val episode = header.text().trim().replace("Episode", "").trim().toIntOrNull() val episode = header.text().trim().replace("Episode", "").trim().toIntOrNull()
val link = fixUrl(header.attr("href")) val link = fixUrl(header.attr("href"))
Episode(link, episode = episode) Episode(link, header.text(), episode = episode)
}.reversed() }.reversed()
return newAnimeLoadResponse(title, url, getType(type)) { return newAnimeLoadResponse(title, url, getType(type)) {

View file

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 5 version = 6
cloudstream { cloudstream {

View file

@ -86,7 +86,7 @@ class AnimeSailProvider : MainAPI() {
val title = this.select(".tt > h2").text().trim() val title = this.select(".tt > h2").text().trim()
val posterUrl = fixUrlNull(this.selectFirst("div.limit img")?.attr("src")) val posterUrl = fixUrlNull(this.selectFirst("div.limit img")?.attr("src"))
val epNum = this.selectFirst(".tt > h2")?.text()?.let { val epNum = this.selectFirst(".tt > h2")?.text()?.let {
Regex("Episode\\s?([0-9]+)").find(it)?.groupValues?.getOrNull(1)?.toIntOrNull() Regex("Episode\\s?(\\d+)").find(it)?.groupValues?.getOrNull(1)?.toIntOrNull()
} }
return newAnimeSearchResponse(title, href, TvType.Anime) { return newAnimeSearchResponse(title, href, TvType.Anime) {
this.posterUrl = posterUrl this.posterUrl = posterUrl
@ -116,11 +116,10 @@ class AnimeSailProvider : MainAPI() {
val (malId, anilistId, image, cover) = getTracker(title, type, year) val (malId, anilistId, image, cover) = getTracker(title, type, year)
val episodes = document.select("ul.daftar > li").map { val episodes = document.select("ul.daftar > li").map {
val episode = Regex("Episode\\s?([0-9]+)").find(
it.select("a").text().trim()
)?.groupValues?.getOrNull(0)
val link = fixUrl(it.select("a").attr("href")) val link = fixUrl(it.select("a").attr("href"))
Episode(link, episode = episode?.toIntOrNull()) val name = it.select("a").text()
val episode = Regex("(\\d+[.,]?\\d*)").find(name)?.groupValues?.getOrNull(0)?.toIntOrNull()
Episode(link, name, episode = episode)
}.reversed() }.reversed()
return newAnimeLoadResponse(title, url, getType(type)) { return newAnimeLoadResponse(title, url, getType(type)) {

View file

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 5 version = 6
cloudstream { cloudstream {

View file

@ -129,8 +129,8 @@ class KuronimeProvider : MainAPI() {
val episodes = document.select("div.bixbox.bxcl > ul > li").mapNotNull { val episodes = document.select("div.bixbox.bxcl > ul > li").mapNotNull {
val link = it.selectFirst("a")?.attr("href") ?: return@mapNotNull null val link = it.selectFirst("a")?.attr("href") ?: return@mapNotNull null
val name = it.selectFirst("a")?.text() ?: return@mapNotNull null val name = it.selectFirst("a")?.text() ?: return@mapNotNull null
// val episode = Regex("(\\d+[.,]?\\d*)").find(name)?.groupValues?.getOrNull(0)?.toIntOrNull() val episode = Regex("(\\d+[.,]?\\d*)").find(name)?.groupValues?.getOrNull(0)?.toIntOrNull()
Episode(link, name) Episode(link, name, episode = episode)
}.reversed() }.reversed()
return newAnimeLoadResponse(title, url, getType(type)) { return newAnimeLoadResponse(title, url, getType(type)) {
@ -194,7 +194,7 @@ class KuronimeProvider : MainAPI() {
safeApiCall { safeApiCall {
when { when {
it.startsWith("https://animeku.org") -> invokeKuroSource(it, callback) it.startsWith("https://animeku.org") -> invokeKuroSource(it, callback)
else -> loadExtractor(it, mainUrl, subtitleCallback, callback) else -> loadExtractor("$it/", mainUrl, subtitleCallback, callback)
} }
} }
} }

View file

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 5 version = 6
cloudstream { cloudstream {

View file

@ -144,10 +144,10 @@ class NeonimeProvider : MainAPI() {
val year = document.select("#info a[href*=\"-year/\"]").text().toIntOrNull() val year = document.select("#info a[href*=\"-year/\"]").text().toIntOrNull()
val (malId, anilistId, image, cover) = getTracker(title, "tv", year) val (malId, anilistId, image, cover) = getTracker(title, "tv", year)
val episodes = document.select("ul.episodios > li").mapNotNull { val episodes = document.select("ul.episodios > li").mapNotNull {
val header = it.selectFirst(".episodiotitle > a")?.ownText().toString()
val name = Regex("(Episode\\s?\\d+)").find(header)?.groupValues?.getOrNull(0) ?: header
val link = fixUrl(it.selectFirst(".episodiotitle > a")!!.attr("href")) val link = fixUrl(it.selectFirst(".episodiotitle > a")!!.attr("href"))
Episode(link, name) val name = it.selectFirst(".episodiotitle > a")?.ownText().toString()
val episode = Regex("(\\d+[.,]?\\d*)").find(name)?.groupValues?.getOrNull(0)?.toIntOrNull()
Episode(link, name, episode = episode)
}.reversed() }.reversed()
return newAnimeLoadResponse(title, url, TvType.Anime) { return newAnimeLoadResponse(title, url, TvType.Anime) {

View file

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 9 version = 10
cloudstream { cloudstream {

View file

@ -11,7 +11,7 @@ import org.jsoup.Jsoup
import org.jsoup.nodes.Element import org.jsoup.nodes.Element
class NontonAnimeIDProvider : MainAPI() { class NontonAnimeIDProvider : MainAPI() {
override var mainUrl = "https://nontonanimeid.click" override var mainUrl = "https://nontonanimeid.best"
override var name = "NontonAnimeID" override var name = "NontonAnimeID"
override val hasQuickSearch = false override val hasQuickSearch = false
override val hasMainPage = true override val hasMainPage = true
@ -122,7 +122,7 @@ class NontonAnimeIDProvider : MainAPI() {
val poster = document.selectFirst(".poster > img")?.attr("data-src") val poster = document.selectFirst(".poster > img")?.attr("data-src")
val tags = document.select(".tagline > a").map { it.text() } val tags = document.select(".tagline > a").map { it.text() }
val year = Regex("\\d, ([0-9]*)").find( val year = Regex("\\d, (\\d*)").find(
document.select(".bottomtitle > span:nth-child(5)").text() document.select(".bottomtitle > span:nth-child(5)").text()
)?.groupValues?.get(1)?.toIntOrNull() )?.groupValues?.get(1)?.toIntOrNull()
val status = getStatus( val status = getStatus(
@ -138,7 +138,7 @@ class NontonAnimeIDProvider : MainAPI() {
val episodes = if (document.select("button.buttfilter").isNotEmpty()) { val episodes = if (document.select("button.buttfilter").isNotEmpty()) {
val id = document.select("input[name=series_id]").attr("value") val id = document.select("input[name=series_id]").attr("value")
val numEp = val numEp =
document.selectFirst(".latestepisode > a")?.text()?.replace(Regex("[^0-9]"), "") document.selectFirst(".latestepisode > a")?.text()?.replace(Regex("\\D"), "")
.toString() .toString()
Jsoup.parse( Jsoup.parse(
app.post( app.post(
@ -151,7 +151,7 @@ class NontonAnimeIDProvider : MainAPI() {
) )
).parsed<EpResponse>().content ).parsed<EpResponse>().content
).select("li").map { ).select("li").map {
val episode = Regex("Episode\\s?([0-9]+)").find( val episode = Regex("Episode\\s?(\\d+)").find(
it.selectFirst("a")?.text().toString() it.selectFirst("a")?.text().toString()
)?.groupValues?.getOrNull(0) ?: it.selectFirst("a")?.text() )?.groupValues?.getOrNull(0) ?: it.selectFirst("a")?.text()
val link = fixUrl(it.selectFirst("a")!!.attr("href")) val link = fixUrl(it.selectFirst("a")!!.attr("href"))
@ -159,7 +159,7 @@ class NontonAnimeIDProvider : MainAPI() {
}.reversed() }.reversed()
} else { } else {
document.select("ul.misha_posts_wrap2 > li").map { document.select("ul.misha_posts_wrap2 > li").map {
val episode = Regex("Episode\\s?([0-9]+)").find( val episode = Regex("Episode\\s?(\\d+)").find(
it.selectFirst("a")?.text().toString() it.selectFirst("a")?.text().toString()
)?.groupValues?.getOrNull(0) ?: it.selectFirst("a")?.text() )?.groupValues?.getOrNull(0) ?: it.selectFirst("a")?.text()
val link = it.select("a").attr("href") val link = it.select("a").attr("href")

View file

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 6 version = 7
cloudstream { cloudstream {

View file

@ -150,10 +150,10 @@ class OploverzProvider : MainAPI() {
val (malId, anilistId, image, cover) = getTracker(title, typeCheck, year) val (malId, anilistId, image, cover) = getTracker(title, typeCheck, year)
val episodes = document.select(".eplister > ul > li").map { val episodes = document.select(".eplister > ul > li").map {
val header = it.select(".epl-title").text()
val episode = Regex("Episode\\s?0?0?([0-9]+)").find(header)?.groupValues?.getOrNull(0)
val link = fixUrl(it.select("a").attr("href")) val link = fixUrl(it.select("a").attr("href"))
Episode(link, episode = episode?.toIntOrNull()) val name = it.select(".epl-title").text()
val episode = Regex("(\\d+[.,]?\\d*)").find(name)?.groupValues?.getOrNull(0)?.toIntOrNull()
Episode(link, name, episode = episode)
}.reversed() }.reversed()
val recommendations = val recommendations =