fixed missing episode in Kuronime

This commit is contained in:
hexated 2023-01-28 09:13:29 +07:00
parent e34a635659
commit 1e8dfcc789
2 changed files with 8 additions and 7 deletions

View file

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

View file

@ -88,7 +88,7 @@ class KuronimeProvider : MainAPI() {
this.selectFirst("div.view,div.bt")?.nextElementSibling()?.select("img") this.selectFirst("div.view,div.bt")?.nextElementSibling()?.select("img")
?.attr("data-src") ?.attr("data-src")
) )
val epNum = this.select(".ep").text().replace(Regex("[^0-9]"), "").trim().toIntOrNull() val epNum = this.select(".ep").text().replace(Regex("\\D"), "").trim().toIntOrNull()
val tvType = getType(this.selectFirst(".bt > span")?.text().toString()) val tvType = getType(this.selectFirst(".bt > span")?.text().toString())
return newAnimeSearchResponse(title, href, tvType) { return newAnimeSearchResponse(title, href, tvType) {
this.posterUrl = posterUrl this.posterUrl = posterUrl
@ -116,7 +116,7 @@ class KuronimeProvider : MainAPI() {
?.lowercase()?.trim() ?: "tv" ?.lowercase()?.trim() ?: "tv"
val trailer = document.selectFirst("div.tply iframe")?.attr("data-src") val trailer = document.selectFirst("div.tply iframe")?.attr("data-src")
val year = Regex("\\d, ([0-9]*)").find( val year = Regex("\\d, (\\d*)").find(
document.select(".infodetail > ul > li:nth-child(5)").text() document.select(".infodetail > ul > li:nth-child(5)").text()
)?.groupValues?.get(1)?.toIntOrNull() )?.groupValues?.get(1)?.toIntOrNull()
val (malId, anilistId, image, cover) = getTracker(title, type, year) val (malId, anilistId, image, cover) = getTracker(title, type, year)
@ -126,10 +126,11 @@ class KuronimeProvider : MainAPI() {
) )
val description = document.select("span.const > p").text() val description = document.select("span.const > p").text()
val episodes = document.select("div.bixbox.bxcl > ul > li").map { val episodes = document.select("div.bixbox.bxcl > ul > li").mapNotNull {
val episode = it.selectFirst("a")?.text()?.trim()?.replace("Episode", "")?.trim()?.toIntOrNull() val link = it.selectFirst("a")?.attr("href") ?: return@mapNotNull null
val link = it.selectFirst("a")!!.attr("href") val name = it.selectFirst("a")?.text() ?: return@mapNotNull null
Episode(link, episode = episode) // val episode = Regex("(\\d+[.,]?\\d*)").find(name)?.groupValues?.getOrNull(0)?.toIntOrNull()
Episode(link, name)
}.reversed() }.reversed()
return newAnimeLoadResponse(title, url, getType(type)) { return newAnimeLoadResponse(title, url, getType(type)) {