From e6b3028dd697975da02b496f288484e0768a547d Mon Sep 17 00:00:00 2001 From: Mike <51273546+SnakeDoc83@users.noreply.github.com> Date: Sun, 17 May 2020 18:37:45 -0400 Subject: [PATCH] WP Mangastream - fix komikindo (#3216) * WP Mangastream - fix komikindo * Merge remote-tracking branch 'upstream/master' into wpmangastream * Update build.gradle --- src/all/wpmangastream/build.gradle | 2 +- .../all/wpmangastream/WPMangaStream.kt | 3 +- .../all/wpmangastream/WPMangaStreamFactory.kt | 148 +----------------- 3 files changed, 7 insertions(+), 146 deletions(-) diff --git a/src/all/wpmangastream/build.gradle b/src/all/wpmangastream/build.gradle index 498abfa88..245b88304 100644 --- a/src/all/wpmangastream/build.gradle +++ b/src/all/wpmangastream/build.gradle @@ -5,7 +5,7 @@ ext { appName = 'Tachiyomi: WP Manga Stream' pkgNameSuffix = 'all.wpmangastream' extClass = '.WPMangaStreamFactory' - extVersionCode = 11 + extVersionCode = 12 libVersion = '1.2' } diff --git a/src/all/wpmangastream/src/eu/kanade/tachiyomi/extension/all/wpmangastream/WPMangaStream.kt b/src/all/wpmangastream/src/eu/kanade/tachiyomi/extension/all/wpmangastream/WPMangaStream.kt index 3e90ff58f..0411e76c7 100644 --- a/src/all/wpmangastream/src/eu/kanade/tachiyomi/extension/all/wpmangastream/WPMangaStream.kt +++ b/src/all/wpmangastream/src/eu/kanade/tachiyomi/extension/all/wpmangastream/WPMangaStream.kt @@ -103,8 +103,7 @@ abstract class WPMangaStream( } override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { - val builtUrl = if (page == 1) "$baseUrl/manga/" else "$baseUrl/manga/page/$page/" - val url = HttpUrl.parse(builtUrl)!!.newBuilder() + val url = HttpUrl.parse("$baseUrl/manga/")!!.newBuilder() url.addQueryParameter("title", query) url.addQueryParameter("page", page.toString()) filters.forEach { filter -> diff --git a/src/all/wpmangastream/src/eu/kanade/tachiyomi/extension/all/wpmangastream/WPMangaStreamFactory.kt b/src/all/wpmangastream/src/eu/kanade/tachiyomi/extension/all/wpmangastream/WPMangaStreamFactory.kt index 04b2338ee..645434ae5 100644 --- a/src/all/wpmangastream/src/eu/kanade/tachiyomi/extension/all/wpmangastream/WPMangaStreamFactory.kt +++ b/src/all/wpmangastream/src/eu/kanade/tachiyomi/extension/all/wpmangastream/WPMangaStreamFactory.kt @@ -1,6 +1,5 @@ package eu.kanade.tachiyomi.extension.all.wpmangastream -import android.annotation.SuppressLint import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.asObservableSuccess import eu.kanade.tachiyomi.source.Source @@ -466,150 +465,13 @@ class KomikGo : WPMangaStream("Komik GO (WP Manga Stream)", "https://komikgo.com Genre("Yuri", "yuri") ) } + class KomikIndo : WPMangaStream("Komik Indo (WP Manga Stream)", "https://www.komikindo.web.id", "id") { - - override fun popularMangaRequest(page: Int): Request { - val url = if (page == 1) baseUrl else "$baseUrl/page/$page" - return GET(url, headers) - } - - override fun latestUpdatesRequest(page: Int): Request { - val url = if (page == 1) "$baseUrl/manga/" else "$baseUrl/manga/page/$page" - return GET(url, headers) - } - - override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { - var builtUrl = if (page == 1) "$baseUrl/manga/" else "$baseUrl/manga/page/$page/" - if (query != "") { - builtUrl = if (page == 1) "$baseUrl/search/$query/" else "$baseUrl/search/$query/page/$page/" - } else if (filters.size > 0) { - filters.forEach { filter -> - when (filter) { - is GenreListFilter -> { - builtUrl = if (page == 1) "$baseUrl/genres/" + filter.toUriPart() else "$baseUrl/genres/" + filter.toUriPart() + "/page/$page/" - } - } - } - } - val url = HttpUrl.parse(builtUrl)!!.newBuilder() - return GET(url.build().toString(), headers) - } - - override fun popularMangaSelector() = "div.lchap > .lch > .ch" - override fun latestUpdatesSelector() = "div.ctf > div.lsmin > div.chl" - override fun searchMangaSelector() = latestUpdatesSelector() - - override fun popularMangaFromElement(element: Element): SManga { - val manga = SManga.create() - manga.thumbnail_url = element.select("div.thumbnail img").first().attr("src") - element.select("div.l > h3 > a").first().let { - manga.setUrlWithoutDomain(it.attr("href")) - manga.title = it.text() - } - return manga - } - - override fun searchMangaFromElement(element: Element): SManga { - val manga = SManga.create() - manga.thumbnail_url = element.select("div.thumbnail img").first().attr("src") - element.select("div.chlf > h2 > a").first().let { - manga.setUrlWithoutDomain(it.attr("href")) - manga.title = it.text() - } - return manga - } - - override fun latestUpdatesFromElement(element: Element): SManga = searchMangaFromElement(element) - - @SuppressLint("DefaultLocale") - override fun mangaDetailsParse(document: Document): SManga { - val infoElm = document.select(".listinfo > ul > li") - val manga = SManga.create() - infoElm.forEach { elmt -> - val infoTitle = elmt.select("b").text().toLowerCase() - val infoContent = elmt.text() - when { - infoTitle.contains("status") -> manga.status = parseStatus(infoContent) - infoTitle.contains("author") -> manga.author = infoContent - infoTitle.contains("artist") -> manga.artist = infoContent - infoTitle.contains("genres") -> { - val genres = mutableListOf() - elmt.select("a").forEach { - val genre = it.text() - genres.add(genre) - } - manga.genre = genres.joinToString(", ") - } - } - } - manga.description = document.select("div.rm > span > p:first-child").text() - manga.thumbnail_url = document.select("div.animeinfo .lm .imgdesc img:first-child").attr("src") - return manga - } - - private class GenreListFilter : UriPartFilter("Genre", arrayOf( - Pair("Default", ""), - Pair("4-Koma", "4-koma"), - Pair("Action", "action"), - Pair("Adventure", "adventure"), - Pair("Comedy", "comedy"), - Pair("Cooking", "cooking"), - Pair("Crime", "crime"), - Pair("Dark Fantasy", "dark-fantasy"), - Pair("Demons", "demons"), - Pair("Drama", "drama"), - Pair("Ecchi", "ecchi"), - Pair("Fantasy", "fantasy"), - Pair("Game", "game"), - Pair("Gender Bender", "gender-bender"), - Pair("Harem", "harem"), - Pair("Historical", "historical"), - Pair("Horor", "horor"), - Pair("Horror", "horror"), - Pair("Isekai", "isekai"), - Pair("Josei", "josei"), - Pair("Komik Tamat", "komik-tamat"), - Pair("Life", "life"), - Pair("Magic", "magic"), - Pair("Manhua", "manhua"), - Pair("Martial Art", "martial-art"), - Pair("Martial Arts", "martial-arts"), - Pair("Mature", "mature"), - Pair("Mecha", "mecha"), - Pair("Military", "military"), - Pair("Music", "music"), - Pair("Mystery", "mystery"), - Pair("Post-Apocalyptic", "post-apocalyptic"), - Pair("Psychological", "psychological"), - Pair("Romance", "romance"), - Pair("School", "school"), - Pair("School Life", "school-life"), - Pair("Sci-Fi", "sci-fi"), - Pair("Seinen", "seinen"), - Pair("Shonen", "shonen"), - Pair("Shoujo", "shoujo"), - Pair("Shounen", "shounen"), - Pair("Slice of Life", "slice-of-life"), - Pair("Sports", "sports"), - Pair("Super Power", "super-power"), - Pair("Superheroes", "superheroes"), - Pair("Supernatural", "supernatural"), - Pair("Survival", "survival"), - Pair("Thriller", "thriller"), - Pair("Tragedy", "tragedy"), - Pair("Zombies", "zombies") - )) - - override fun getFilterList() = FilterList( - Filter.Header("NOTE: filter will be ignored when using text search!"), - GenreListFilter() - ) - - private open class UriPartFilter(displayName: String, val vals: Array>) : - Filter.Select(displayName, vals.map { it.first }.toTypedArray()) { - fun toUriPart() = vals[state].second - } + override fun popularMangaRequest(page: Int): Request = GET("$baseUrl/manga/?page=$page&order=popular", headers) + override fun latestUpdatesRequest(page: Int): Request = GET("$baseUrl/manga/?page=$page&order=latest", headers) + override fun popularMangaNextPageSelector() = "a.r" } + class MaidManga : WPMangaStream("Maid Manga (WP Manga Stream)", "https://www.maid.my.id", "id") { override fun latestUpdatesSelector() = "h2:contains(Update Chapter) + div.row div.col-12" override fun latestUpdatesRequest(page: Int): Request {