From 9a163bf5fdb139c1bfb85a493a4bc0b053dc5be6 Mon Sep 17 00:00:00 2001 From: Mike <51273546+SnakeDoc83@users.noreply.github.com> Date: Tue, 12 May 2020 07:08:59 -0400 Subject: [PATCH] Madara - MangaStream genres (#3127) * Madara - MangaStream genres * Update build.gradle --- src/all/madara/build.gradle | 2 +- .../tachiyomi/extension/all/madara/Madara.kt | 7 ++- .../extension/all/madara/MadaraFactory.kt | 62 ++++++++++++++++++- 3 files changed, 66 insertions(+), 5 deletions(-) diff --git a/src/all/madara/build.gradle b/src/all/madara/build.gradle index b7529f22f..8e4ee303f 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 = 91 + extVersionCode = 92 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 b06645fe1..c7228bab4 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 @@ -19,6 +19,7 @@ import java.util.Locale import java.util.concurrent.TimeUnit import okhttp3.CacheControl import okhttp3.FormBody +import okhttp3.Headers import okhttp3.HttpUrl import okhttp3.OkHttpClient import okhttp3.Request @@ -80,8 +81,10 @@ abstract class Madara( add("vars[manga_archives_item_layout]", "big_thumbnail") } + open val formHeaders: Headers by lazy { headersBuilder().build() } + override fun popularMangaRequest(page: Int): Request { - return POST("$baseUrl/wp-admin/admin-ajax.php", headers, formBuilder(page, true).build(), CacheControl.FORCE_NETWORK) + return POST("$baseUrl/wp-admin/admin-ajax.php", formHeaders, formBuilder(page, true).build(), CacheControl.FORCE_NETWORK) } override fun popularMangaNextPageSelector(): String? = "body:not(:has(.no-posts))" @@ -96,7 +99,7 @@ abstract class Madara( } override fun latestUpdatesRequest(page: Int): Request { - return POST("$baseUrl/wp-admin/admin-ajax.php", headers, formBuilder(page, false).build(), CacheControl.FORCE_NETWORK) + return POST("$baseUrl/wp-admin/admin-ajax.php", formHeaders, formBuilder(page, false).build(), CacheControl.FORCE_NETWORK) } override fun latestUpdatesNextPageSelector(): String? = popularMangaNextPageSelector() 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 1117d0d1d..5be55a6e5 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 @@ -442,7 +442,12 @@ class HunterFansub : Madara("Hunter Fansub", "https://hunterfansub.com", "es") { class MangaArabTeam : Madara("مانجا عرب تيم Manga Arab Team", "https://mangaarabteam.com", "ar") -class NightComic : Madara("Night Comic", "https://www.nightcomic.com", "en") +class NightComic : Madara("Night Comic", "https://nightcomic.com", "en") { + override val formHeaders: Headers = headersBuilder() + .add("Content-Type", "application/x-www-form-urlencoded") + .add("X-MOD-SBB-CTYPE", "xhr") + .build() +} class Toonily : Madara("Toonily", "https://toonily.com", "en") @@ -532,7 +537,60 @@ class MangaKiss : Madara("MangaKiss", "https://mangakiss.org", "en", SimpleDateF class MangaDods : Madara("MangaDods", "https://www.mangadods.com", "en", SimpleDateFormat("dd/MM/yyyy", Locale.US)) -class MangaStream : Madara("MangaStream", "https://www.mangastream.cc", "en") +class MangaStream : Madara("MangaStream", "https://www.mangastream.cc", "en") { + override fun getGenreList() = listOf( + Genre("Action", "action-manga"), + Genre("Adventure", "adventure-manga"), + Genre("Bara", "bara-manga"), + Genre("BL Manga", "bl-manga"), + Genre("Comedy", "comedy-manga"), + Genre("Comics", "comics-online"), + Genre("Completed Manga", "completed-manga"), + Genre("Drama", "drama-manga"), + Genre("Ecchi", "ecchi-manga"), + Genre("Fantasy", "fantasy-manga"), + Genre("Gender Bender", "gender-bender-manga"), + Genre("Hardcore Yaoi", "hardcore-yaoi"), + Genre("Harem", "harem-manga"), + Genre("Hipercool", "hipercool"), + Genre("Historical", "historical"), + Genre("Horror", "horror-manga"), + Genre("Incest", "incest-manga"), + Genre("Josei", "josei"), + Genre("Lolicon", "lolicon-manga"), + Genre("Manga", "manga"), + Genre("Manhua", "manhua"), + Genre("Manhwa", "manhwa-manga"), + Genre("Manhwa Hentai Manga", "manhwahentai"), + Genre("Martial Arts", "martial-arts-manga"), + Genre("Mature", "mature-manga"), + Genre("Mystery", "mystery"), + Genre("One shot", "one-shot"), + Genre("Psychological", "psychological-manga"), + Genre("Rape", "rape-manga"), + Genre("Reincarnation", "reincarnation-manga"), + Genre("Reverse Harem", "reverse-harem"), + Genre("Romance", "romance-manga"), + Genre("School Life", "read-school-life-manga"), + Genre("Sci-fi", "sci-fi"), + Genre("Seinen", "seinen-manga"), + Genre("Shotacon", "shotacon"), + Genre("Shoujo", "shoujo-manga"), + Genre("Shoujo Ai", "shoujo-ai"), + Genre("Shounen", "shounen-manga"), + Genre("Shounen Ai", "shounen-ai"), + Genre("Slice of Life", "slice-of-life"), + Genre("Smut", "smut-manga"), + Genre("Soft Yaoi", "soft-yaoi"), + Genre("Soft Yuri", "soft-yuri"), + Genre("Sports", "sports-manga"), + Genre("Supernatural", "supernatural"), + Genre("Tragedy", "tragedy"), + Genre("Webtoon", "webtoons"), + Genre("Yaoi", "yaoi-manga"), + Genre("Yuri", "yuri-manga") + ) +} class NeoxScanlator : Madara("Neox Scanlator", "https://neoxscan.com/newsite", "pt-BR", SimpleDateFormat("dd 'de' MMM 'de' yyyy", Locale("pt", "BR"))) { override fun headersBuilder(): Headers.Builder = Headers.Builder()