parent
38de421bba
commit
666fb51186
|
@ -246,7 +246,7 @@ abstract class MangaEsp(
|
||||||
companion object {
|
companion object {
|
||||||
private val UNESCAPE_REGEX = """\\(.)""".toRegex()
|
private val UNESCAPE_REGEX = """\\(.)""".toRegex()
|
||||||
val MANGA_LIST_REGEX = """self\.__next_f\.push\(.*data\\":(\[.*trending.*])\}""".toRegex()
|
val MANGA_LIST_REGEX = """self\.__next_f\.push\(.*data\\":(\[.*trending.*])\}""".toRegex()
|
||||||
private val MANGA_DETAILS_REGEX = """self\.__next_f\.push\(.*data\\":(\{.*lastChapters.*\}).*\\"numFollow""".toRegex()
|
val MANGA_DETAILS_REGEX = """self\.__next_f\.push\(.*data\\":(\{.*lastChapters.*\}).*\\"numFollow""".toRegex()
|
||||||
const val MANGAS_PER_PAGE = 15
|
const val MANGAS_PER_PAGE = 15
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ ext {
|
||||||
extClass = '.EternalMangasFactory'
|
extClass = '.EternalMangasFactory'
|
||||||
themePkg = 'mangaesp'
|
themePkg = 'mangaesp'
|
||||||
baseUrl = 'https://eternalmangas.com'
|
baseUrl = 'https://eternalmangas.com'
|
||||||
overrideVersionCode = 0
|
overrideVersionCode = 1
|
||||||
isNsfw = true
|
isNsfw = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,11 +7,17 @@ import eu.kanade.tachiyomi.network.POST
|
||||||
import eu.kanade.tachiyomi.source.model.FilterList
|
import eu.kanade.tachiyomi.source.model.FilterList
|
||||||
import eu.kanade.tachiyomi.source.model.MangasPage
|
import eu.kanade.tachiyomi.source.model.MangasPage
|
||||||
import eu.kanade.tachiyomi.source.model.Page
|
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.util.asJsoup
|
import eu.kanade.tachiyomi.util.asJsoup
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import kotlinx.serialization.decodeFromString
|
import kotlinx.serialization.decodeFromString
|
||||||
import okhttp3.FormBody
|
import okhttp3.FormBody
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
|
import org.jsoup.Jsoup
|
||||||
|
import java.text.ParseException
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
open class EternalMangas(
|
open class EternalMangas(
|
||||||
lang: String,
|
lang: String,
|
||||||
|
@ -55,9 +61,62 @@ open class EternalMangas(
|
||||||
return parseComicsList(page, query, filters)
|
return parseComicsList(page, query, filters)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun pageListParse(response: Response): List<Page> {
|
override fun mangaDetailsParse(response: Response) = SManga.create().apply {
|
||||||
var document = response.asJsoup()
|
val body = jsRedirect(response)
|
||||||
|
|
||||||
|
MANGA_DETAILS_REGEX.find(body)?.groupValues?.get(1)?.let {
|
||||||
|
val unescapedJson = it.unescape()
|
||||||
|
return json.decodeFromString<SeriesDto>(unescapedJson).toSMangaDetails()
|
||||||
|
}
|
||||||
|
|
||||||
|
val document = Jsoup.parse(body)
|
||||||
|
with(document.selectFirst("div#info")!!) {
|
||||||
|
title = select("div:has(p.font-bold:contains(Títuto)) > p.text-sm").text()
|
||||||
|
author = select("div:has(p.font-bold:contains(Autor)) > p.text-sm").text()
|
||||||
|
artist = select("div:has(p.font-bold:contains(Artista)) > p.text-sm").text()
|
||||||
|
genre = select("div:has(p.font-bold:contains(Género)) > p.text-sm > span").joinToString { it.ownText() }
|
||||||
|
}
|
||||||
|
description = document.select("div#sinopsis p").text()
|
||||||
|
thumbnail_url = document.selectFirst("div.contenedor img.object-cover")?.imgAttr()
|
||||||
|
}
|
||||||
|
|
||||||
|
private val dateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US)
|
||||||
|
|
||||||
|
override fun chapterListParse(response: Response): List<SChapter> {
|
||||||
|
val body = jsRedirect(response)
|
||||||
|
|
||||||
|
MANGA_DETAILS_REGEX.find(body)?.groupValues?.get(1)?.let {
|
||||||
|
val unescapedJson = it.unescape()
|
||||||
|
val series = json.decodeFromString<SeriesDto>(unescapedJson)
|
||||||
|
return series.chapters.map { chapter -> chapter.toSChapter(seriesPath, series.slug) }
|
||||||
|
}
|
||||||
|
|
||||||
|
val document = Jsoup.parse(body)
|
||||||
|
return document.select("div.contenedor > div.grid > div > a").map {
|
||||||
|
SChapter.create().apply {
|
||||||
|
name = it.selectFirst("span.text-sm")!!.text()
|
||||||
|
date_upload = try {
|
||||||
|
it.selectFirst("span.chapter-date")?.attr("data-date")?.let { date ->
|
||||||
|
dateFormat.parse(date)?.time
|
||||||
|
} ?: 0
|
||||||
|
} catch (e: ParseException) {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
setUrlWithoutDomain(it.selectFirst("a")!!.attr("href"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun pageListParse(response: Response): List<Page> {
|
||||||
|
val doc = Jsoup.parse(jsRedirect(response))
|
||||||
|
return doc.select("main > img").mapIndexed { i, img ->
|
||||||
|
Page(i, imageUrl = img.imgAttr())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun jsRedirect(response: Response): String {
|
||||||
|
var body = response.body.string()
|
||||||
|
val document = Jsoup.parse(body)
|
||||||
document.selectFirst("body > form[method=post]")?.let {
|
document.selectFirst("body > form[method=post]")?.let {
|
||||||
val action = it.attr("action")
|
val action = it.attr("action")
|
||||||
val inputs = it.select("input")
|
val inputs = it.select("input")
|
||||||
|
@ -67,12 +126,9 @@ open class EternalMangas(
|
||||||
form.add(input.attr("name"), input.attr("value"))
|
form.add(input.attr("name"), input.attr("value"))
|
||||||
}
|
}
|
||||||
|
|
||||||
document = client.newCall(POST(action, headers, form.build())).execute().asJsoup()
|
body = client.newCall(POST(action, headers, form.build())).execute().body.string()
|
||||||
}
|
|
||||||
|
|
||||||
return document.select("main > img").mapIndexed { i, img ->
|
|
||||||
Page(i, imageUrl = img.imgAttr())
|
|
||||||
}
|
}
|
||||||
|
return body
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
|
|
Loading…
Reference in New Issue