Add MangaLatino (#19486)

This commit is contained in:
bapeey 2023-12-30 16:54:29 -05:00 committed by GitHub
parent 5835112840
commit ff89737d57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 195 additions and 0 deletions

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View File

@ -0,0 +1,12 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
ext {
extName = 'Manga Latino'
pkgNameSuffix = 'es.mangalatino'
extClass = '.MangaLatino'
extVersionCode = 1
isNsfw = true
}
apply from: "$rootDir/common.gradle"

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

View File

@ -0,0 +1,119 @@
package eu.kanade.tachiyomi.extension.es.mangalatino
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.interceptor.rateLimitHost
import eu.kanade.tachiyomi.source.model.Filter
import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
import okhttp3.Headers
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.OkHttpClient
import okhttp3.Request
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
class MangaLatino : ParsedHttpSource() {
override val name = "MangaLatino"
override val baseUrl = "https://mangalatino.com"
override val lang = "es"
override val supportsLatest = true
override val client: OkHttpClient = network.client.newBuilder()
.rateLimitHost(baseUrl.toHttpUrl(), 2)
.build()
override fun headersBuilder(): Headers.Builder = Headers.Builder()
.add("Referer", baseUrl)
override fun popularMangaRequest(page: Int): Request = GET("$baseUrl/mangas?page=$page", headers)
override fun popularMangaSelector(): String = "section.blog-listing div.row div.blog-grid"
override fun popularMangaNextPageSelector(): String = "nav > ul.pagination > li > a[rel=next]"
override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply {
setUrlWithoutDomain(element.select("div.blog-info a").attr("href"))
title = element.select("div.blog-info a").text()
thumbnail_url = element.selectFirst("div.blog-img img")?.attr("abs:src")
}
override fun latestUpdatesRequest(page: Int): Request = GET(baseUrl, headers)
override fun latestUpdatesSelector(): String = "div.row > div.col-sm-12:eq(1) ~ div.col-6:not(div.col-sm-12:gt(1) ~ div.col-6)"
override fun latestUpdatesNextPageSelector(): String? = null
override fun latestUpdatesFromElement(element: Element): SManga = SManga.create().apply {
val href = element.selectFirst("div.blog-info a")!!.attr("href")
val slug = href.substringAfterLast("/").substringBeforeLast("-")
url = "/serie/$slug"
title = element.select("div.blog-info a").text().substringBeforeLast("Capítulo").trim()
thumbnail_url = element.selectFirst("div.blog-img img")?.attr("abs:src")
}
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
val url = "$baseUrl/mangas".toHttpUrl().newBuilder()
if (query.isNotEmpty()) {
url.addQueryParameter("buscar", query)
} else {
filters.forEach { filter ->
when (filter) {
is GenreFilter -> {
url.addQueryParameter("tag", filter.toUriPart())
}
else -> {}
}
}
}
url.addQueryParameter("page", page.toString())
return GET(url.build(), headers)
}
override fun searchMangaSelector(): String = popularMangaSelector()
override fun searchMangaNextPageSelector(): String = popularMangaNextPageSelector()
override fun searchMangaFromElement(element: Element): SManga = popularMangaFromElement(element)
override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply {
with(document.selectFirst("div.starter-template")!!) {
selectFirst("img[src]")?.let { thumbnail_url = it.attr("abs:src") }
selectFirst("h1")?.let { title = it.text() }
description = selectFirst("p")?.text()
genre = select("> a.btn").joinToString { it.text() }
}
}
override fun chapterListSelector(): String = "div.panel ul.list-group > li > a"
override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply {
setUrlWithoutDomain(element.attr("href"))
name = element.selectFirst("span")!!.text()
}
override fun pageListParse(document: Document): List<Page> {
return document.select("section.blog-listing div.panel-body > img[src]").mapIndexed { i, element ->
Page(i, "", element.attr("abs:src"))
}
}
override fun imageRequest(page: Page): Request {
val noRefererHeader = headers.newBuilder().removeAll("Referer").build()
return GET(page.imageUrl!!, noRefererHeader)
}
override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not used!")
override fun getFilterList(): FilterList = FilterList(
Filter.Header("NOTA: La búsqueda por texto ignorará los demás filtros."),
Filter.Separator(),
GenreFilter(),
)
}

View File

@ -0,0 +1,62 @@
package eu.kanade.tachiyomi.extension.es.mangalatino
import eu.kanade.tachiyomi.source.model.Filter
class GenreFilter() : UriPartFilter(
"Tags",
arrayOf(
Pair("Acción", "accion"),
Pair("Animación", "animacion"),
Pair("Apocalíptico", "apocaliptico"),
Pair("Artes Marciales", "artes-marciales"),
Pair("Aventura", "aventura"),
Pair("Boys Love", "boys-love"),
Pair("Ciberpunk", "ciberpunk"),
Pair("Ciencia Ficción", "ciencia-ficcion"),
Pair("Comedia", "comedia"),
Pair("Crimen", "crimen"),
Pair("Demonios", "demonios"),
Pair("Deporte", "deporte"),
Pair("Drama", "drama"),
Pair("Ecchi", "ecchi"),
Pair("Extranjero", "extranjero"),
Pair("Familia", "familia"),
Pair("Fantasia", "fantasia"),
Pair("Género Bender", "genero-bender"),
Pair("Girls Love", "girls-love"),
Pair("Gore", "gore"),
Pair("Guerra", "guerra"),
Pair("Harem", "harem"),
Pair("Historia", "historia"),
Pair("Horror", "horror"),
Pair("Magia", "magia"),
Pair("Mecha", "mecha"),
Pair("Militar", "militar"),
Pair("Misterio", "misterio"),
Pair("Musica", "musica"),
Pair("Niños", "ninos"),
Pair("Oeste", "oeste"),
Pair("Parodia", "parodia"),
Pair("Policiaco", "policiaco"),
Pair("Psicológico", "psicologico"),
Pair("Realidad", "realidad"),
Pair("Realidad Virtual", "realidad-virtual"),
Pair("Recuentos de la vida", "recuentos-de-la-vida"),
Pair("Reencarnación", "reencarnacion"),
Pair("Romance", "romance"),
Pair("Samurái", "samurai"),
Pair("Sobrenatural", "sobrenatural"),
Pair("Superpoderes", "superpoderes"),
Pair("Supervivencia", "supervivencia"),
Pair("Telenovela", "telenovela"),
Pair("Thriller", "thriller"),
Pair("Tragedia", "tragedia"),
Pair("Vampiros", "vampiros"),
Pair("Vida Escolar", "vida-escolar"),
),
)
open class UriPartFilter(displayName: String, val vals: Array<Pair<String, String>>) :
Filter.Select<String>(displayName, vals.map { it.first }.toTypedArray()) {
fun toUriPart() = vals[state].second
}