From 4c20384d393bd6a8079ad23f8f62abff44a31fe5 Mon Sep 17 00:00:00 2001 From: devi Date: Wed, 9 Aug 2023 20:59:03 +0200 Subject: [PATCH] add sources and small fix --- .../parsers/site/foolslide/FoolSlideParser.kt | 4 - .../parsers/site/madara/es/TempleScanEsp.kt | 16 ++ .../parsers/site/madara/es/TenkaiScan.kt | 11 ++ .../parsers/site/mangareader/ar/Ozulscans.kt | 2 +- .../kotatsu/parsers/site/vmp/VmpParser.kt | 138 ++++++++++++++++++ .../parsers/site/vmp/es/VerComicsPorno.kt | 14 ++ .../parsers/site/vmp/es/VerMangasPorno.kt | 10 ++ 7 files changed, 190 insertions(+), 5 deletions(-) create mode 100644 src/main/kotlin/org/koitharu/kotatsu/parsers/site/madara/es/TempleScanEsp.kt create mode 100644 src/main/kotlin/org/koitharu/kotatsu/parsers/site/madara/es/TenkaiScan.kt create mode 100644 src/main/kotlin/org/koitharu/kotatsu/parsers/site/vmp/VmpParser.kt create mode 100644 src/main/kotlin/org/koitharu/kotatsu/parsers/site/vmp/es/VerComicsPorno.kt create mode 100644 src/main/kotlin/org/koitharu/kotatsu/parsers/site/vmp/es/VerMangasPorno.kt diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/foolslide/FoolSlideParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/foolslide/FoolSlideParser.kt index 28eb0293..547e0152 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/foolslide/FoolSlideParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/foolslide/FoolSlideParser.kt @@ -61,10 +61,6 @@ internal abstract class FoolSlideParser( } else { append(page.toString()) } - - if (!query.isNullOrEmpty()) { - append(query.urlEncoded()) - } } webClient.httpGet(url).parseHtml() } diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/madara/es/TempleScanEsp.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/madara/es/TempleScanEsp.kt new file mode 100644 index 00000000..7c55526e --- /dev/null +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/madara/es/TempleScanEsp.kt @@ -0,0 +1,16 @@ +package org.koitharu.kotatsu.parsers.site.madara.es + +import org.koitharu.kotatsu.parsers.MangaLoaderContext +import org.koitharu.kotatsu.parsers.MangaSourceParser +import org.koitharu.kotatsu.parsers.model.ContentType +import org.koitharu.kotatsu.parsers.model.MangaSource +import org.koitharu.kotatsu.parsers.site.madara.MadaraParser + +@MangaSourceParser("TEMPLESCANESP", "TempleScanEsp", "es" , ContentType.HENTAI) +internal class TempleScanEsp(context: MangaLoaderContext) : + MadaraParser(context, MangaSource.TEMPLESCANESP, "templescanesp.com") { + + override val listUrl = "series/" + override val tagPrefix = "genero/" + override val datePattern = "dd.MM.yyyy" +} diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/madara/es/TenkaiScan.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/madara/es/TenkaiScan.kt new file mode 100644 index 00000000..d8a1d205 --- /dev/null +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/madara/es/TenkaiScan.kt @@ -0,0 +1,11 @@ +package org.koitharu.kotatsu.parsers.site.madara.es + +import org.koitharu.kotatsu.parsers.MangaLoaderContext +import org.koitharu.kotatsu.parsers.MangaSourceParser +import org.koitharu.kotatsu.parsers.model.ContentType +import org.koitharu.kotatsu.parsers.model.MangaSource +import org.koitharu.kotatsu.parsers.site.madara.MadaraParser + +@MangaSourceParser("TENKAISCAN", "Tenkai Scan", "es" , ContentType.HENTAI) +internal class TenkaiScan(context: MangaLoaderContext) : + MadaraParser(context, MangaSource.TENKAISCAN, "tenkaiscan.net") diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangareader/ar/Ozulscans.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangareader/ar/Ozulscans.kt index dc70d307..2e8ebbe4 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangareader/ar/Ozulscans.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangareader/ar/Ozulscans.kt @@ -7,4 +7,4 @@ import org.koitharu.kotatsu.parsers.site.mangareader.MangaReaderParser @MangaSourceParser("OZULSCANS", "Ozulscans", "ar") internal class Ozulscans(context: MangaLoaderContext) : - MangaReaderParser(context, MangaSource.OZULSCANS, "ozulscans.com", pageSize = 30, searchPageSize = 30) + MangaReaderParser(context, MangaSource.OZULSCANS, "ozulmanga.com", pageSize = 30, searchPageSize = 30) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vmp/VmpParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vmp/VmpParser.kt new file mode 100644 index 00000000..dd6015ee --- /dev/null +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vmp/VmpParser.kt @@ -0,0 +1,138 @@ +package org.koitharu.kotatsu.parsers.site.vmp + +import kotlinx.coroutines.coroutineScope +import org.koitharu.kotatsu.parsers.MangaLoaderContext +import org.koitharu.kotatsu.parsers.PagedMangaParser +import org.koitharu.kotatsu.parsers.config.ConfigKey +import org.koitharu.kotatsu.parsers.model.* +import org.koitharu.kotatsu.parsers.util.* +import java.util.* + +internal abstract class VmpParser( + context: MangaLoaderContext, + source: MangaSource, + domain: String, + pageSize: Int = 24, +) : PagedMangaParser(context, source, pageSize) { + + override val configKeyDomain = ConfigKey.Domain(domain) + + override val sortOrders: Set = EnumSet.of(SortOrder.UPDATED) + + protected open val listUrl = "xxx/" + protected open val geneUrl = "genero/" + + init { + paginator.firstPage = 1 + searchPaginator.firstPage = 1 + } + + override suspend fun getListPage( + page: Int, + query: String?, + tags: Set?, + sortOrder: SortOrder, + ): List { + + val url = buildString { + append("https://$domain/") + if(!tags.isNullOrEmpty()) + { + append(geneUrl) + for (tag in tags) { + append(tag.key) + } + append("/page/") + append(page.toString()) + + }else + { + append(listUrl) + append("/page/") + append(page.toString()) + if (!query.isNullOrEmpty()) { + append("?s=") + append(query.urlEncoded()) + } + } + } + + val doc = webClient.httpGet(url).parseHtml() + + return doc.select("div.blog-list-items div.entry").map { div -> + val href = div.selectFirstOrThrow("a").attrAsRelativeUrl("href") + Manga( + id = generateUid(href), + url = href, + publicUrl = href.toAbsoluteUrl(div.host ?: domain), + coverUrl = div.selectFirst("img")?.src().orEmpty(), + title = div.selectFirstOrThrow("h2").text().orEmpty(), + altTitle = null, + rating = RATING_UNKNOWN, + tags = emptySet(), + author = null, + state = null, + source = source, + isNsfw = isNsfwSource, + ) + } + + } + + override suspend fun getTags(): Set { + val doc = webClient.httpGet("https://$domain/$listUrl").parseHtml() + return doc.select("div.tagcloud a").mapNotNullToSet { a -> + MangaTag( + key = a.attr("href").removeSuffix("/").substringAfterLast(geneUrl, ""), + title = a.text().toTitleCase(), + source = source, + ) + } + } + + override suspend fun getDetails(manga: Manga): Manga = coroutineScope { + val fullUrl = manga.url.toAbsoluteUrl(domain) + val doc= webClient.httpGet(fullUrl).parseHtml() + + manga.copy( + tags = doc.select("div.tax_box div.links ul:not(.post-categories) li a").mapNotNullToSet { a -> + MangaTag( + key = a.attr("href").removeSuffix("/").substringAfterLast(geneUrl, ""), + title = a.text().toTitleCase(), + source = source, + ) + }, + description = null, + altTitle = null, + author = null, + state = null, + chapters = listOf( + MangaChapter( + id = manga.id, + name = manga.title, + number = 1, + url = manga.url, + scanlator = null, + uploadDate = 0, + branch = null, + source = source, + ), + ), + ) + } + + override suspend fun getPages(chapter: MangaChapter): List { + val fullUrl = chapter.url.toAbsoluteUrl(domain) + val doc = webClient.httpGet(fullUrl).parseHtml() + return doc.select("div.wp-content img").map { div -> + val img = div.selectFirstOrThrow("img") + val url = img.src()?.toRelativeUrl(domain) ?: div.parseFailed("Image src not found") + MangaPage( + id = generateUid(url), + url = url, + preview = null, + source = source, + ) + } + } +} diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vmp/es/VerComicsPorno.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vmp/es/VerComicsPorno.kt new file mode 100644 index 00000000..c8cf368c --- /dev/null +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vmp/es/VerComicsPorno.kt @@ -0,0 +1,14 @@ +package org.koitharu.kotatsu.parsers.site.vmp.es + +import org.koitharu.kotatsu.parsers.MangaLoaderContext +import org.koitharu.kotatsu.parsers.MangaSourceParser +import org.koitharu.kotatsu.parsers.model.MangaSource +import org.koitharu.kotatsu.parsers.site.vmp.VmpParser + +// Other domain name : toonx.net +@MangaSourceParser("VERCOMICSPORNO", "VerComicsPorno", "es") +internal class VerComicsPorno(context: MangaLoaderContext) : + VmpParser(context, MangaSource.VERCOMICSPORNO, "vercomicsporno.com") { + override val listUrl = "comics-porno/" + override val geneUrl = "etiquetas/" +} diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vmp/es/VerMangasPorno.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vmp/es/VerMangasPorno.kt new file mode 100644 index 00000000..2ee37135 --- /dev/null +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vmp/es/VerMangasPorno.kt @@ -0,0 +1,10 @@ +package org.koitharu.kotatsu.parsers.site.vmp.es + +import org.koitharu.kotatsu.parsers.MangaLoaderContext +import org.koitharu.kotatsu.parsers.MangaSourceParser +import org.koitharu.kotatsu.parsers.model.MangaSource +import org.koitharu.kotatsu.parsers.site.vmp.VmpParser + +@MangaSourceParser("VERMANGASPORNO", "VerMangasPorno", "es") +internal class VerMangasPorno(context: MangaLoaderContext) : + VmpParser(context, MangaSource.VERMANGASPORNO, "vermangasporno.com")