Mangas Origines: Fix manga details (#13794)

This commit is contained in:
nzoba 2022-10-10 18:22:32 +02:00 committed by GitHub
parent 740da29bc5
commit 4cb0f31777
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 10 deletions

View File

@ -7,7 +7,7 @@ import org.jsoup.nodes.Element
import java.text.SimpleDateFormat
import java.util.Locale
class MangasOrigines : Madara("Mangas Origines", "https://mangas-origines.fr", "fr", SimpleDateFormat("dd MMM yyyy", Locale("fr"))) {
class MangasOrigines : Madara("Mangas Origines", "https://mangas-origines.fr", "fr", SimpleDateFormat("dd/MM/yyyy", Locale("fr"))) {
override val useNewChapterEndpoint = true
private fun String.removeFireEmoji() = this.substringAfter("\uD83D\uDD25 ")
@ -34,7 +34,7 @@ class MangasOrigines : Madara("Mangas Origines", "https://mangas-origines.fr", "
}.joinToString().takeIf { it.isNotBlank() }?.let {
manga.artist = it
}
select("div.description-summary div.summary__content").let {
select("div.manga-excerpt").let {
if (it.select("p").text().isNotEmpty()) {
manga.description = it.select("p").joinToString(separator = "\n\n") { p ->
p.text().replace("<br>", "\n")
@ -47,12 +47,15 @@ class MangasOrigines : Madara("Mangas Origines", "https://mangas-origines.fr", "
manga.thumbnail_url = imageFromElement(it)
}
select("div.summary-content").last()?.let {
manga.status = when (it.text()) {
// I don't know what's the corresponding for COMPLETED and LICENSED
// There's no support for "Canceled" or "On Hold"
"Terminé ⚫" -> SManga.COMPLETED
"En cours \uD83D\uDFE2" -> SManga.ONGOING
else -> SManga.UNKNOWN
manga.status = with(it.text()) {
when {
// There's no support for LICENSED and PUBLISHING_FINISHED
contains("Complété") -> SManga.COMPLETED
contains("Annulé") -> SManga.CANCELLED
contains("En pause") -> SManga.ON_HIATUS
contains("En cours") -> SManga.ONGOING
else -> SManga.UNKNOWN
}
}
}
val genres = select("div.genres-content a")
@ -76,7 +79,7 @@ class MangasOrigines : Madara("Mangas Origines", "https://mangas-origines.fr", "
manga.genre = genres.toList().joinToString(", ") { it.capitalize(Locale.ROOT) }
// add alternative name to manga description
document.select(altNameSelector).firstOrNull()?.ownText()?.let {
document.select("div.summary-heading:contains(Autre) + .summary-content").firstOrNull()?.ownText()?.let {
if (it.isBlank().not() && it.notUpdating()) {
manga.description = when {
manga.description.isNullOrBlank() -> altName + it

View File

@ -277,7 +277,7 @@ class MadaraGenerator : ThemeSourceGenerator {
SingleLang("MangaRex", "https://mangarex.co", "en"),
SingleLang("MangaRolls", "https://mangarolls.com", "en"),
SingleLang("Mangas Origines X", "https://x.mangas-origines.fr", "fr", isNsfw = true),
SingleLang("Mangas Origines", "https://mangas-origines.fr", "fr", isNsfw = true, overrideVersionCode = 2),
SingleLang("Mangas Origines", "https://mangas-origines.fr", "fr", isNsfw = true, overrideVersionCode = 3),
SingleLang("Mangas18", "https://mangas18.com", "en"),
SingleLang("MangaSco", "https://mangasco.com", "en", overrideVersionCode = 1),
SingleLang("MangaSiro", "https://mangasiro.com", "en", isNsfw = true),