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{uiMRuhI^&=pcZL2r~%AB;Wpyx
zgp=b1;)ET8cKi)Kd_JR^;_j)+>SFz+l-%)*oxSBcrOKszV6rjDm7g@E0HAU*_&AI}
zKCC8}9QdDcgA(yA2=;6H;oIy{_s2P*Pv1D(!!1W8S!7-&(QD*%f&0xIU47kEB)fa`
zZZac&Q*W?4+`zzvu2m!v0CP3RjPf=6FF)&L#4UFVUkM7+B*Xgi!8F}{#QI9RO^`B+
zv+scFprZSS9@38u)_sB)Q8ll>!L}0EGxqD%paSV)EDHwn{L78
zw3PJIX3q)_)Z*CpG58LxR>jnCmcGu!6>eIrd-L?G(QM(hre{p}an+o5cvOm9Ttvq-
z#Ct|lJ0b%q!7^tcBZYdT0MN10p-UWQq)G7zOas6|Toz`jICQ+HZVf@~f{F9U{n1%y
zn=VRRGL@gLKQ7^KMQE5169KUE0XZS(mj0-XljN{m8G8=<<4N|u7W$P6>f1dhlEjdt
zYEGXWyER+yhY<7?KHKdYcLMv@!ytI%W@%e%IG)H581^ulcK
zn*%)Oy;?#QJQ?v9Tg^Wv1qm9+07KshqlTUfbczGyIcf%Lj=H0gQ*2M)Q|GzZ6g0QY
z&t#zLE$~R(_iw_Q2AtIbpENWov*?b$o`f~xVYO%k?xi-7Y3ttT#nzM*maV7a(TT7Y
z*eTHrKYSA1)NktW*R|dxn2Sp5LD=!Irp1*edsz6wk0hkc+0@sDfmtr>$Z0rSb|vkA
ze5gStp#H}2M#Y?iE@j0S(_dcUrgOQg)#|dwWuTRDFYxL>{{22`vZJxBi3uR&{_~fZFz`U1l^#+5
z`+fA}tu!K-m+8NUKK{BH#OZwmY`2K;{xf=eVy 1) "page/$page/" else ""
+ return GET("$baseUrl/mangas/$path?orderby=views&order=desc", headers)
+ }
+
+ override fun popularMangaSelector(): String = "div.film_list div.flw-item"
+
+ override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply {
+ title = element.selectFirst("h3.film-name")!!.text()
+ thumbnail_url = element.selectFirst("img.film-poster-img")!!.srcAttr()
+ setUrlWithoutDomain(element.selectFirst("a.dynamic-name")!!.attr("href"))
+ }
+
+ override fun popularMangaNextPageSelector(): String = "div.wp-pagenavi > a:last-child"
+
+ override fun latestUpdatesRequest(page: Int): Request = GET(baseUrl, headers)
+
+ override fun latestUpdatesSelector() = "div.capitulo_recentehome"
+
+ override fun latestUpdatesFromElement(element: Element): SManga = SManga.create().apply {
+ title = element.selectFirst("h3")!!.text()
+ thumbnail_url = element.selectFirst("img")!!.absUrl("data-src")
+ setUrlWithoutDomain(element.selectFirst("h3 > a")!!.attr("href"))
+ }
+
+ override fun latestUpdatesNextPageSelector(): String? = null
+
+ override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
+ val path = if (page > 1) "page/$page/" else ""
+ val url = "$baseUrl/$path".toHttpUrl().newBuilder()
+ .addQueryParameter("s", query)
+ .build()
+
+ return GET(url, headers)
+ }
+
+ override fun searchMangaSelector() = popularMangaSelector()
+
+ override fun searchMangaFromElement(element: Element) = popularMangaFromElement(element)
+
+ override fun searchMangaNextPageSelector() = popularMangaNextPageSelector()
+
+ override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply {
+ val infoElement = document.selectFirst("div.capitulo_recente")!!
+
+ title = document.select("title").text().substringBeforeLast(" - ")
+ genre = infoElement.select("ul.genre-list li a")
+ .joinToString { it.text() }
+ description = infoElement.selectFirst("div.boxAnimeSobreLast p:last-child")!!.ownText()
+ thumbnail_url = infoElement.selectFirst("div.capaMangaInfo img")!!.absUrl("src")
+ }
+
+ override fun chapterListSelector() = "div.manga-chapters div.single-chapter"
+
+ override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply {
+ name = element.selectFirst("a")!!.text()
+ date_upload = element.selectFirst("small small")!!.text().toDate()
+ setUrlWithoutDomain(element.selectFirst("a")!!.attr("href"))
+ }
+
+ override fun pageListParse(document: Document): List {
+ return document.selectFirst("h1.heading-header + script[src^=data]")!!
+ .attr("src")
+ .substringAfter("base64,")
+ .let { Base64.decode(it, Base64.DEFAULT).toString(charset("UTF-8")) }
+ .substringAfter("var imagens_cap=")
+ .let { json.decodeFromString>(it) }
+ .mapIndexed { index, imageUrl ->
+ Page(index, document.location(), imageUrl)
+ }
+ }
+
+ override fun imageUrlParse(document: Document) = ""
+
+ override fun imageRequest(page: Page): Request {
+ val newHeaders = headersBuilder()
+ .set("Referer", page.url)
+ .build()
+
+ return GET(page.imageUrl!!, newHeaders)
+ }
+
+ private fun Element.srcAttr(): String = when {
+ hasAttr("data-src") -> absUrl("data-src")
+ else -> absUrl("src")
+ }
+
+ private fun String.toDate(): Long {
+ return runCatching { DATE_FORMATTER.parse(trim())?.time }
+ .getOrNull() ?: 0L
+ }
+
+ companion object {
+ private val DATE_FORMATTER by lazy {
+ SimpleDateFormat("dd-MM-yyyy", Locale("pt", "BR"))
+ }
+ }
+}