From 52ff0a4b8d0dde5d424e35f34480d3a2966a4fd0 Mon Sep 17 00:00:00 2001 From: Saud-97 <39028181+Saud-97@users.noreply.github.com> Date: Wed, 8 Jun 2022 02:49:23 +0300 Subject: [PATCH] Manga Pro cover and chapter list bugs fixed (#12111) * Fixed #11881 and #11809 * Updated override code * Code Reformatting --- .../wpmangastream/mangaproz/src/MangaPro.kt | 37 +++++++++++++++++++ .../wpmangastream/WPMangaStreamGenerator.kt | 2 +- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/multisrc/overrides/wpmangastream/mangaproz/src/MangaPro.kt b/multisrc/overrides/wpmangastream/mangaproz/src/MangaPro.kt index 20bf0a7f5..ea5a0de47 100644 --- a/multisrc/overrides/wpmangastream/mangaproz/src/MangaPro.kt +++ b/multisrc/overrides/wpmangastream/mangaproz/src/MangaPro.kt @@ -2,7 +2,12 @@ package eu.kanade.tachiyomi.extension.ar.mangaproz import eu.kanade.tachiyomi.multisrc.wpmangastream.WPMangaStream import eu.kanade.tachiyomi.network.interceptor.rateLimit +import eu.kanade.tachiyomi.source.model.SChapter +import eu.kanade.tachiyomi.source.model.SManga import okhttp3.OkHttpClient +import okhttp3.Response +import org.jsoup.nodes.Document +import org.jsoup.nodes.Element import java.util.concurrent.TimeUnit class MangaPro : WPMangaStream("Manga Pro", "https://mangaprotm.com", "ar") { @@ -13,4 +18,36 @@ class MangaPro : WPMangaStream("Manga Pro", "https://mangaprotm.com", "ar") { .readTimeout(30, TimeUnit.SECONDS) .rateLimit(4) .build() + + override fun chapterListParse(response: Response): List = + super.chapterListParse(response).filter { !it.url.isNullOrEmpty() } + + override fun chapterFromElement(element: Element): SChapter { + val urlElement = element.select(".lchx > a, span.leftoff a, div.eph-num > a").first() + val chapter = SChapter.create() + + // ignore chapters that are protected behind ads shortners. + if (urlElement.attr("href").startsWith(baseUrl)) + chapter.setUrlWithoutDomain(urlElement.attr("href")) + else + chapter.setUrlWithoutDomain("") + + chapter.name = if (urlElement.select("span.chapternum") + .isNotEmpty()) urlElement.select("span.chapternum").text() else urlElement.text() + chapter.name = chapter.name.replace("-*free".toRegex(RegexOption.IGNORE_CASE), "") + chapter.date_upload = + element.select("span.rightoff, time, span.chapterdate").firstOrNull()?.text() + ?.let { parseChapterDate(it) } + ?: 0 + return chapter + } + + override fun mangaDetailsParse(document: Document): SManga = + super.mangaDetailsParse(document).apply { + document.select("div.bigcontent, div.animefull, div.main-info").firstOrNull() + ?.let { infoElement -> + thumbnail_url = + infoElement.select(mangaDetailsSelectorThumbnail).attr("abs:data-lazy-src") + } + } } diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/wpmangastream/WPMangaStreamGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/wpmangastream/WPMangaStreamGenerator.kt index e0882cdc8..b06f7d383 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/wpmangastream/WPMangaStreamGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/wpmangastream/WPMangaStreamGenerator.kt @@ -26,7 +26,7 @@ class WPMangaStreamGenerator : ThemeSourceGenerator { SingleLang("Komik Station", "https://komikstation.co", "id", overrideVersionCode = 3), SingleLang("KomikIndo.co", "https://komikindo.co", "id", className = "KomikindoCo", overrideVersionCode = 3), SingleLang("Kuma Scans (Kuma Translation)", "https://kumascans.com", "en", className = "KumaScans", overrideVersionCode = 1), - SingleLang("Manga Pro", "https://mangaprotm.com", "ar", pkgName = "mangaproz", overrideVersionCode = 2), + SingleLang("Manga Pro", "https://mangaprotm.com", "ar", pkgName = "mangaproz", overrideVersionCode = 3), SingleLang("Manga Raw.org", "https://mangaraw.org", "ja", className = "MangaRawOrg", overrideVersionCode = 1), SingleLang("Manhwax", "https://manhwax.com", "en", isNsfw = true), SingleLang("MangaSwat", "https://swatmanga.co", "ar", overrideVersionCode = 6),