From ce9404da8444c9f77e7502ec68400c97b2bba50b Mon Sep 17 00:00:00 2001 From: Koitharu Date: Wed, 9 Oct 2024 17:18:48 +0300 Subject: [PATCH] [Madara] Fix multiple pages handling --- .../parsers/site/madara/MadaraParser.kt | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/madara/MadaraParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/madara/MadaraParser.kt index f4eb9d16..2f22f97a 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/madara/MadaraParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/madara/MadaraParser.kt @@ -678,15 +678,16 @@ internal abstract class MadaraParser( "No image found, try to log in", fullUrl, ) - return root.select(selectPage).map { div -> - val img = div.selectFirstOrThrow("img") - val url = img.src()?.toRelativeUrl(domain) ?: div.parseFailed("Image src not found") - MangaPage( - id = generateUid(url), - url = url, - preview = null, - source = source, - ) + return root.select(selectPage).flatMap { div -> + div.selectOrThrow("img").map { img -> + val url = img.src()?.toRelativeUrl(domain) ?: div.parseFailed("Image src not found") + MangaPage( + id = generateUid(url), + url = url, + preview = null, + source = source, + ) + } } } } else {