From 6b6ad793ac8ad4aa242ea98091f2d9f89d00c7f4 Mon Sep 17 00:00:00 2001 From: Mike <51273546+SnakeDoc83@users.noreply.github.com> Date: Fri, 6 Dec 2019 08:11:07 -0500 Subject: [PATCH] MangaMx - add Doujin-Yang (#1857) MangaMx - add Doujin-Yang --- src/es/mangamx/build.gradle | 6 +- .../tachiyomi/extension/es/mangamx/MangaMx.kt | 20 +-- .../extension/es/mangamx/MangaMxFactory.kt | 156 ++++++++++++++++++ 3 files changed, 169 insertions(+), 13 deletions(-) create mode 100644 src/es/mangamx/src/eu/kanade/tachiyomi/extension/es/mangamx/MangaMxFactory.kt diff --git a/src/es/mangamx/build.gradle b/src/es/mangamx/build.gradle index c1f6d5a4c..ada6c98f1 100644 --- a/src/es/mangamx/build.gradle +++ b/src/es/mangamx/build.gradle @@ -2,10 +2,10 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' ext { - appName = 'Tachiyomi: MangaMx' + appName = 'Tachiyomi: MangaMx & Doujin-Yang' pkgNameSuffix = 'es.mangamx' - extClass = '.MangaMx' - extVersionCode = 3 + extClass = '.MangaMxFactory' + extVersionCode = 4 libVersion = '1.2' } diff --git a/src/es/mangamx/src/eu/kanade/tachiyomi/extension/es/mangamx/MangaMx.kt b/src/es/mangamx/src/eu/kanade/tachiyomi/extension/es/mangamx/MangaMx.kt index 520b100b4..cd170427f 100644 --- a/src/es/mangamx/src/eu/kanade/tachiyomi/extension/es/mangamx/MangaMx.kt +++ b/src/es/mangamx/src/eu/kanade/tachiyomi/extension/es/mangamx/MangaMx.kt @@ -17,9 +17,9 @@ import okhttp3.Response import org.jsoup.nodes.Document import org.jsoup.nodes.Element import java.text.SimpleDateFormat -import java.util.* +import java.util.Locale -class MangaMx : ParsedHttpSource() { +open class MangaMx : ParsedHttpSource() { override val name = "MangaMx" override val baseUrl = "https://manga-mx.com" @@ -173,7 +173,7 @@ class MangaMx : ParsedHttpSource() { SortFilter() ) - private class GenreFilter : UriPartFilter("Género", "genero", arrayOf( + class GenreFilter : UriPartFilter("Género", "genero", arrayOf( Pair("all","All"), Pair("3","Acción"), Pair("35","Artes Marciales"), @@ -214,7 +214,7 @@ class MangaMx : ParsedHttpSource() { Pair("16","Yuri") )) - private class LetterFilter : UriPartFilter("Letra","letra", arrayOf( + class LetterFilter : UriPartFilter("Letra","letra", arrayOf( Pair("all","All"), Pair("a","A"), Pair("b","B"), @@ -244,7 +244,7 @@ class MangaMx : ParsedHttpSource() { Pair("z","Z") )) - private class StatusFilter : UriPartFilter("Estado", "estado", arrayOf( + class StatusFilter : UriPartFilter("Estado", "estado", arrayOf( Pair("all","All"),Pair("1","En desarrollo"), Pair("0","Finalizado"))) private class TypeFilter : UriPartFilter("Tipo", "tipo", arrayOf( @@ -259,7 +259,7 @@ class MangaMx : ParsedHttpSource() { private class AdultFilter : UriPartFilter("Filtro adulto", "adulto", arrayOf( Pair("all","All"),Pair("0","Mostrar solo +18"), Pair("1","No mostrar +18"))) - private class SortFilter : UriPartFilterreq("Sort", "orden", arrayOf( + class SortFilter : UriPartFilterreq("Sort", "orden", arrayOf( Pair("visitas","Visitas"), Pair("desc","Descendente"), Pair("asc","Ascendente"), @@ -273,9 +273,9 @@ class MangaMx : ParsedHttpSource() { * If `firstIsUnspecified` is set to true, if the first entry is selected, nothing will be appended on the the URI. */ //vals: - private open class UriPartFilter(displayName: String, val uriParam: String, val vals: Array>, - val firstIsUnspecified: Boolean = true, - defaultValue: Int = 0) : + open class UriPartFilter(displayName: String, private val uriParam: String, private val vals: Array>, + private val firstIsUnspecified: Boolean = true, + defaultValue: Int = 0) : Filter.Select(displayName, vals.map { it.second }.toTypedArray(), defaultValue), UriFilter { override fun addToUri(uri: Uri.Builder) { if (state != 0 || !firstIsUnspecified) @@ -283,7 +283,7 @@ class MangaMx : ParsedHttpSource() { } } - private open class UriPartFilterreq(displayName: String, val uriParam: String, val vals: Array>) : + open class UriPartFilterreq(displayName: String, private val uriParam: String, private val vals: Array>) : Filter.Select(displayName, vals.map { it.second }.toTypedArray()), UriFilter { override fun addToUri(uri: Uri.Builder) { uri.appendQueryParameter(uriParam, vals[state].first) diff --git a/src/es/mangamx/src/eu/kanade/tachiyomi/extension/es/mangamx/MangaMxFactory.kt b/src/es/mangamx/src/eu/kanade/tachiyomi/extension/es/mangamx/MangaMxFactory.kt new file mode 100644 index 000000000..6d4a62aaf --- /dev/null +++ b/src/es/mangamx/src/eu/kanade/tachiyomi/extension/es/mangamx/MangaMxFactory.kt @@ -0,0 +1,156 @@ +package eu.kanade.tachiyomi.extension.es.mangamx + +import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.network.POST +import eu.kanade.tachiyomi.source.Source +import eu.kanade.tachiyomi.source.SourceFactory +import eu.kanade.tachiyomi.source.model.* +import eu.kanade.tachiyomi.util.asJsoup +import okhttp3.Request +import okhttp3.RequestBody +import okhttp3.Response + +class MangaMxFactory : SourceFactory { + override fun createSources(): List = listOf( + MangaMx(), + DoujinYang() + ) +} + +class DoujinYang: MangaMx() { + override val baseUrl = "https://doujin-yang.es" + + override val name = "Doujin-Yang" + + override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/reciente/doujin?p=$page", headers) + + override fun latestUpdatesSelector() = popularMangaSelector() + + override fun latestUpdatesNextPageSelector() = "nav#paginacion a:contains(Última)" + + override fun searchMangaNextPageSelector() = latestUpdatesNextPageSelector() + + override fun chapterListRequest(manga: SManga): Request { + return GET(baseUrl + manga.url, headers) + } + + override fun chapterListParse(response: Response): List { + return response.asJsoup().select("div#c_list a").map { element -> + SChapter.create().apply { + name = element.select("h3").text() + setUrlWithoutDomain(element.attr("abs:href")) + } + } + } + + override fun pageListRequest(chapter: SChapter): Request { + return POST(baseUrl + chapter.url, + headersBuilder().add("Content-Type", "application/x-www-form-urlencoded").build(), + RequestBody.create(null, "info") + ) + } + + override fun pageListParse(response: Response): List { + return response.body()!!.string().substringAfter(",[").substringBefore("]") + .replace(Regex("""[\\"]"""), "").split(",").let { list -> + val path = "http:" + list[0] + list.drop(1).mapIndexed { i, img -> Page(i, "", path + img) } + } + } + + override fun getFilterList() = FilterList( + Filter.Header("NOTA: ¡La búsqueda de títulos no funciona!"), // "Title search not working" + Filter.Separator(), + GenreFilter(), + LetterFilter(), + StatusFilter(), + SortFilter() + ) + + class GenreFilter : UriPartFilter("Género", "genero", arrayOf( + Pair("all","All"), + Pair("1","Ahegao"), + Pair("379","Alien"), + Pair("2","Anal"), + Pair("490","Android18"), + Pair("717","Angel"), + Pair("633","Asphyxiation"), + Pair("237","Bandages"), + Pair("77","Bbw"), + Pair("143","Bdsm"), + Pair("23","Blackmail"), + Pair("113","Blindfold"), + Pair("24","Blowjob"), + Pair("166","Blowjobface"), + Pair("25","Body Writing"), + Pair("314","Bodymodification"), + Pair("806","Bodystocking"), + Pair("366","Bodysuit"), + Pair("419","Bodyswap"), + Pair("325","Bodywriting"), + Pair("5","Bondage"), + Pair("51","Bukkake"), + Pair("410","Catgirl"), + Pair("61","Chastitybelt"), + Pair("78","Cheating"), + Pair("293","Cheerleader"), + Pair("62","Collar"), + Pair("120","Compilation"), + Pair("74","Condom"), + Pair("63","Corruption"), + Pair("191","Corset"), + Pair("234","Cosplaying"), + Pair("389","Cowgirl"), + Pair("256","Crossdressing"), + Pair("179","Crotchtattoo"), + Pair("689","Crown"), + Pair("733","Cumflation"), + Pair("385","Cumswap"), + Pair("251","Cunnilingus"), + Pair("75","Darkskin"), + Pair("180","Daughter"), + Pair("52","Deepthroat"), + Pair("28","Defloration"), + Pair("198","Demon"), + Pair("145","Demongirl"), + Pair("64","Drugs"), + Pair("95","Drunk"), + Pair("462","Femalesonly"), + Pair("82","Femdom"), + Pair("139","Ffmthreesome"), + Pair("823","Fftthreesome"), + Pair("55","Full Color"), + Pair("181","Fullbodytattoo"), + Pair("203","Fullcensorship"), + Pair("111","Fullcolor"), + Pair("114","Gag"), + Pair("3","Glasses"), + Pair("515","Gloryhole"), + Pair("116","Humanpet"), + Pair("32","Humiliation"), + Pair("147","Latex"), + Pair("12","Maid"), + Pair("4","Milf"), + Pair("245","Military"), + Pair("414","Milking"), + Pair("34","Mind Control"), + Pair("68","Mindbreak"), + Pair("124","Mindcontrol"), + Pair("645","Nun"), + Pair("312","Nurse"), + Pair("272","Robot"), + Pair("7","Romance"), + Pair("761","Sundress"), + Pair("412","Tailplug"), + Pair("253","Tutor"), + Pair("259","Twins"), + Pair("207","Twintails"), + Pair("840","Valkyrie"), + Pair("530","Vampire"), + Pair("16","Yuri"), + Pair("273","Zombie") + )) +} + + +