mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-14 19:01:15 +00:00
fix(madara): handle multi-element description with paragraph support and <br> replacement
This commit is contained in:
@@ -169,13 +169,25 @@ class Madara extends MProvider {
|
|||||||
final document = parseHtml(res);
|
final document = parseHtml(res);
|
||||||
manga.author = document.selectFirst("div.author-content > a")?.text ?? "";
|
manga.author = document.selectFirst("div.author-content > a")?.text ?? "";
|
||||||
|
|
||||||
manga.description =
|
final descriptionElement = document.select(
|
||||||
document
|
"div.description-summary div.summary__content, div.summary_content div.post-content_item > h5 + div, div.summary_content div.manga-excerpt, .manga-summary",
|
||||||
.selectFirst(
|
);
|
||||||
"div.description-summary div.summary__content, div.summary_content div.post-content_item > h5 + div, div.summary_content div.manga-excerpt, div.sinopsis div.contenedor, .description-summary > p",
|
if (descriptionElement.isNotEmpty) {
|
||||||
)
|
final paragraphs = descriptionElement
|
||||||
?.text ??
|
.expand((e) => e.select("p"))
|
||||||
"";
|
.toList();
|
||||||
|
|
||||||
|
if (paragraphs.isNotEmpty &&
|
||||||
|
paragraphs.any((p) => p.text.trim().isNotEmpty)) {
|
||||||
|
manga.description = paragraphs
|
||||||
|
.map((p) => p.text.replaceAll("<br>", "\n").trim())
|
||||||
|
.join("\n\n");
|
||||||
|
} else {
|
||||||
|
manga.description = descriptionElement
|
||||||
|
.map((e) => e.text.trim())
|
||||||
|
.join("\n\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final imageElement = document.selectFirst("div.summary_image img");
|
final imageElement = document.selectFirst("div.summary_image img");
|
||||||
manga.imageUrl = extractImageUrl(imageElement);
|
manga.imageUrl = extractImageUrl(imageElement);
|
||||||
|
|||||||
Reference in New Issue
Block a user