From 2e2a62d50ad347179ac8e6f16fc9080265cd19fb Mon Sep 17 00:00:00 2001 From: Mike <51273546+SnakeDoc83@users.noreply.github.com> Date: Thu, 7 May 2020 17:46:47 -0400 Subject: [PATCH] Madara - add 1st Kiss Mahua, Hero Manhua, Martial Scans (#3062) --- src/all/madara/build.gradle | 2 +- .../tachiyomi/extension/all/madara/Madara.kt | 2 +- .../extension/all/madara/MadaraFactory.kt | 34 +++++++++++++++++-- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/src/all/madara/build.gradle b/src/all/madara/build.gradle index 849c3d248..c99f79233 100644 --- a/src/all/madara/build.gradle +++ b/src/all/madara/build.gradle @@ -5,7 +5,7 @@ ext { appName = 'Tachiyomi: Madara (multiple sources)' pkgNameSuffix = "all.madara" extClass = '.MadaraFactory' - extVersionCode = 88 + extVersionCode = 89 libVersion = '1.2' } diff --git a/src/all/madara/src/eu/kanade/tachiyomi/extension/all/madara/Madara.kt b/src/all/madara/src/eu/kanade/tachiyomi/extension/all/madara/Madara.kt index 50001ea16..b06645fe1 100644 --- a/src/all/madara/src/eu/kanade/tachiyomi/extension/all/madara/Madara.kt +++ b/src/all/madara/src/eu/kanade/tachiyomi/extension/all/madara/Madara.kt @@ -346,7 +346,7 @@ abstract class Madara( return manga } - private fun imageFromElement(element: Element): String? { + protected fun imageFromElement(element: Element): String? { return when { element.hasAttr("data-src") -> element.attr("abs:data-src") element.hasAttr("data-lazy-src") -> element.attr("abs:data-lazy-src") diff --git a/src/all/madara/src/eu/kanade/tachiyomi/extension/all/madara/MadaraFactory.kt b/src/all/madara/src/eu/kanade/tachiyomi/extension/all/madara/MadaraFactory.kt index ff5b5a092..1786c5b92 100644 --- a/src/all/madara/src/eu/kanade/tachiyomi/extension/all/madara/MadaraFactory.kt +++ b/src/all/madara/src/eu/kanade/tachiyomi/extension/all/madara/MadaraFactory.kt @@ -115,7 +115,10 @@ class MadaraFactory : SourceFactory { WeScans(), ArangScans(), MangaHentai(), - MangaPhoenix() + MangaPhoenix(), + FirstKissManhua(), + HeroManhua(), + MartialScans() // Removed by request of site owner // EarlyManga(), @@ -579,7 +582,6 @@ class ManyToonClub : Madara("ManyToonClub", "https://manytoon.club", "ko") class ManhuaUS : Madara("ManhuaUS", "https://manhuaus.com", "en") { override val pageListParseSelector = "li.blocks-gallery-item" - override fun chapterListParse(response: Response): List = super.chapterListParse(response).reversed() } class MangaWT : Madara("MangaWT", "https://mangawt.com", "tr") @@ -633,4 +635,30 @@ class ArangScans : Madara("Arang Scans", "https://www.arangscans.xyz", "en") class MangaHentai : Madara("Manga Hentai", "https://mangahentai.me", "en") -class MangaPhoenix : Madara("Manga Phoenix", "https://mangaphoenix.com/", "tr") +class MangaPhoenix : Madara("Manga Phoenix", "https://mangaphoenix.com", "tr") + +class FirstKissManhua : Madara("1st Kiss Manhua", "https://1stkissmanhua.com", "en", SimpleDateFormat("d MMM yyyy", Locale.US)) { + override fun imageRequest(page: Page): Request = GET(page.imageUrl!!, headersBuilder().add("Referer", "https://1stkissmanga.com").build()) +} + +class HeroManhua : Madara("Hero Manhua", "https://heromanhua.com", "en") + +class MartialScans : Madara("Martial Scans", "https://martialscans.com", "en") { + override fun popularMangaFromElement(element: Element): SManga { + val manga = SManga.create() + + with(element) { + select(popularMangaUrlSelector).last()?.let { + manga.setUrlWithoutDomain(it.attr("href")) + manga.title = it.ownText() + } + + select("img").last()?.let { + manga.thumbnail_url = imageFromElement(it) + } + } + + return manga + } + override fun searchMangaFromElement(element: Element): SManga = popularMangaFromElement(element) +}