Aniworld: fix episodes

This commit is contained in:
hexated 2023-06-16 00:25:08 +07:00
parent da7e9159ef
commit eae807a4f3
2 changed files with 14 additions and 6 deletions

View File

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

View File

@ -93,11 +93,19 @@ class Aniworld : MainAPI() {
val actor =
document.select("li:contains(Schauspieler:) ul li a").map { it.select("span").text() }
val episodes = document.select("div#stream > ul:nth-child(4) li").mapNotNull { eps ->
Episode(
fixUrl(eps.selectFirst("a")?.attr("href") ?: return@mapNotNull null),
episode = eps.selectFirst("a")?.text()?.toIntOrNull()
)
val episodes = mutableListOf<Episode>()
document.select("div#stream > ul:first-child li").apmap { ele ->
val page = ele.selectFirst("a")
val epsDocument = app.get(fixUrl(page?.attr("href") ?: return@apmap)).document
epsDocument.select("div#stream > ul:nth-child(4) li").mapNotNull { eps ->
episodes.add(
Episode(
fixUrl(eps.selectFirst("a")?.attr("href") ?: return@mapNotNull null),
episode = eps.selectFirst("a")?.text()?.toIntOrNull(),
season = page.text().toIntOrNull()
)
)
}
}
return newAnimeLoadResponse(