From 8d7eabdd71bf6529cce0d62b291babbe6d983a8b Mon Sep 17 00:00:00 2001 From: devi <70220050+davvarrr@users.noreply.github.com> Date: Tue, 20 Jun 2023 19:05:20 +0200 Subject: [PATCH] Create ReaperScansFr.kt add reaperscans.fr --- .../parsers/site/madara/ReaperScansFr.kt | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/main/kotlin/org/koitharu/kotatsu/parsers/site/madara/ReaperScansFr.kt diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/madara/ReaperScansFr.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/madara/ReaperScansFr.kt new file mode 100644 index 00000000..931912c3 --- /dev/null +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/madara/ReaperScansFr.kt @@ -0,0 +1,36 @@ +package org.koitharu.kotatsu.parsers.site.madara + +import kotlinx.coroutines.async +import kotlinx.coroutines.coroutineScope +import org.koitharu.kotatsu.parsers.MangaLoaderContext +import org.koitharu.kotatsu.parsers.MangaSourceParser +import org.koitharu.kotatsu.parsers.exception.ParseException +import org.koitharu.kotatsu.parsers.model.* +import org.koitharu.kotatsu.parsers.util.* + +@MangaSourceParser("REAPERSCANS_FR", "ReaperScansFr", "fr") +internal class ReaperScansFr(context: MangaLoaderContext) : + MadaraParser(context, MangaSource.REAPERSCANS_FR, "reaperscans.fr") { + + override val datePattern = "MM/dd/yyyy" + + override suspend fun getDetails(manga: Manga): Manga = coroutineScope { + val fullUrl = manga.url.toAbsoluteUrl(domain) + val doc = webClient.httpGet(fullUrl).parseHtml() + val chaptersDeferred = async { getChapters(manga, doc) } + val root = doc.body().selectFirstOrThrow(".site-content") + manga.copy( + tags = root.selectFirst("div.genres-content")?.select("a")?.mapNotNullToSet { a -> + MangaTag( + key = a.attr("href").removeSuffix("/").substringAfterLast('/'), + title = a.text().toTitleCase(), + source = source, + ) + } ?: manga.tags, + description = root.requireElementById("nav-profile") + .selectFirstOrThrow(".description-summary") + .firstElementChild()?.html(), + chapters = chaptersDeferred.await(), + ) + } +}