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
version = 6
version = 7
cloudstream {

View file

@ -106,7 +106,7 @@ class AnimeIndoProvider : MainAPI() {
val posterUrl = this.select("img[itemprop=image]").attr("src").toString()
val type = getType(this.select("div.type").text().trim())
val epNum =
this.selectFirst("span.episode")?.ownText()?.replace(Regex("[^0-9]"), "")?.trim()
this.selectFirst("span.episode")?.ownText()?.replace(Regex("\\D"), "")?.trim()
?.toIntOrNull()
return newAnimeSearchResponse(title, href, type) {
this.posterUrl = posterUrl
@ -116,10 +116,11 @@ class AnimeIndoProvider : MainAPI() {
}
override suspend fun search(query: String): List<SearchResponse> {
val link = "$mainUrl/?s=$query"
val anime = mutableListOf<SearchResponse>()
(1..2).forEach { page ->
val link = "$mainUrl/page/$page/?s=$query"
val document = request(link).document
return document.select(".site-main.relat > article").map {
val media = document.select(".site-main.relat > article").mapNotNull {
val title = it.selectFirst("div.title > h2")!!.ownText().trim()
val href = it.selectFirst("a")!!.attr("href")
val posterUrl = it.selectFirst("img")!!.attr("src").toString()
@ -128,6 +129,9 @@ class AnimeIndoProvider : MainAPI() {
this.posterUrl = posterUrl
}
}
if(media.isNotEmpty()) anime.addAll(media)
}
return anime
}
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()
?.trim()?.lowercase() ?: "tv"
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 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 episode = header.text().trim().replace("Episode", "").trim().toIntOrNull()
val link = fixUrl(header.attr("href"))
Episode(link, episode = episode)
Episode(link, header.text(), episode = episode)
}.reversed()
return newAnimeLoadResponse(title, url, getType(type)) {

View file

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

View file

@ -86,7 +86,7 @@ class AnimeSailProvider : MainAPI() {
val title = this.select(".tt > h2").text().trim()
val posterUrl = fixUrlNull(this.selectFirst("div.limit img")?.attr("src"))
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) {
this.posterUrl = posterUrl
@ -116,11 +116,10 @@ class AnimeSailProvider : MainAPI() {
val (malId, anilistId, image, cover) = getTracker(title, type, year)
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"))
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()
return newAnimeLoadResponse(title, url, getType(type)) {

View file

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

View file

@ -129,8 +129,8 @@ class KuronimeProvider : MainAPI() {
val episodes = document.select("div.bixbox.bxcl > ul > li").mapNotNull {
val link = it.selectFirst("a")?.attr("href") ?: return@mapNotNull null
val name = it.selectFirst("a")?.text() ?: return@mapNotNull null
// val episode = Regex("(\\d+[.,]?\\d*)").find(name)?.groupValues?.getOrNull(0)?.toIntOrNull()
Episode(link, name)
val episode = Regex("(\\d+[.,]?\\d*)").find(name)?.groupValues?.getOrNull(0)?.toIntOrNull()
Episode(link, name, episode = episode)
}.reversed()
return newAnimeLoadResponse(title, url, getType(type)) {
@ -194,7 +194,7 @@ class KuronimeProvider : MainAPI() {
safeApiCall {
when {
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
version = 5
version = 6
cloudstream {

View file

@ -144,10 +144,10 @@ class NeonimeProvider : MainAPI() {
val year = document.select("#info a[href*=\"-year/\"]").text().toIntOrNull()
val (malId, anilistId, image, cover) = getTracker(title, "tv", year)
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"))
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()
return newAnimeLoadResponse(title, url, TvType.Anime) {

View file

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

View file

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

View file

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

View file

@ -150,10 +150,10 @@ class OploverzProvider : MainAPI() {
val (malId, anilistId, image, cover) = getTracker(title, typeCheck, year)
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"))
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()
val recommendations =