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 // use an integer for version numbers
version = 1 version = 2
cloudstream { cloudstream {

View file

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