From 459fb936bbf4e38e9144ec72ff741b6d57dd6a17 Mon Sep 17 00:00:00 2001 From: Vetle Ledaal Date: Sat, 22 Jul 2023 15:46:25 +0200 Subject: [PATCH] MangaSwat: update domain (#17213) Also fixes chapter name and date parsing --- .../mangathemesia/mangaswat/src/MangaSwat.kt | 13 +++++++++++-- .../mangathemesia/MangaThemesiaGenerator.kt | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/multisrc/overrides/mangathemesia/mangaswat/src/MangaSwat.kt b/multisrc/overrides/mangathemesia/mangaswat/src/MangaSwat.kt index 220816e7e..3b65510b8 100644 --- a/multisrc/overrides/mangathemesia/mangaswat/src/MangaSwat.kt +++ b/multisrc/overrides/mangathemesia/mangaswat/src/MangaSwat.kt @@ -8,11 +8,13 @@ import eu.kanade.tachiyomi.extension.BuildConfig import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.Page +import eu.kanade.tachiyomi.source.model.SChapter import kotlinx.serialization.Serializable import kotlinx.serialization.decodeFromString import okhttp3.Headers import okhttp3.OkHttpClient import org.jsoup.nodes.Document +import org.jsoup.nodes.Element import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import java.text.SimpleDateFormat @@ -22,9 +24,9 @@ class MangaSwat : MangaThemesia( "MangaSwat", "https://swatmanga.me", "ar", - dateFormat = SimpleDateFormat("yyyy-MM-dd", Locale.US), + dateFormat = SimpleDateFormat("MMMM dd, yyyy", Locale("ar")), ) { - private val defaultBaseUrl = "https://swatmanga.me" + private val defaultBaseUrl = "https://swatop.club" override val baseUrl by lazy { getPrefBaseUrl() } @@ -55,6 +57,13 @@ class MangaSwat : MangaThemesia( override fun chapterListSelector() = "div.bxcl li, ul div:has(span.lchx)" + override fun chapterFromElement(element: Element) = SChapter.create().apply { + val urlElements = element.select("a") + setUrlWithoutDomain(urlElements.attr("href")) + name = element.select(".lch a, .chapternum").text().ifBlank { urlElements.last()!!.text() } + date_upload = element.selectFirst(".chapter-date")?.text().parseChapterDate() + } + @Serializable data class TSReader( val sources: List, diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesiaGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesiaGenerator.kt index 02718fa85..a3e410175 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesiaGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesiaGenerator.kt @@ -72,7 +72,7 @@ class MangaThemesiaGenerator : ThemeSourceGenerator { SingleLang("MangaWT", "https://mangawt.com", "tr", overrideVersionCode = 5), SingleLang("Mangayaro", "https://mangayaro.net", "id"), SingleLang("Manhwa Lover", "https://manhwalover.com", "en", isNsfw = true, overrideVersionCode = 1), - SingleLang("MangaSwat", "https://swatmanga.me", "ar", overrideVersionCode = 9), + SingleLang("MangaSwat", "https://swatop.club", "ar", overrideVersionCode = 10), SingleLang("MangKomik", "https://mangkomik.net", "id", overrideVersionCode = 1), SingleLang("Mangás Chan", "https://mangaschan.com", "pt-BR", className = "MangasChan"), SingleLang("Manhwa Freak", "https://manhwafreak.com", "en", overrideVersionCode = 1),